summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2013-04-17 10:08:34 +0200
committerPetr Vobornik <pvoborni@redhat.com>2013-05-06 16:22:27 +0200
commit5be709bf9d4865486c239584653363c1d85492a6 (patch)
treeb33ef67286459d0397b7e6241f917b6b8a9911a6
parent5239d3750e9a82028e79ffe95b9280fb606fb47b (diff)
downloadfreeipa-5be709bf9d4865486c239584653363c1d85492a6.tar.gz
freeipa-5be709bf9d4865486c239584653363c1d85492a6.tar.xz
freeipa-5be709bf9d4865486c239584653363c1d85492a6.zip
Builder and registry for actions
https://fedorahosted.org/freeipa/ticket/3235
-rwxr-xr-xinstall/ui/src/freeipa/certificate.js7
-rw-r--r--install/ui/src/freeipa/details.js25
-rw-r--r--install/ui/src/freeipa/dns.js4
-rw-r--r--install/ui/src/freeipa/facet.js52
-rw-r--r--install/ui/src/freeipa/group.js27
-rw-r--r--install/ui/src/freeipa/host.js8
-rw-r--r--install/ui/src/freeipa/search.js26
-rw-r--r--install/ui/src/freeipa/service.js2
-rw-r--r--install/ui/src/freeipa/user.js21
-rw-r--r--install/ui/test/aci_tests.js6
-rw-r--r--install/ui/test/details_tests.js7
-rw-r--r--install/ui/test/entity_tests.js16
12 files changed, 157 insertions, 44 deletions
diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 6965509f6..712d82c91 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1312,12 +1312,19 @@ IPA.register('cert', IPA.cert.entity);
phases.on('registration', function() {
var w = reg.widget;
var f = reg.field;
+ var a = reg.action;
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);
+
+ a.register('cert_view', IPA.cert.view_action);
+ a.register('cert_get', IPA.cert.get_action);
+ a.register('cert_request', IPA.cert.request_action);
+ a.register('cert_revoke', IPA.cert.revoke_action);
+ a.register('cert_restore', IPA.cert.restore_action);
});
return {};
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js
index 69c85d54e..7a7f49e4f 100644
--- a/install/ui/src/freeipa/details.js
+++ b/install/ui/src/freeipa/details.js
@@ -23,7 +23,15 @@
/* IPA Object Details - populating definiton lists from entry data */
-define(['./ipa', './jquery', './text', './facet', './add'], function(IPA, $, text) {
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './facet',
+ './add'],
+ function(IPA, $, phases, reg, text) {
var exp = {};
@@ -1200,5 +1208,20 @@ exp.disabled_summary_cond = IPA.disabled_summary_cond = function() {
};
};
+exp.register = function() {
+ var a = reg.action;
+
+ a.register('select', exp.select_action);
+ a.register('refresh', exp.refresh_action);
+ a.register('reset', exp.reset_action);
+ a.register('update', exp.update_action);
+ a.register('object', exp.object_action);
+ a.register('enable', exp.enable_action);
+ a.register('disable', exp.disable_action);
+ a.register('delete', exp.delete_action);
+};
+
+phases.on('registration', exp.register);
+
return exp;
}); \ No newline at end of file
diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js
index bccb52134..265251ad0 100644
--- a/install/ui/src/freeipa/dns.js
+++ b/install/ui/src/freeipa/dns.js
@@ -2536,6 +2536,7 @@ phases.on('registration', function() {
var w = reg.widget;
var f = reg.field;
var v = reg.validator;
+ var a = reg.action;
w.register('dnszone_name', IPA.dnszone_name_widget);
w.register('force_dnszone_add_checkbox', IPA.force_dnszone_add_checkbox_widget);
@@ -2554,6 +2555,9 @@ phases.on('registration', function() {
v.register('ip_v6_address', IPA.ip_v6_address_validator);
v.register('dnsforwarder', IPA.dnsforwarder_validator);
v.register('network', IPA.network_validator);
+
+ a.register('dns_add_permission', IPA.dns.add_permission_action);
+ a.register('dns_remove_permission', IPA.dns.remove_permission_action);
});
return {};
diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js
index 899eca53f..06aa4a838 100644
--- a/install/ui/src/freeipa/facet.js
+++ b/install/ui/src/freeipa/facet.js
@@ -28,19 +28,20 @@ define([
'dojo/on',
'dojo/Stateful',
'dojo/Evented',
- './_base/Builder',
+ './builder',
'./facets',
'./ipa',
'./jquery',
'./navigation',
'./phases',
+ './reg',
'./spec_util',
'./text',
'./dialog',
'./field',
'./widget'
], function(declare, lang, construct, on, Stateful, Evented,
- Builder, facets, IPA, $, navigation, phases, su, text) {
+ builder, facets, IPA, $, navigation, phases, reg, su, text) {
/**
* Facet represents the content of currently displayed page.
@@ -121,8 +122,8 @@ exp.facet = IPA.facet = function(spec, no_init) {
that.disable_breadcrumb = spec.disable_breadcrumb;
that.disable_facet_tabs = spec.disable_facet_tabs;
- that.action_state = IPA.build(spec.state || {}, {}, { $factory: exp.state });
- that.actions = exp.action_holder_builder.build({ actions: spec.actions });
+ that.action_state = builder.build('', spec.state || {}, {}, { $factory: exp.state });
+ that.actions = builder.build('', { actions: spec.actions }, {}, { $factory: exp.action_holder } );
that.header_actions = spec.header_actions;
that.header = spec.header || IPA.facet_header({ facet: that });
@@ -1728,7 +1729,7 @@ exp.action_holder = IPA.action_holder = function(spec) {
var i, action, actions;
that.facet = facet;
- actions = exp.action_builder.build(spec.actions) || [];
+ actions = builder.build('action', spec.actions) || [];
for (i=0; i<actions.length; i++) {
action = actions[i];
@@ -1783,8 +1784,8 @@ exp.state = IPA.state = function(spec) {
//when state changes. Params: state, Context: this
that.changed = IPA.observer();
- that.evaluators = exp.state_evaluator_builder.build(spec.evaluators) || [];
- that.summary_evaluator = IPA.build(spec.summary_evaluator || IPA.summary_evaluator);
+ that.evaluators = builder.build('state_evaluator', spec.evaluators) || [];
+ that.summary_evaluator = builder.build('', spec.summary_evaluator || IPA.summary_evaluator);
that.summary_conditions = spec.summary_conditions || [];
@@ -2126,7 +2127,8 @@ exp.control_buttons_widget = IPA.control_buttons_widget = function(spec) {
var that = IPA.widget(spec);
- that.buttons = IPA.action_button_widget_builder.build(spec.buttons) || [];
+ that.buttons = builder.build('widget', spec.buttons, {},
+ { $factory: exp.action_button_widget} ) || [];
that.init = function(facet) {
@@ -2180,7 +2182,6 @@ exp.eval_cond = IPA.eval_cond = function(enable_cond, disable_cond, state) {
return true;
};
-
exp.action_list_widget = IPA.action_list_widget = function(spec) {
spec = spec || {};
@@ -2379,7 +2380,7 @@ var FacetState = exp.FacetState = declare([Stateful, Evented], {
return this;
},
- /*
+ /**
* Set a property
*
* Sets named properties on a stateful object and notifies any watchers of
@@ -2422,25 +2423,26 @@ var FacetState = exp.FacetState = declare([Stateful, Evented], {
}
});
-exp.action_builder = IPA.action_builder = new Builder({
- factory: exp.action
-});
-exp.action_holder_builder = new Builder({
- factory: exp.action_holder
-});
+// Action builder and registry
+exp.action_builder = builder.get('action');
+exp.action_builder.factory = exp.action;
+reg.set('action', exp.action_builder.registry);
-exp.state_builder = IPA.state_builder = new Builder({
- factory: exp.state
-});
+// State Evaluator builder and registry
+exp.state_evaluator_builder = builder.get('state_evaluator');
+exp.state_evaluator.factory = exp.action;
+reg.set('state_evaluator', exp.state_evaluator.registry);
-exp.state_evaluator_builder = IPA.state_evaluator_builder = new Builder({
- factory: exp.state
-});
+exp.register = function() {
+ var w = reg.widget;
-exp.action_button_widget_builder = IPA.action_button_widget_builder = new Builder({
- factory: exp.action_button_widget
-});
+ w.register('action_button', exp.action_button_widget);
+ w.register('control_buttons', exp.control_buttons_widget);
+ w.register('action_list', exp.action_list_widget);
+};
+
+phases.on('registration', exp.register);
return exp;
});
diff --git a/install/ui/src/freeipa/group.js b/install/ui/src/freeipa/group.js
index b04c32d87..34aa02f33 100644
--- a/install/ui/src/freeipa/group.js
+++ b/install/ui/src/freeipa/group.js
@@ -20,10 +20,18 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './details', './search', './association',
- './entity'], function(IPA, $) {
-
-IPA.group = {};
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './details',
+ './search',
+ './association',
+ './entity'],
+ function(IPA, $, phases, reg) {
+
+var exp = IPA.group = {};
IPA.group.entity = function(spec) {
@@ -256,5 +264,14 @@ IPA.group.make_external_action = function(spec) {
IPA.register('group', IPA.group.entity);
-return {};
+exp.register = function() {
+ var a = reg.action;
+
+ a.register('make_posix', exp.make_posix_action);
+ a.register('make_external', exp.make_external_action);
+};
+
+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 220cbcee5..9d0215590 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -31,7 +31,7 @@ define(['./ipa',
'./certificate'],
function(IPA, $, phases, reg, text) {
-IPA.host = {};
+var exp = IPA.host = {};
IPA.host.entity = function(spec) {
@@ -965,6 +965,7 @@ IPA.register('host', IPA.host.entity);
phases.on('registration', function() {
var w = reg.widget;
var f = reg.field;
+ var a = reg.action;
f.register('host_fqdn', IPA.host_fqdn_field);
w.register('host_fqdn', IPA.host_fqdn_widget);
@@ -976,8 +977,11 @@ phases.on('registration', function() {
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);
+
+ a.register('host_unprovision', exp.unprovision_action);
+ a.register('set_otp', exp.set_otp_action);
});
-return {};
+return exp;
});
diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js
index d71b01273..fafbc3b21 100644
--- a/install/ui/src/freeipa/search.js
+++ b/install/ui/src/freeipa/search.js
@@ -21,7 +21,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['./ipa', './jquery', './text', './facet'], function(IPA, $, text) {
+define([
+ './ipa',
+ './jquery',
+ './phases',
+ './reg',
+ './text',
+ './facet'],
+ function(IPA, $, phases, reg, text) {
+
+var exp = {};
IPA.search_facet = function(spec, no_init) {
@@ -502,5 +511,18 @@ IPA.batch_enable_action = function(spec) {
return IPA.batch_items_action(spec);
};
-return {};
+exp.register = function() {
+
+ var a = reg.action;
+
+ a.register('batch_remove', IPA.batch_remove_action);
+ a.register('add', IPA.add_action);
+ a.register('batch_items', IPA.batch_items_action);
+ a.register('batch_disable', IPA.batch_disable_action);
+ a.register('batch_enable', IPA.batch_enable_action);
+};
+
+phases.on('registration', exp.register);
+
+return exp;
});
diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js
index f5e942d64..f51b85532 100644
--- a/install/ui/src/freeipa/service.js
+++ b/install/ui/src/freeipa/service.js
@@ -512,6 +512,7 @@ IPA.register('service', IPA.service.entity);
phases.on('registration', function() {
var w = reg.widget;
var f = reg.field;
+ var a = reg.action;
f.register('service_name', IPA.service_name_field);
w.register('service_name', IPA.text_widget);
@@ -519,6 +520,7 @@ phases.on('registration', function() {
w.register('service_host', IPA.text_widget);
f.register('service_provisioning_status', IPA.field);
w.register('service_provisioning_status', IPA.service_provisioning_status_widget);
+ a.register('service_unprovision', IPA.service.unprovision_action);
});
diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js
index 04e589b77..bc608d8a8 100644
--- a/install/ui/src/freeipa/user.js
+++ b/install/ui/src/freeipa/user.js
@@ -21,8 +21,18 @@
* 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) {
var exp = IPA.user = {};
@@ -668,5 +678,12 @@ IPA.user.reset_password_acl_evaluator = function(spec) {
IPA.register('user', IPA.user.entity);
+exp.register = function() {
+ var a = reg.action;
+ a.register('reset_password', IPA.user.reset_password_action);
+};
+
+phases.on('registration', exp.register);
+
return exp;
});
diff --git a/install/ui/test/aci_tests.js b/install/ui/test/aci_tests.js
index cc248c928..5c8b37e0f 100644
--- a/install/ui/test/aci_tests.js
+++ b/install/ui/test/aci_tests.js
@@ -20,13 +20,15 @@
define([
'freeipa/aci',
+ 'freeipa/details',
+ 'freeipa/facet',
'freeipa/field',
'freeipa/ipa',
'freeipa/jquery',
'freeipa/reg',
'freeipa/widget'
],
- function(aci, fields, IPA, $, reg, widgets) {
+ function(aci, mod_details, mod_facet, fields, IPA, $, reg, widgets) {
return function() {
var target_container;
@@ -41,6 +43,8 @@ module('aci', {
fields.register();
widgets.register();
aci.register();
+ mod_facet.register();
+ mod_details.register();
IPA.ajax_options.async = false;
IPA.init({
diff --git a/install/ui/test/details_tests.js b/install/ui/test/details_tests.js
index 0ad9fb720..71eccfb45 100644
--- a/install/ui/test/details_tests.js
+++ b/install/ui/test/details_tests.js
@@ -21,14 +21,14 @@
define([
'freeipa/ipa',
'freeipa/jquery',
+ 'freeipa/details',
'freeipa/facet',
'freeipa/facets',
'freeipa/reg',
- 'freeipa/details',
'freeipa/entity',
'freeipa/field',
'freeipa/widget'],
- function(IPA, $, mod_facet, facets, reg) {
+ function(IPA, $, mod_details, mod_facet, facets, reg) {
return function() {
var details_container;
@@ -46,6 +46,9 @@ module('details', {
]
});
+ mod_facet.register();
+ mod_details.register();
+
IPA.init({
url: 'data',
on_error: function(xhr, text_status, error_thrown) {
diff --git a/install/ui/test/entity_tests.js b/install/ui/test/entity_tests.js
index c9b7a1047..5a085f7a0 100644
--- a/install/ui/test/entity_tests.js
+++ b/install/ui/test/entity_tests.js
@@ -19,10 +19,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-define(['freeipa/ipa', 'freeipa/jquery','freeipa/facet', 'freeipa/facets',
- 'freeipa/entity', 'freeipa/search',
- 'freeipa/details'], function(IPA, $, mod_facet, facets) {
- return function() {
+define([
+ 'freeipa/ipa',
+ 'freeipa/jquery',
+ 'freeipa/facet',
+ 'freeipa/facets',
+ 'freeipa/search',
+ 'freeipa/entity',
+ 'freeipa/details'],
+ function(IPA, $, mod_facet, facets, mod_search) {
+ return function() {
var container;
@@ -31,6 +37,8 @@ module('entity',{
IPA.ajax_options.async = false;
+ mod_search.register();
+
facets.register({
type: 'search',
factory: IPA.search_facet,