From 8a0f60cf4607f50af67833f31d6a21cd021581db Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Tue, 19 Mar 2013 15:55:04 +0100 Subject: Add handling of runtime and shutdown phase. App-init renamed to init. https://fedorahosted.org/freeipa/ticket/3236 --- install/ui/src/freeipa/Application_controller.js | 17 ++++++++++++++--- install/ui/src/freeipa/app.js | 10 +++++++++- install/ui/src/freeipa/phases.js | 5 +++-- 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js index 03b987a1f..d9f3129c8 100644 --- a/install/ui/src/freeipa/Application_controller.js +++ b/install/ui/src/freeipa/Application_controller.js @@ -27,6 +27,7 @@ define(['dojo/_base/declare', 'dojo/_base/lang', 'dojo/_base/array', + 'dojo/Deferred', 'dojo/on', 'dojo/topic', 'dojo/query', @@ -37,7 +38,7 @@ define(['dojo/_base/declare', './navigation/Router', './navigation/menu_spec' ], - function(declare, lang, array, on, topic, query, dom_class, + function(declare, lang, array, Deferred, on, topic, query, dom_class, App_widget, IPA, Menu, Router, menu_spec) { /** @@ -113,6 +114,10 @@ define(['dojo/_base/declare', this.app_widget.menu_widget.ignore_changes = false; this.app_widget.menu_widget.render(); this.app_widget.menu_widget.select(this.menu.selected); + }, + + start_runtime: function() { + this.run_time = new Deferred(); // now we are ready for displaying a facet // cat match a facet if hash is set @@ -120,12 +125,18 @@ define(['dojo/_base/declare', // choose default facet if not defined by route if (!this.current_facet) { - if (selfservice) { + if (IPA.is_selfservice) { this.on_profile(); } else { this.router.navigate_to_entity_facet('user', 'search'); } } + + return this.run_time.promise; + }, + + start_logout: function() { + IPA.logout(); }, is_selfservice: function() { @@ -162,7 +173,7 @@ define(['dojo/_base/declare', }, on_logout: function(event) { - IPA.logout(); + this.run_time.resolve(); }, on_phase_error: function(error) { diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js index 361d2371e..72a41497b 100644 --- a/install/ui/src/freeipa/app.js +++ b/install/ui/src/freeipa/app.js @@ -71,7 +71,7 @@ define([ */ register_phases: function() { - phases.on('app-init', lang.hitch(this, function() { + phases.on('init', lang.hitch(this, function() { var app = this.app = new this.App_class(); app.init(); return app; @@ -92,6 +92,14 @@ define([ phases.on('profile', lang.hitch(this, function() { this.app.choose_profile(); })); + + phases.on('runtime', lang.hitch(this, function() { + return this.app.start_runtime(); + })); + + phases.on('shutdown', lang.hitch(this, function() { + return this.app.start_logout(); + })); }, run: function() { diff --git a/install/ui/src/freeipa/phases.js b/install/ui/src/freeipa/phases.js index 295a407ac..bc1b3126a 100644 --- a/install/ui/src/freeipa/phases.js +++ b/install/ui/src/freeipa/phases.js @@ -36,10 +36,11 @@ define([ //'resource-load', // implicit phase 'registration', 'alternation', - 'app-init', + 'init', 'metadata', 'profile', - 'logout' + 'runtime', + 'shutdown' ] }; -- cgit