mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
741c31c2b4
commit
896d47c92f
@ -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);
|
||||
|
@ -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;
|
||||
},
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -60,7 +60,7 @@ var field = {};
|
||||
field.field = IPA.field = function(spec) {
|
||||
spec = spec || {};
|
||||
|
||||
var that = new Evented();
|
||||
var that = IPA.object();
|
||||
|
||||
/**
|
||||
* Entity
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user