-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Webapp: structure in directories and add READMEs
- Loading branch information
1 parent
bc077a9
commit 35894ba
Showing
94 changed files
with
192 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
In this dir is the code for the webapp and electron app | ||
In this dir is the code for the _Kappapp_ webapp and electron app! | ||
|
||
`.ml` files starting by a capital, as `KaSimWorker.ml` are executable files. | ||
### Directory structure | ||
|
||
TODO: revamp this as it's really imprecise and incomplete | ||
`viz/main.js` contains the code for the main electron process | ||
`runtime_processes.ml` setups the manager and runs the local subprocesses on electron | ||
`JsSim.ml` defines the window DOM and its different components | ||
- Panel_tab contains all tabs from a project, other panels manages settings, projects... | ||
- tabs are the tabs of different tools in a given project, some are in fact subtabs in the right hand side of the editor, which is called subpanel_editor | ||
- state_* files manages in part the logic in the given app parts | ||
The `.ml` files in this directory , as `KaSimWorker.ml` are executable files, as indicated by their capitalization. | ||
|
||
`JsSim.ml` defines the main executable, with the window DOM and its different components, | ||
while the other are the different workers that can be ran as webworkers/threads in the app. | ||
|
||
`secret_method_name` indicate a method that should be called only by inherited classes. However this was not respected thoroughly so it has not be replaced | ||
by `inherit parent as super ... super#private_method` which fills this need in the language | ||
`ui` contains the different panels and tabs making the interface, along with their logic. The logic tries to match in limited fashion the view and controller roles in a Control/Model/View architecture (controller for controller_* files in `ui/tab_editor`) | ||
|
||
`_mpi` indicates the message passing interface of the different processes and web workers (threads) used | ||
Files in `state` manages state logic from different app part, similar to a `model` in a Control/Model/View architecture. | ||
|
||
`entry_point` contains the entry point info for the html main page of the webapp and electron app config | ||
|
||
`lib`, `lib_no_jsoo`, `js_lib` contain libs used by the webapp. Those in `lib_no_jsoo` do not depend on js_of_ocaml. Libs in `js_lib` are written in javascript`, while the other are in ocaml. | ||
|
||
`resources` contains resources used to build the webapp and electron app. | ||
|
||
### Runtime | ||
The app is divided in : | ||
- the interface | ||
- the agents: kasim, kamoha, kasa, kastor. Which are handling respectively the simulation, the project files, the static analysis, the analysis of traces and computation of stories | ||
|
||
There are two different runtimes for the agents (see `state_runtime.ml`) : | ||
- webworkers/threads for the agents (`runtime_web_workers.ml`). | ||
There are two different runtimes for the agents (see `state/state_runtime.ml`) : | ||
- webworkers/threads for the agents (`state/runtime_web_workers.ml`). | ||
This is the mode ran in the browser. The app uses a matching client to communicate with each thread e.g. `kasa_client` which are writing _messages_ to the agents. The threads are spawned as _workers_ e.g. `KaSaWorker`, which use the _message passing interface_ logic e.g. `kasa_mpi`, which parses the messages and compute what is asked by the clients. | ||
There is a special case for the kasim agent. There is an `KaSimAsEmbedded` option that run it in the main thread and not in a separated web worker thread. The logic for the agent is then not in the `_mpi` but in `kasim_runtime` as it is used in both the _worker_ and in the main thread. Mode with kasim in a separated thread is called `KasimAsWebWorker` | ||
- processes for the agents (`runtime_processes.ml`) | ||
- processes for the agents (`state/runtime_processes.ml`) | ||
This is the mode ran in the electron app. The app uses clients to communicate with agent processes. | ||
Agents processes are defined in `core/agent` with a name starting with a capital letter. `mpi` files are in in different directories of `core` . | ||
Kamoha agent and kastor agent have names that doesn't end in agent, which can be misleading. (TODO: change this?) | ||
The app here spawns two processes, Kastor and KappaSwitchman. The KappaSwitchman one then spawns the other agents and manages the communication between them and the app. | ||
Kastor is not included with the others as it can be communicated to in raw, and it doesn't have an internal state. | ||
|
||
### Misc notes | ||
|
||
This code uses js_of_ocaml, the React lib for reactive programming, and lwt. | ||
Some changes in the code might cause parts of the code to not be called. This happens even with the removal of the dead code elimination in js_of_ocaml. A way to fix these issues is to use the Hooked lib in `lib_no_jsoo`, that is meant to replace the React lib with hooks, which don't have this issue. Replacing `React` by `Hooked` in place, and converting the signals to Hooked and back should help if this issue arise again. | ||
Feel free to add an implementation for needed `React` functions that are not yet implemented in `lib_no_jsoo/hooked.ml`. | ||
|
||
`secret_method_name` indicate a method that should be called only by inherited classes. However this was not respected thoroughly so it has not be replaced | ||
by `inherit parent as super ... super#private_method` which fills this need in the language | ||
|
||
`_mpi` indicates the message passing interface of the different processes and web workers (threads) used | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
`entry_point` contains the entry point info for the html main page of the webapp and electron app config |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This directory contains javascript libraries. | ||
|
||
`viz` contains js libs for vizualization from kappa tools. | ||
|
||
`flux.js` is used by the webapp, and by the html generation in ./core/simulation | ||
|
||
`graphlogger.js` by the webapp. | ||
|
||
`parser.js` might be unused. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This directory contains js libs for vizualization from kappa tools. | ||
|
||
Some files here are used in the webapp. | ||
|
||
`common.js` is also included by the html generation in `core/simulation` | ||
|
||
`Kappa.js` might be unused, and includes info for kappa language syntax highlighting. |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module DebugPrint : Kappa_webapp_lib_no_js.Hooked.DebugPrint = struct | ||
module DebugPrint : Kappa_webapp_lib_no_jsoo.Hooked.DebugPrint = struct | ||
let debug_print s = | ||
let () = Common.debug ~loc:__LOC__ s in | ||
() | ||
end | ||
|
||
module S = Kappa_webapp_lib_no_js.Hooked.MakeS (DebugPrint) | ||
module E = Kappa_webapp_lib_no_js.Hooked.MakeE (DebugPrint) | ||
module S = Kappa_webapp_lib_no_jsoo.Hooked.MakeS (DebugPrint) | ||
module E = Kappa_webapp_lib_no_jsoo.Hooked.MakeE (DebugPrint) | ||
|
||
type 'a signal = 'a S.t | ||
type 'a event = 'a E.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module DebugPrint : Kappa_webapp_lib_no_js.Hooked.DebugPrint | ||
module S : Kappa_webapp_lib_no_js.Hooked.S | ||
module E : Kappa_webapp_lib_no_js.Hooked.E | ||
module DebugPrint : Kappa_webapp_lib_no_jsoo.Hooked.DebugPrint | ||
module S : Kappa_webapp_lib_no_jsoo.Hooked.S | ||
module E : Kappa_webapp_lib_no_jsoo.Hooked.E | ||
|
||
type 'a signal = 'a S.t | ||
type 'a event = 'a E.t |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Here are libs used by the webapp that don't use js_of_ocaml. | ||
|
||
This allows to use ppx_inline_test on them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
(library | ||
(name kappa_webapp_lib_no_js) | ||
(name kappa_webapp_lib_no_jsoo) | ||
(inline_tests) | ||
(preprocess | ||
(pps | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Here are resources used to build the webapp |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Files in `state` manages state logic from different app part, similar to a `model` in a Control/Model/View architecture. | ||
|
||
`state_error.ml` manages errors at the webapp level | ||
|
||
`state_ui.ml` call _init_ and _sync_ for `state_*` files | ||
|
||
`state_file.ml` mainly manages editor & kasa stuff, but is accessed too from settings, state_ui | ||
|
||
`state_perturbation.ml` manages simulation perturbations, only used from panel preferences | ||
|
||
`state_runtime.ml` defines worker runtime, used from other `states_*` + preferences + projects controller | ||
|
||
`state_simulation.ml` sets simulation controls and functions to interact with simulation data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
(include ../dune_js_of_ocaml_flags.inc) | ||
|
||
(library | ||
(name kappa_webapp_state) | ||
(libraries | ||
|
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
(include ../dune_js_of_ocaml_flags.inc) | ||
(include_subdirs unqualified) | ||
|
||
(library | ||
(name kappa_webapp_ui) | ||
|
Oops, something went wrong.