diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-10-10 10:21:30 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-10-20 12:25:22 +0200 |
commit | 896d47c92f9e7f8322456b68b767bf78f0897b0a (patch) | |
tree | acde3ce3439af5054524f880cea7221644dddc98 | |
parent | 741c31c2b428cf979db6a9d7cd91f88e5f247fb4 (diff) | |
download | freeipa-896d47c92f9e7f8322456b68b767bf78f0897b0a.tar.gz freeipa-896d47c92f9e7f8322456b68b767bf78f0897b0a.tar.xz freeipa-896d47c92f9e7f8322456b68b767bf78f0897b0a.zip |
webui: make Evented a part of base IPA.object
1. All framework objects to use event interface
2. Framework objects can be part of specification objects but they are not deep-cloned as the rest of specification objects - usually it would cause infinite loop. This make easier to add context as a $pre-op object without a need for $pre-op function.
Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
-rw-r--r-- | install/ui/src/freeipa/_base/Builder.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/_base/construct.js | 8 | ||||
-rw-r--r-- | install/ui/src/freeipa/dialog.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/facet.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/field.js | 2 | ||||
-rw-r--r-- | install/ui/src/freeipa/ipa.js | 15 | ||||
-rw-r--r-- | install/ui/src/freeipa/widget.js | 6 |
7 files changed, 15 insertions, 22 deletions
diff --git a/install/ui/src/freeipa/_base/Builder.js b/install/ui/src/freeipa/_base/Builder.js index 890a98a49..9433a8126 100644 --- a/install/ui/src/freeipa/_base/Builder.js +++ b/install/ui/src/freeipa/_base/Builder.js @@ -363,7 +363,7 @@ define(['dojo/_base/declare', if (preop_t === 'function') { spec = preop(spec, context); } else if (preop_t === 'object') { - var temp = lang.clone(preop); + var temp = construct.clone(preop); this.spec_mod.mod(spec, temp); this.spec_mod.del_rules(temp); lang.mixin(spec, temp); diff --git a/install/ui/src/freeipa/_base/construct.js b/install/ui/src/freeipa/_base/construct.js index 6db2134b8..1c415249e 100644 --- a/install/ui/src/freeipa/_base/construct.js +++ b/install/ui/src/freeipa/_base/construct.js @@ -43,18 +43,14 @@ define(['dojo/_base/declare', /** * Finds out if object is a spec object. * - * Object is not a spec object when any of following applies: + * Object is not a spec object when it has an `isInstanceOf` function. * - * - has `__fw_obj === true` - * - has `isInstanceOf` function - basically tells if it's a instance of - * dojo-based class * @param {Object} obj */ is_spec: function(obj) { var ret = false; if (typeof obj === 'object') { - ret = obj.__fw_obj === true || - typeof obj.isInstanceOf === 'function'; + ret = typeof obj.isInstanceOf === 'function'; } return !ret; }, diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index def29cfca..c277518ac 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -221,7 +221,7 @@ IPA.dialog = function(spec) { spec = spec || {}; - var that = new Evented(); + var that = IPA.object(); /** @property {entity.entity} entity Entity */ that.entity = IPA.get_entity(spec.entity); diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index c06df00a8..556b17fe7 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -124,7 +124,7 @@ exp.facet = IPA.facet = function(spec, no_init) { spec = spec || {}; - var that = new Evented(); + var that = IPA.object(); /** * Name of preferred facet container diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index f53c6c1d0..c2609c564 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -60,7 +60,7 @@ var field = {}; field.field = IPA.field = function(spec) { spec = spec || {}; - var that = new Evented(); + var that = IPA.object(); /** * Entity diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js index b414e4825..6d3aeaaaa 100644 --- a/install/ui/src/freeipa/ipa.js +++ b/install/ui/src/freeipa/ipa.js @@ -23,7 +23,9 @@ */ define([ + 'dojo/_base/declare', 'dojo/Deferred', + 'dojo/Evented', 'dojo/keys', 'dojo/topic', './jquery', @@ -38,8 +40,8 @@ define([ './text', './util', 'exports' - ], function(Deferred, keys, topic, $, JSON, i18n, auth, datetime, - metadata_provider, builder, reg, rpc, text, util, exports) { + ], function(declare, Deferred, Evented, keys, topic, $, JSON, i18n, auth, + datetime, metadata_provider, builder, reg, rpc, text, util, exports) { /** * @class @@ -337,19 +339,14 @@ var IPA = function () { } }; - that.obj_cls = function() {}; - that.obj_cls.prototype.__fw_obj = true; + that.obj_cls = declare([Evented]); return that; }(); /** * Framework objects created by factories should use this - * instead of empty object when creating base objects. As an alternative - * they can just set __fw_obj property. - * - * __fw_obj property serves for telling the framework that it's instantiated - * object and not an object specification (spec). + * instead of empty object when creating base objects. * * @class */ diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index b9ab82cbc..39ee19b8d 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -83,7 +83,7 @@ IPA.widget = function(spec) { spec = spec || {}; - var that = new Evented(); + var that = IPA.object(); /** * Normalize tooltip @@ -1419,7 +1419,7 @@ IPA.option_widget_base = function(spec, that) { spec = spec || {}; // when that is specified, this constructor behaves like a mixin - that = that || new Evented(); + that = that || IPA.object(); // classic properties that.name = spec.name; @@ -5230,7 +5230,7 @@ IPA.widget_container = function(spec) { spec = spec || {}; - var that = new Evented(); + var that = IPA.object(); that.new_container_for_child = spec.new_container_for_child !== undefined ? spec.new_container_for_child : true; |