From 46a42de5324390496fa70984c2d8cef7a6251b7a Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 5 Jun 2014 17:12:41 +0200 Subject: webui: layer for standalone pages which use WebUI framework Current compiled Web UI layer (app.js) contains every FreeIPA plugin and not just the UI framework. It's not possible to start just a simple facet. This commit creates a basis for a layer (core.js) which contains only framework code and not entity related code. Reviewed-By: Endi Sukma Dewata --- install/ui/src/freeipa/app_container.js | 31 ++++++++++++++++++++++++++++++- install/ui/src/freeipa/core.js | 27 +++++++++++++++++++++++++++ install/ui/src/freeipa/widget.js | 7 ++++--- 3 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 install/ui/src/freeipa/core.js (limited to 'install/ui/src/freeipa') diff --git a/install/ui/src/freeipa/app_container.js b/install/ui/src/freeipa/app_container.js index ec2d71e44..7f5aacca0 100644 --- a/install/ui/src/freeipa/app_container.js +++ b/install/ui/src/freeipa/app_container.js @@ -24,9 +24,10 @@ define([ 'dojo/when', './plugin_loader', './phases', + './reg', './Application_controller', 'exports' -],function(lang, Deferred, when, plugin_loader, phases, Application_controller, app) { +],function(lang, Deferred, when, plugin_loader, phases, reg, Application_controller, app) { /** * Application wrapper @@ -84,11 +85,39 @@ define([ })); }, + simple_mode_phases: function() { + + phases.on('init', lang.hitch(this, function() { + var app = this.app = new this.App_class(); + app.init(); + return app; + })); + + phases.on('runtime', lang.hitch(this, function() { + var d = new Deferred(); + var facet = reg.facet.get(this.target_facet); + if (!facet) { + window.console.error('Target facet not found: '+this.target_facet); + } else { + this.app.show_facet(facet); + } + return d.promise; + })); + }, + run: function() { when(plugin_loader.load_plugins(), lang.hitch(this, function() { this.register_phases(); phases.controller.run(); })); + }, + + run_simple: function(facet) { + this.target_facet = facet; + when(plugin_loader.load_plugins(), lang.hitch(this, function() { + this.simple_mode_phases(); + phases.controller.run(); + })); } }); diff --git a/install/ui/src/freeipa/core.js b/install/ui/src/freeipa/core.js new file mode 100644 index 000000000..d906ec916 --- /dev/null +++ b/install/ui/src/freeipa/core.js @@ -0,0 +1,27 @@ +/* Authors: + * Petr Vobornik + * + * Copyright (C) 2012 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +define([ + './app_container', + './plugins/sync_otp', + './plugins/login' +],function(app_container) { + return app_container; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 3aba7da52..2321edabf 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -32,6 +32,7 @@ define(['dojo/_base/array', 'dojo/topic', './builder', './datetime', + './entity', './ipa', './jquery', './navigation', @@ -39,10 +40,11 @@ define(['dojo/_base/array', './reg', './rpc', './text', - './util' + './util', + 'exports' ], function(array, lang, Evented, has, keys, on, string, topic, builder, - datetime, IPA, $, navigation, phases, reg, rpc, text, util) { + datetime, entity_mod, IPA, $, navigation, phases, reg, rpc, text, util, exp) { /** * Widget module @@ -54,7 +56,6 @@ define(['dojo/_base/array', * @class widget * @singleton */ -var exp = {}; /** * Width of column which contains only checkbox -- cgit