diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2013-09-06 15:20:36 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2013-10-16 18:08:17 +0200 |
commit | 3781d33dbe3b116fc3816b40d867ec91b5999ed8 (patch) | |
tree | ec459069efdccf22b30d19aaf0ca5e339f02b9fc /install | |
parent | cd6a2c431e8c9f5f3e50a64047d21be336a208cc (diff) | |
download | freeipa-3781d33dbe3b116fc3816b40d867ec91b5999ed8.tar.gz freeipa-3781d33dbe3b116fc3816b40d867ec91b5999ed8.tar.xz freeipa-3781d33dbe3b116fc3816b40d867ec91b5999ed8.zip |
Phases Guide
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/doc/guides.json | 6 | ||||
-rw-r--r-- | install/ui/doc/guides/phases/README.md | 125 | ||||
-rw-r--r-- | install/ui/doc/guides/phases/icon.png | bin | 0 -> 3275 bytes |
3 files changed, 131 insertions, 0 deletions
diff --git a/install/ui/doc/guides.json b/install/ui/doc/guides.json index 466184d7c..3268c1ee4 100644 --- a/install/ui/doc/guides.json +++ b/install/ui/doc/guides.json @@ -2,6 +2,12 @@ { "title": "FreeIPA Web UI Guides", "items": [ + { + "name": "Phases", + "url": "guides/phases", + "title": "Appliaciton phases", + "description": "Introduction to application phases" + } ] } ]
\ No newline at end of file diff --git a/install/ui/doc/guides/phases/README.md b/install/ui/doc/guides/phases/README.md new file mode 100644 index 000000000..3d0058bab --- /dev/null +++ b/install/ui/doc/guides/phases/README.md @@ -0,0 +1,125 @@ +# Introduction + +Declarative nature and support for extensibility of FreeIPA WebUI +creates demand for structural initialization of the application. Phase +components were created to solve this tasks. + +## Components + +Phases functionality consists of the two components/modules: +`./_base/PhaseController` and `./phases`. + +### PhaseController + +Phase controller basically does all the work. It provides functionality for running and +changing phases. + +- define phases +- controls instantiation of PhaseController +- provides API for phase task registration + +## Phase + +Phase is a part of application runtime. Most of the phases are related +to load and initialization process. + +### Tasks + +Phase consists of task. Each task can have a priority set, 10 is +default. Task can by synchronous or asynchronous. When phase is started +it runs all tasks sequentially sorted by priority. If the task is +synchronous it waits for its completion before starting another task. +Asynchronous task are just started. Phase is completed when all task +finishes - waits for all asynchronous tasks. + +Asynchronous task is a task which handler returns a promise. + +### Phase task registration + +Modules should register a phase task through `./phases` module. + + phases.on('phase_name', handler, priority); + +## Descriptions of FreeIPA phases + +FreeIPA has following phases: + +- customization +- registration +- init +- metadata +- post-metadata +- profile +- runtime +- shutdown + +### Resource load implicit phase + +Each application needs to load its resources. This mainly means +JavaScript files but also CSS files, images and fonts. Phases modules +are part of that data and therefore are no initialized until loaded. +Hence resources load is an implicit and a first phase. + +FreeIPA Web UI uses AMD modules therefore resources have to be either +declared in main HTML file’s header or in modules specification. The +former one is obsolete and should be replace by the latter. + +The main HTML file should require an application module. Application +module is a module that should have dependencies required for the +application to run. By specifying these dependencies we may control +which modules/plugins and their dependencies get loaded. Currently it’s +`freeipa/app`. + +### Alternation phase + +Serves for altering components specifications. This phase should be used +only by plugins and configurable modules. Core modules shouldn’t use +this phase. + +### Registration phase + +Modules should register widget, facet, entity final construct +specifications. + +### Init phase + +Serves for initialization of core UI components: application controller, +router, menu, application widget … + +### Metadata phase + +Metadata, configuration and user specific information should be loaded +in this phase. + +### Runtime phase + +Phase where plugins can expect that application is completely +initialized. Most of user interaction will happen here. + +### Shutdown phase + +Destroys session. Currently redirects to other page. In future may +destroy all facets and entities and just show basic UI again. + +## Adding a new phase + +One can add a new phase at any time. It will be executed only if it’s +position is after currently running phase. + + + define(['./phases'], function(phases) { + + // add 'new-phase' on the last position + phases.add('new-phase'); + + // add 'pre-runtime' phase before 'runtime' phase + phases.add('pre-runtime', { before: 'runtime' }); + + // add 'post-runtime' phase after 'runtime' phase + phases.add('post-runtime', { after: 'runtime' }); + + // add '7th-phase' phase on exact position (whatever it is) + // or on the last, if position is bigger than number of currently + // registered phases + phases.add('7th-phase', { position: 7 }); + }); diff --git a/install/ui/doc/guides/phases/icon.png b/install/ui/doc/guides/phases/icon.png Binary files differnew file mode 100644 index 000000000..d9d9e0d02 --- /dev/null +++ b/install/ui/doc/guides/phases/icon.png |