summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
Diffstat (limited to 'install')
-rw-r--r--install/ui/src/freeipa/aci.js34
-rw-r--r--install/ui/src/freeipa/association.js24
-rw-r--r--install/ui/src/freeipa/automember.js26
-rwxr-xr-xinstall/ui/src/freeipa/certificate.js28
-rw-r--r--install/ui/src/freeipa/dns.js43
-rw-r--r--install/ui/src/freeipa/field.js61
-rw-r--r--install/ui/src/freeipa/host.js45
-rw-r--r--install/ui/src/freeipa/ipa.js2
-rw-r--r--install/ui/src/freeipa/rule.js23
-rw-r--r--install/ui/src/freeipa/service.js37
-rw-r--r--install/ui/src/freeipa/user.js18
-rw-r--r--install/ui/src/freeipa/widget.js78
-rw-r--r--install/ui/test/aci_tests.js15
-rw-r--r--install/ui/test/details_tests.js17
14 files changed, 306 insertions, 145 deletions
diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js
index 2b613b1bd..c43e615fe 100644
--- a/install/ui/src/freeipa/aci.js
+++ b/install/ui/src/freeipa/aci.js
@@ -19,8 +19,17 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-define(['./ipa', './jquery', './text', './details', './search', './association',
- './entity'], function(IPA, $, text) {
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './details',
+ './search',
+ './association',
+ './entity'],
+ function(IPA, $, phases, reg, text) {
IPA.aci = {};
@@ -603,9 +612,6 @@ IPA.attributes_widget = function(spec) {
return that;
};
-IPA.widget_factories['attributes'] = IPA.attributes_widget;
-IPA.field_factories['attributes'] = IPA.checkboxes_field;
-
IPA.rights_widget = function(spec) {
var that = IPA.checkboxes_widget(spec);
@@ -619,9 +625,6 @@ IPA.rights_widget = function(spec) {
return that;
};
-IPA.widget_factories['rights'] = IPA.rights_widget;
-IPA.field_factories['rights'] = IPA.checkboxes_field;
-
IPA.permission_target_widget = function(spec) {
spec = spec || {};
@@ -893,8 +896,6 @@ IPA.permission_target_policy = function (widget_name) {
return that;
};
-IPA.widget_factories['permission_target'] = IPA.permission_target_widget;
-
IPA.register('permission', IPA.aci.permission_entity);
IPA.register('privilege', IPA.aci.privilege_entity);
@@ -902,5 +903,18 @@ IPA.register('role', IPA.aci.role_entity);
IPA.register('selfservice', IPA.aci.selfservice_entity);
IPA.register('delegation', IPA.aci.delegation_entity);
+IPA.aci.register = function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('attributes', IPA.attributes_widget);
+ f.register('attributes', IPA.checkboxes_field);
+ w.register('rights', IPA.rights_widget);
+ f.register('rights', IPA.checkboxes_field);
+ w.register('permission_target', IPA.permission_target_widget);
+};
+
+phases.on('registration', IPA.aci.register);
+
return IPA.aci;
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js
index e378ad443..f23568c48 100644
--- a/install/ui/src/freeipa/association.js
+++ b/install/ui/src/freeipa/association.js
@@ -22,8 +22,16 @@
/* CURRENTLY ALSO REQUIRES search.js, because it reuses it's code to create
* the AssociationList elements; IT NEEDS IT'S OWN CODE! */
-define(['./ipa', './jquery', './navigation', './text', './search', './dialog'],
- function(IPA, $, navigation, text) {
+define([
+ './ipa',
+ './jquery',
+ './navigation',
+ './phases',
+ './reg',
+ './text',
+ './search',
+ './dialog'],
+ function(IPA, $, navigation, phases, reg, text) {
IPA.associator = function (spec) {
@@ -740,10 +748,6 @@ IPA.association_table_field = function (spec) {
return that;
};
-IPA.widget_factories['association_table'] = IPA.association_table_widget;
-IPA.field_factories['association_table'] = IPA.association_table_field;
-
-
IPA.association_facet = function (spec, no_init) {
spec = spec || {};
@@ -1381,5 +1385,13 @@ IPA.attr_read_only_evaluator = function(spec) {
return that;
};
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('association_table', IPA.association_table_widget);
+ f.register('association_table', IPA.association_table_field);
+});
+
return {};
});
diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js
index a2ac8365c..26ef533e4 100644
--- a/install/ui/src/freeipa/automember.js
+++ b/install/ui/src/freeipa/automember.js
@@ -18,8 +18,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './navigation', './text', './details', './search',
- './association', './entity'], function(IPA, $, navigation, text) {
+define([
+ './ipa',
+ './jquery',
+ './navigation',
+ './phases',
+ './reg',
+ './text',
+ './details',
+ './search',
+ './association',
+ './entity'],
+ function(IPA, $, navigation, phases, reg, text) {
IPA.automember = {};
@@ -452,8 +462,6 @@ IPA.automember.condition_field = function(spec) {
return that;
};
-IPA.field_factories['automember_condition'] = IPA.automember.condition_field;
-
IPA.automember.condition_widget = function(spec) {
spec = spec || {};
@@ -535,8 +543,6 @@ IPA.automember.condition_widget = function(spec) {
return that;
};
-IPA.widget_factories['automember_condition'] = IPA.automember.condition_widget;
-
IPA.automember.default_group_widget = function(spec) {
spec = spec || {};
@@ -693,5 +699,13 @@ IPA.automember.default_group_widget = function(spec) {
IPA.register('automember', IPA.automember.entity);
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('automember_condition', IPA.automember.condition_widget);
+ f.register('automember_condition', IPA.automember.condition_field);
+});
+
return {};
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index db262159b..a46fd46e9 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -19,8 +19,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery','dojo/_base/lang', './text', './dialog'],
- function(IPA, $, lang, text) {
+define([
+ 'dojo/_base/lang',
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './dialog'],
+ function(lang, IPA, $, phases, reg, text) {
IPA.cert = {};
@@ -934,8 +941,7 @@ IPA.cert.status_field = function(spec) {
return that;
};
-IPA.widget_factories['certificate_status'] = IPA.cert.status_widget;
-IPA.field_factories['certificate_status'] = IPA.cert.status_field;
+
IPA.cert.entity = function(spec) {
@@ -1299,10 +1305,20 @@ IPA.cert.cert_update_policy = function(spec) {
return IPA.facet_update_policy(spec);
};
-IPA.field_factories['revocation_reason'] = IPA.revocation_reason_field;
-IPA.widget_factories['revocation_reason'] = IPA.text_widget;
+
IPA.register('cert', IPA.cert.entity);
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('certificate_status', IPA.cert.status_widget);
+ f.register('certificate_status', IPA.cert.status_field);
+
+ f.register('revocation_reason', IPA.revocation_reason_field);
+ w.register('revocation_reason', IPA.text_widget);
+});
+
return {};
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js
index 47902b1b4..6ecba1dbf 100644
--- a/install/ui/src/freeipa/dns.js
+++ b/install/ui/src/freeipa/dns.js
@@ -27,12 +27,13 @@ define([
'./navigation',
'./menu',
'./phases',
+ './reg',
'./text',
'./details',
'./search',
'./association',
'./entity'],
- function(IPA, $, NET, navigation, menu, phases, text) {
+ function(IPA, $, NET, navigation, menu, phases, reg, text) {
IPA.dns = {
zone_permission_name: 'Manage DNS zone ${dnszone}'
@@ -574,7 +575,6 @@ IPA.dnszone_name_widget = function(spec) {
return that;
};
-IPA.widget_factories['dnszone_name'] = IPA.dnszone_name_widget;
IPA.force_dnszone_add_checkbox_widget = function(spec) {
var metadata = IPA.get_command_option('dnszone_add', spec.name);
@@ -583,9 +583,6 @@ IPA.force_dnszone_add_checkbox_widget = function(spec) {
return IPA.checkbox_widget(spec);
};
-IPA.widget_factories['force_dnszone_add_checkbox'] = IPA.force_dnszone_add_checkbox_widget;
-IPA.field_factories['force_dnszone_add_checkbox'] = IPA.checkbox_field;
-
IPA.dnszone_adder_dialog = function(spec) {
spec = spec || {};
@@ -1469,9 +1466,6 @@ IPA.dnsrecord_host_link_field = function(spec) {
return that;
};
-IPA.field_factories['dnsrecord_host_link'] = IPA.dnsrecord_host_link_field;
-IPA.widget_factories['dnsrecord_host_link'] = IPA.link_widget;
-
IPA.dns_record_types = function() {
//only supported
@@ -1542,9 +1536,6 @@ IPA.dnsrecord_type_field = function(spec) {
return that;
};
-IPA.field_factories['dnsrecord_type'] = IPA.dnsrecord_type_field;
-
-
IPA.dnsrecord_type_widget = function(spec) {
spec.options = IPA.dns_record_types();
@@ -1552,9 +1543,6 @@ IPA.dnsrecord_type_widget = function(spec) {
return that;
};
-IPA.widget_factories['dnsrecord_type'] = IPA.dnsrecord_type_widget;
-
-
IPA.dnsrecord_adder_dialog_type_policy = function(spec) {
spec = spec || {};
@@ -1654,9 +1642,6 @@ IPA.dns.record_type_table_field = function(spec) {
return that;
};
-IPA.field_factories['dnsrecord_type_table'] = IPA.dns.record_type_table_field;
-
-
IPA.dns.record_type_table_widget = function(spec) {
spec = spec || {};
@@ -2076,8 +2061,6 @@ IPA.dns.record_type_table_widget = function(spec) {
return that;
};
-IPA.widget_factories['dnsrecord_type_table'] = IPA.dns.record_type_table_widget;
-
IPA.dns.netaddr_field = function(spec) {
spec = spec || {};
@@ -2145,11 +2128,6 @@ IPA.dns.netaddr_field = function(spec) {
return that;
};
-IPA.field_factories['netaddr'] = IPA.dns.netaddr_field;
-IPA.widget_factories['netaddr'] = IPA.multivalued_widget;
-
-
-
IPA.dns.record_modify_column = function(spec) {
spec = spec || {};
@@ -2552,5 +2530,22 @@ IPA.register('dnsconfig', IPA.dns.config_entity);
IPA.register('dnszone', IPA.dns.zone_entity);
IPA.register('dnsrecord', IPA.dns.record_entity);
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('dnszone_name', IPA.dnszone_name_widget);
+ w.register('force_dnszone_add_checkbox', IPA.force_dnszone_add_checkbox_widget);
+ f.register('force_dnszone_add_checkbox', IPA.checkbox_field);
+ w.register('dnsrecord_host_link', IPA.link_widget);
+ f.register('dnsrecord_host_link', IPA.dnsrecord_host_link_field);
+ w.register('dnsrecord_type', IPA.dnsrecord_type_widget);
+ f.register('dnsrecord_type', IPA.dnsrecord_type_field);
+ w.register('dnsrecord_type_table', IPA.dns.record_type_table_widget);
+ f.register('dnsrecord_type_table', IPA.dns.record_type_table_field);
+ w.register('netaddr', IPA.multivalued_widget);
+ f.register('netaddr', IPA.dns.netaddr_field);
+});
+
return {};
});
diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js
index fe14204c0..fb315765f 100644
--- a/install/ui/src/freeipa/field.js
+++ b/install/ui/src/freeipa/field.js
@@ -22,8 +22,18 @@
*/
-define(['dojo/_base/array', './ipa', './jquery', './navigation', './text'],
- function(array, IPA, $, navigation, text) {
+define([
+ 'dojo/_base/array',
+ './builder',
+ './ipa',
+ './jquery',
+ './navigation',
+ './phases',
+ './reg',
+ './text'],
+ function(array, builder, IPA, $, navigation, phases, reg, text) {
+
+var exp = {};
IPA.field = function(spec) {
spec = spec || {};
@@ -878,7 +888,8 @@ IPA.field_builder = function(spec) {
if (spec.$factory) {
factory = spec.$factory;
} else if(spec.type) {
- factory = IPA.field_factories[spec.type];
+ factory = reg.field.get(spec.type);
+ factory = factory ? factory.factory : undefined;
}
if (!factory) {
@@ -923,21 +934,31 @@ IPA.field_builder = function(spec) {
return that;
};
-IPA.field_factories['checkbox'] = IPA.checkbox_field;
-IPA.field_factories['checkboxes'] = IPA.checkboxes_field;
-IPA.field_factories['combobox'] = IPA.field;
-IPA.field_factories['enable'] = IPA.enable_field;
-IPA.field_factories['entity_select'] = IPA.field;
-IPA.field_factories['field'] = IPA.field;
-IPA.field_factories['link'] = IPA.link_field;
-IPA.field_factories['multivalued'] = IPA.multivalued_field;
-IPA.field_factories['password'] = IPA.field;
-IPA.field_factories['radio'] = IPA.radio_field;
-IPA.field_factories['select'] = IPA.select_field;
-IPA.field_factories['sshkeys'] = IPA.sshkeys_field;
-IPA.field_factories['textarea'] = IPA.field;
-IPA.field_factories['text'] = IPA.field;
-IPA.field_factories['value_map'] = IPA.field;
-
-return {};
+// New builder and registry
+exp.builder = builder.get('field');
+exp.builder.factory = IPA.field;
+reg.set('field', exp.builder.registry);
+
+exp.register = function() {
+ var f = reg.field;
+
+ f.register('checkbox', IPA.checkbox_field);
+ f.register('checkboxes', IPA.checkboxes_field);
+ f.register('combobox', IPA.field);
+ f.register('enable', IPA.enable_field);
+ f.register('entity_select', IPA.field);
+ f.register('field', IPA.field);
+ f.register('link', IPA.link_field);
+ f.register('multivalued', IPA.multivalued_field);
+ f.register('password', IPA.field);
+ f.register('radio', IPA.radio_field);
+ f.register('select', IPA.select_field);
+ f.register('sshkeys', IPA.sshkeys_field);
+ f.register('textarea', IPA.field);
+ f.register('text', IPA.field);
+ f.register('value_map', IPA.field);
+};
+phases.on('registration', exp.register);
+
+return exp;
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index c3fee99ac..fa7ca2c55 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -19,8 +19,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './text', './details', './search', './association',
- './entity', './certificate'], function(IPA, $, text) {
+define(['./ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './details',
+ './search',
+ './association',
+ './entity',
+ './certificate'],
+ function(IPA, $, phases, reg, text) {
IPA.host = {};
@@ -415,9 +424,6 @@ IPA.host_fqdn_field = function(spec) {
return that;
};
-IPA.field_factories['host_fqdn'] = IPA.host_fqdn_field;
-IPA.widget_factories['host_fqdn'] = IPA.host_fqdn_widget;
-
IPA.host_adder_dialog = function(spec) {
spec = spec || {};
@@ -507,9 +513,6 @@ IPA.dnszone_select_widget = function(spec) {
return that;
};
-IPA.field_factories['dnszone_select'] = IPA.field;
-IPA.widget_factories['dnszone_select'] = IPA.dnszone_select_widget;
-
IPA.host_dnsrecord_entity_link_field = function(spec){
var that = IPA.link_field(spec);
@@ -525,9 +528,6 @@ IPA.host_dnsrecord_entity_link_field = function(spec){
return that;
};
-IPA.field_factories['host_dnsrecord_entity_link'] = IPA.host_dnsrecord_entity_link_field;
-IPA.widget_factories['host_dnsrecord_entity_link'] = IPA.link_widget;
-
IPA.force_host_add_checkbox_widget = function(spec) {
var metadata = IPA.get_command_option('host_add', spec.name);
spec.label = metadata.label;
@@ -535,9 +535,6 @@ IPA.force_host_add_checkbox_widget = function(spec) {
return IPA.checkbox_widget(spec);
};
-IPA.widget_factories['force_host_add_checkbox'] = IPA.force_host_add_checkbox_widget;
-IPA.field_factories['force_host_add_checkbox'] = IPA.checkbox_field;
-
IPA.host.enrollment_policy = function(spec) {
var that = IPA.facet_policy();
@@ -788,9 +785,6 @@ IPA.host_password_widget = function(spec) {
return that;
};
-IPA.widget_factories['host_password'] = IPA.host_password_widget;
-IPA.field_factories['host_password'] = IPA.field;
-
IPA.host.set_otp_dialog = function(spec) {
spec = spec || {};
@@ -967,5 +961,22 @@ IPA.host.certificate_policy = function(spec) {
IPA.register('host', IPA.host.entity);
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ f.register('host_fqdn', IPA.host_fqdn_field);
+ w.register('host_fqdn', IPA.host_fqdn_widget);
+ f.register('dnszone_select', IPA.field);
+ w.register('dnszone_select', IPA.dnszone_select_widget);
+ f.register('host_dnsrecord_entity_link', IPA.host_dnsrecord_entity_link_field);
+ w.register('host_dnsrecord_entity_link', IPA.link_widget);
+ f.register('force_host_add_checkbox', IPA.checkbox_field);
+ w.register('force_host_add_checkbox', IPA.force_host_add_checkbox_widget);
+ f.register('host_password', IPA.field);
+ w.register('host_password', IPA.host_password_widget);
+});
+
+
return {};
});
diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index 06172bb0b..7598aee82 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -55,8 +55,6 @@ var IPA = function() {
that.entities = $.ordered_map();
that.entity_factories = {};
- that.field_factories = {};
- that.widget_factories = {};
that.network_call_count = 0;
diff --git a/install/ui/src/freeipa/rule.js b/install/ui/src/freeipa/rule.js
index faa305a4b..194b443d6 100644
--- a/install/ui/src/freeipa/rule.js
+++ b/install/ui/src/freeipa/rule.js
@@ -18,8 +18,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './details', './search', './association',
- './entity'], function(IPA, $) {
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './details',
+ './search',
+ './association',
+ './entity'],
+ function(IPA, $, phases, reg) {
IPA.rule_details_widget = function(spec) {
@@ -223,9 +231,6 @@ IPA.rule_association_table_field = function(spec) {
return that;
};
-IPA.widget_factories['rule_association_table'] = IPA.rule_association_table_widget;
-IPA.field_factories['rule_association_table'] = IPA.rule_association_table_field;
-
IPA.rule_association_adder_dialog = function(spec) {
spec = spec || {};
@@ -253,5 +258,13 @@ IPA.rule_association_adder_dialog = function(spec) {
return that;
};
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ w.register('rule_association_table', IPA.rule_association_table_widget);
+ f.register('rule_association_table', IPA.rule_association_table_field);
+});
+
return {};
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js
index 4b4b1d0cc..69165c91f 100644
--- a/install/ui/src/freeipa/service.js
+++ b/install/ui/src/freeipa/service.js
@@ -18,8 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './text', './details', './search', './association',
- './entity'], function(IPA, $, text) {
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './details',
+ './search',
+ './association',
+ './entity'],
+ function(IPA, $, phases, reg, text) {
IPA.service = {};
@@ -284,10 +293,6 @@ IPA.service_name_field = function(spec) {
return that;
};
-IPA.field_factories['service_name'] = IPA.service_name_field;
-IPA.widget_factories['service_name'] = IPA.text_widget;
-
-
IPA.service_host_field = function(spec) {
spec = spec || {};
@@ -308,9 +313,6 @@ IPA.service_host_field = function(spec) {
return that;
};
-IPA.field_factories['service_host'] = IPA.service_host_field;
-IPA.widget_factories['service_host'] = IPA.text_widget;
-
IPA.service_provisioning_status_widget = function (spec) {
spec = spec || {};
@@ -374,10 +376,6 @@ IPA.service_provisioning_status_widget = function (spec) {
return that;
};
-IPA.field_factories['service_provisioning_status'] = IPA.field;
-IPA.widget_factories['service_provisioning_status'] = IPA.service_provisioning_status_widget;
-
-
IPA.service.unprovision_dialog = function(spec) {
spec = spec || {};
@@ -511,5 +509,18 @@ IPA.service.certificate_policy = function(spec) {
IPA.register('service', IPA.service.entity);
+phases.on('registration', function() {
+ var w = reg.widget;
+ var f = reg.field;
+
+ f.register('service_name', IPA.service_name_field);
+ w.register('service_name', IPA.text_widget);
+ f.register('service_host', IPA.service_host_field);
+ w.register('service_host', IPA.text_widget);
+ f.register('service_provisioning_status', IPA.field);
+ w.register('service_provisioning_status', IPA.service_provisioning_status_widget);
+});
+
+
return {};
});
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index f2de1ce42..2a326bb99 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -24,7 +24,7 @@
define(['./ipa', './jquery', './text', './details', './search', './association',
'./entity', './certificate'], function(IPA, $, text) {
-IPA.user = {};
+var exp = IPA.user = {};
IPA.user.entity = function(spec) {
@@ -403,6 +403,20 @@ IPA.user.details_facet = function(spec) {
return that;
};
+/**
+ * Makes user association facets read-only in self service
+ */
+IPA.user.association_facet_ss_post_op = function(spec, context) {
+
+ var self_service = IPA.is_selfservice;
+
+ spec.read_only = self_service;
+ spec.link = self_service ? false : undefined;
+
+ return spec;
+};
+
+
IPA.user_adder_dialog = function(spec) {
var that = IPA.entity_adder_dialog(spec);
@@ -652,5 +666,5 @@ IPA.user.reset_password_acl_evaluator = function(spec) {
IPA.register('user', IPA.user.entity);
-return {};
+return exp;
});
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 6e934fa2b..c8d0388a2 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -22,9 +22,17 @@
*/
-define(['dojo/_base/array', './ipa', './jquery', './text'],
- function(array, IPA, $, text) {
-
+define(['dojo/_base/array',
+ './builder',
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text'
+ ],
+ function(array, builder, IPA, $, phases, reg, text) {
+
+var exp = {};
IPA.checkbox_column_width = 22;
IPA.required_indicator = '*';
@@ -731,7 +739,7 @@ IPA.option_widget_base = function(spec, that) {
};
} else {
if (option.type || option.$factory) {
- var factory = option.$factory || IPA.widget_factories[option.type];
+ var factory = option.$factory || reg.widget.get(option.type);
if (typeof factory !== 'function') throw {
error: 'Invalid factory',
$factory: factory
@@ -3535,7 +3543,8 @@ IPA.widget_builder = function(spec) {
if (spec.$factory) {
factory = spec.$factory;
} else if(spec.type) {
- factory = IPA.widget_factories[spec.type];
+ factory = reg.widget.get(spec.type);
+ factory = factory ? factory.factory : undefined;
}
if (!factory) {
@@ -3955,28 +3964,39 @@ IPA.value_map_widget = function(spec) {
return that;
};
-IPA.widget_factories['attribute_table'] = IPA.attribute_table_widget;
-IPA.widget_factories['button'] = IPA.button_widget;
-IPA.widget_factories['checkbox'] = IPA.checkbox_widget;
-IPA.widget_factories['checkboxes'] = IPA.checkboxes_widget;
-IPA.widget_factories['combobox'] = IPA.combobox_widget;
-IPA.widget_factories['composite_widget'] = IPA.composite_widget;
-IPA.widget_factories['details_table_section'] = IPA.details_table_section;
-IPA.widget_factories['details_table_section_nc'] = IPA.details_table_section_nc;
-IPA.widget_factories['multiple_choice_section'] = IPA.multiple_choice_section;
-IPA.widget_factories['enable'] = IPA.enable_widget;
-IPA.widget_factories['entity_select'] = IPA.entity_select_widget;
-IPA.widget_factories['header'] = IPA.header_widget;
-IPA.widget_factories['html'] = IPA.html_widget;
-IPA.widget_factories['link'] = IPA.link_widget;
-IPA.widget_factories['multivalued'] = IPA.multivalued_widget;
-IPA.widget_factories['password'] = IPA.password_widget;
-IPA.widget_factories['radio'] = IPA.radio_widget;
-IPA.widget_factories['select'] = IPA.select_widget;
-IPA.widget_factories['sshkeys'] = IPA.sshkeys_widget;
-IPA.widget_factories['textarea'] = IPA.textarea_widget;
-IPA.widget_factories['text'] = IPA.text_widget;
-IPA.widget_factories['value_map'] = IPA.value_map_widget;
-
-return {};
+// New builder and registry
+exp.builder = builder.get('widget');
+exp.builder.factory = IPA.widget;
+reg.set('widget', exp.builder.registry);
+
+exp.register = function() {
+ var w = reg.widget;
+
+ w.register('attribute_table', IPA.attribute_table_widget);
+ w.register('button', IPA.button_widget);
+ w.register('checkbox', IPA.checkbox_widget);
+ w.register('checkboxes', IPA.checkboxes_widget);
+ w.register('combobox', IPA.combobox_widget);
+ w.register('composite_widget', IPA.composite_widget);
+ w.register('details_table_section', IPA.details_table_section);
+ w.register('details_table_section_nc', IPA.details_table_section_nc);
+ w.register('multiple_choice_section', IPA.multiple_choice_section);
+ w.register('enable', IPA.enable_widget);
+ w.register('entity_select', IPA.entity_select_widget);
+ w.register('header', IPA.header_widget);
+ w.register('html', IPA.html_widget);
+ w.register('link', IPA.link_widget);
+ w.register('multivalued', IPA.multivalued_widget);
+ w.register('password', IPA.password_widget);
+ w.register('radio', IPA.radio_widget);
+ w.register('select', IPA.select_widget);
+ w.register('sshkeys', IPA.sshkeys_widget);
+ w.register('textarea', IPA.textarea_widget);
+ w.register('text', IPA.text_widget);
+ w.register('value_map', IPA.value_map_widget);
+};
+
+phases.on('registration', exp.register);
+
+return exp;
});
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index 2b8285794..3ced0bd47 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -18,7 +18,15 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-define(['freeipa/ipa', 'freeipa/jquery', 'freeipa/aci'], function(IPA, $) {
+define([
+ 'freeipa/aci',
+ 'freeipa/field',
+ 'freeipa/ipa',
+ 'freeipa/jquery',
+ 'freeipa/reg',
+ 'freeipa/widget'
+ ],
+ function(aci, fields, IPA, $, reg, widgets) {
return function() {
var target_container;
@@ -29,6 +37,11 @@ var group_entity = IPA.entity({ name: 'group' });
module('aci', {
setup: function() {
+
+ fields.register();
+ widgets.register();
+ aci.register();
+
IPA.ajax_options.async = false;
IPA.init({
url: 'data',
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 1d4530838..521bfa35a 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -18,8 +18,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['freeipa/ipa', 'freeipa/jquery','freeipa/facet', 'freeipa/facets', 'freeipa/details',
- 'freeipa/entity'], function(IPA, $, mod_facet, facets) {
+define([
+ 'freeipa/ipa',
+ 'freeipa/jquery',
+ 'freeipa/facet',
+ 'freeipa/facets',
+ 'freeipa/reg',
+ 'freeipa/details',
+ 'freeipa/entity',
+ 'freeipa/field',
+ 'freeipa/widget'],
+ function(IPA, $, mod_facet, facets, reg) {
return function() {
var details_container;
@@ -177,8 +186,8 @@ test("Testing details lifecycle: create, load.", function(){
return that;
}
- IPA.field_factories['test'] = test_field;
- IPA.widget_factories['test'] = test_widget;
+ reg.field.register('test', test_field);
+ reg.widget.register('test', test_widget);
IPA.register('user', function(spec) {