summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2012-04-30 15:55:12 +0200
committerPetr Vobornik <pvoborni@redhat.com>2012-05-11 18:30:48 +0200
commit472f9fc5aad845afa335786599ba75603c006d31 (patch)
tree56709ff36de76571e4c6877fb044722bbef9ba39 /install
parent719b09fb4edf990beb07ab72bcd4d5e102975637 (diff)
downloadfreeipa-472f9fc5aad845afa335786599ba75603c006d31.tar.gz
freeipa-472f9fc5aad845afa335786599ba75603c006d31.tar.xz
freeipa-472f9fc5aad845afa335786599ba75603c006d31.zip
Consistent change of entry status.
This patch adds action list and control buttons for consistent change of enty status for user, hbac rules, sudo rules, SELinux maps and dns zones. Action lists with 'enable' and 'disable' and 'delete' options were added to details facets. Two control buttons: 'enable' and 'disable' were added to search facets. https://fedorahosted.org/freeipa/ticket/2247
Diffstat (limited to 'install')
-rw-r--r--install/ui/dns.js55
-rw-r--r--install/ui/hbac.js61
-rw-r--r--install/ui/selinux.js61
-rw-r--r--install/ui/sudo.js61
-rw-r--r--install/ui/user.js214
5 files changed, 215 insertions, 237 deletions
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 0d7f03f20..7b436c720 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -102,24 +102,42 @@ IPA.dns.zone_entity = function(spec) {
label: IPA.messages.status.label,
formatter: IPA.boolean_status_formatter()
}
- ]
+ ],
+ control_buttons: {
+ buttons: [
+ {
+ name: 'disable',
+ label: IPA.messages.buttons.disable,
+ icon: 'disabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'disable',
+ enable_cond: ['item-selected']
+ }
+ },
+ {
+ name: 'enable',
+ label: IPA.messages.buttons.enable,
+ icon: 'enabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'enable',
+ enable_cond: ['item-selected']
+ }
+ }
+ ]
+ }
}).
details_facet({
factory: IPA.dnszone_details_facet,
command_mode: 'info',
- sections: [{
+ sections: [
+ {
name: 'identity',
fields: [
'idnsname',
- {
- type: 'enable',
- name: 'idnszoneactive',
- label: IPA.messages.status.label,
- options: [
- { value: 'TRUE', label: IPA.messages.status.enabled },
- { value: 'FALSE', label: IPA.messages.status.disabled }
- ]
- },
'idnssoamname',
'idnssoarname',
'idnssoaserial',
@@ -198,7 +216,20 @@ IPA.dns.zone_entity = function(spec) {
name: 'idnsallowsyncptr'
}
]
- }]
+ }],
+ action_list: {
+ factory: IPA.action_list_widget,
+ name: 'action',
+ state_evaluator: {
+ factory: IPA.enable_state_evaluator,
+ field: 'idnszoneactive'
+ },
+ actions: [
+ IPA.enable_action,
+ IPA.disable_action,
+ IPA.delete_action
+ ]
+ }
}).
nested_search_facet({
factory: IPA.dns.record_search_facet,
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 007654dca..a5bd008af 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -25,8 +25,7 @@
IPA.hbac = {
//priority of commands in details facet
- remove_method_priority: IPA.config.default_priority - 1,
- enable_priority: IPA.config.default_priority + 1
+ remove_method_priority: IPA.config.default_priority - 1
};
IPA.hbac.rule_entity = function(spec) {
@@ -47,12 +46,51 @@ IPA.hbac.rule_entity = function(spec) {
formatter: IPA.boolean_status_formatter()
},
'description'
- ]
+ ],
+ control_buttons: {
+ buttons: [
+ {
+ name: 'disable',
+ label: IPA.messages.buttons.disable,
+ icon: 'disabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'disable',
+ enable_cond: ['item-selected']
+ }
+ },
+ {
+ name: 'enable',
+ label: IPA.messages.buttons.enable,
+ icon: 'enabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'enable',
+ enable_cond: ['item-selected']
+ }
+ }
+ ]
+ }
}).
details_facet({
factory: IPA.hbacrule_details_facet,
entity: that,
- command_mode: 'info'
+ command_mode: 'info',
+ action_list: {
+ factory: IPA.action_list_widget,
+ name: 'action',
+ state_evaluator: {
+ factory: IPA.enable_state_evaluator,
+ field: 'ipaenabledflag'
+ },
+ actions: [
+ IPA.enable_action,
+ IPA.disable_action,
+ IPA.delete_action
+ ]
+ }
}).
adder_dialog({
fields: [ 'cn' ]
@@ -203,13 +241,6 @@ IPA.hbacrule_details_facet = function(spec) {
type: 'textarea',
name: 'description',
widget: 'general.description'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- label: IPA.messages.status.label,
- priority: IPA.hbac.enable_priority,
- widget: 'general.ipaenabledflag'
}
];
@@ -225,14 +256,6 @@ IPA.hbacrule_details_facet = function(spec) {
{
type: 'textarea',
name: 'description'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- options: [
- { value: 'TRUE', label: IPA.messages.status.enabled },
- { value: 'FALSE', label: IPA.messages.status.disabled }
- ]
}
]
}
diff --git a/install/ui/selinux.js b/install/ui/selinux.js
index ddc8beebc..766277f14 100644
--- a/install/ui/selinux.js
+++ b/install/ui/selinux.js
@@ -23,8 +23,7 @@
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */
IPA.selinux = {
- remove_method_priority: IPA.config.default_priority - 1,
- enable_priority: IPA.config.default_priority + 1
+ remove_method_priority: IPA.config.default_priority - 1
};
IPA.selinux.selinuxusermap_entity = function(spec) {
@@ -46,12 +45,51 @@ IPA.selinux.selinuxusermap_entity = function(spec) {
formatter: IPA.boolean_status_formatter()
},
'description'
- ]
+ ],
+ control_buttons: {
+ buttons: [
+ {
+ name: 'disable',
+ label: IPA.messages.buttons.disable,
+ icon: 'disabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'disable',
+ enable_cond: ['item-selected']
+ }
+ },
+ {
+ name: 'enable',
+ label: IPA.messages.buttons.enable,
+ icon: 'enabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'enable',
+ enable_cond: ['item-selected']
+ }
+ }
+ ]
+ }
}).
details_facet({
factory: IPA.selinux_details_facet,
entity: that,
- command_mode: 'info'
+ command_mode: 'info',
+ action_list: {
+ factory: IPA.action_list_widget,
+ name: 'action',
+ state_evaluator: {
+ factory: IPA.enable_state_evaluator,
+ field: 'ipaenabledflag'
+ },
+ actions: [
+ IPA.enable_action,
+ IPA.disable_action,
+ IPA.delete_action
+ ]
+ }
}).
adder_dialog({
fields: [
@@ -91,13 +129,6 @@ IPA.selinux_details_facet = function(spec) {
type: 'entity_select',
name: 'seealso',
widget: 'general.seealso'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- label: IPA.messages.status.label,
- priority: IPA.selinux.enable_priority,
- widget: 'general.ipaenabledflag'
}
];
@@ -123,14 +154,6 @@ IPA.selinux_details_facet = function(spec) {
name: 'seealso',
other_entity: 'hbacrule',
other_field: 'cn'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- options: [
- { value: 'TRUE', label: IPA.messages.status.enabled },
- { value: 'FALSE', label: IPA.messages.status.disabled }
- ]
}
]
}
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 4fdcc52d1..1fa768573 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -24,8 +24,7 @@
IPA.sudo = {
//priority of commands in details facet
- remove_method_priority: IPA.config.default_priority - 1,
- enable_priority: IPA.config.default_priority + 1
+ remove_method_priority: IPA.config.default_priority - 1
};
IPA.sudo.rule_entity = function(spec) {
@@ -45,12 +44,51 @@ IPA.sudo.rule_entity = function(spec) {
formatter: IPA.boolean_status_formatter()
},
'description'
- ]
+ ],
+ control_buttons: {
+ buttons: [
+ {
+ name: 'disable',
+ label: IPA.messages.buttons.disable,
+ icon: 'disabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'disable',
+ enable_cond: ['item-selected']
+ }
+ },
+ {
+ name: 'enable',
+ label: IPA.messages.buttons.enable,
+ icon: 'enabled-icon',
+ needs_confirm: true,
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'enable',
+ enable_cond: ['item-selected']
+ }
+ }
+ ]
+ }
}).
details_facet({
factory: IPA.sudorule_details_facet,
entity: that,
- command_mode: 'info'
+ command_mode: 'info',
+ action_list: {
+ factory: IPA.action_list_widget,
+ name: 'action',
+ state_evaluator: {
+ factory: IPA.enable_state_evaluator,
+ field: 'ipaenabledflag'
+ },
+ actions: [
+ IPA.enable_action,
+ IPA.disable_action,
+ IPA.delete_action
+ ]
+ }
}).
adder_dialog({
fields: [ 'cn' ]
@@ -201,13 +239,6 @@ IPA.sudorule_details_facet = function(spec) {
type: 'textarea',
name: 'description',
widget: 'general.description'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- label: IPA.messages.status.label,
- priority: IPA.sudo.enable_priority,
- widget: 'general.ipaenabledflag'
}
];
@@ -223,14 +254,6 @@ IPA.sudorule_details_facet = function(spec) {
{
type: 'textarea',
name: 'description'
- },
- {
- type: 'enable',
- name: 'ipaenabledflag',
- options: [
- { value: 'TRUE', label: IPA.messages.status.enabled },
- { value: 'FALSE', label: IPA.messages.status.disabled }
- ]
}
]
}
diff --git a/install/ui/user.js b/install/ui/user.js
index 72bdd2410..ba25b006f 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -3,6 +3,8 @@
/* Authors:
* Pavel Zuna <pzuna@redhat.com>
* Adam Young <ayoung@redhat.com>
+ * Endi Sukma Dewata <edewata@redhat.com>
+ * Petr Vobornik <pvoborni@redhat.com>
*
* Copyright (C) 2010 Red Hat
* see file 'COPYING' for use and warranty information
@@ -52,7 +54,35 @@ IPA.user.entity = function(spec) {
'mail',
'telephonenumber',
'title'
- ]
+ ],
+ control_buttons: {
+ buttons: [
+ {
+ name: 'disable',
+ label: IPA.messages.buttons.disable,
+ icon: 'disabled-icon',
+ needs_confirm: true,
+ hide_cond: ['self-service'],
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'disable',
+ enable_cond: ['item-selected']
+ }
+ },
+ {
+ name: 'enable',
+ label: IPA.messages.buttons.enable,
+ icon: 'enabled-icon',
+ needs_confirm: true,
+ hide_cond: ['self-service'],
+ action: {
+ factory: IPA.batch_items_action,
+ method: 'enable',
+ enable_cond: ['item-selected']
+ }
+ }
+ ]
+ }
}).
details_facet({
factory: IPA.user.details_facet,
@@ -72,11 +102,6 @@ IPA.user.entity = function(spec) {
{
name: 'account',
fields: [
- {
- factory: IPA.user_status_widget,
- name: 'nsaccountlock',
- label: IPA.messages.status.label
- },
'uid',
{
factory: IPA.user_password_widget,
@@ -191,7 +216,21 @@ IPA.user.entity = function(spec) {
name: 'misc',
fields: [ 'carlicense' ]
}
- ]
+ ],
+ action_list: {
+ factory: IPA.action_list_widget,
+ name: 'action',
+ state_evaluator: {
+ factory: IPA.enable_state_evaluator,
+ field: 'nsaccountlock',
+ invert_value: true
+ },
+ actions: [
+ IPA.enable_action,
+ IPA.disable_action,
+ IPA.delete_action
+ ]
+ }
}).
association_facet({
name: 'memberof_group',
@@ -380,167 +419,6 @@ IPA.user_adder_dialog = function(spec) {
return that;
};
-IPA.user_status_widget = function(spec) {
-
- spec = spec || {};
-
- var that = IPA.input_widget(spec);
-
-
- that.create = function(container) {
-
- that.widget_create(container);
-
- that.status_span = $('<span/>', {
- name: 'status'
- }).appendTo(container);
-
- that.link_span = $('<span/>', {
- name: 'link'
- }).appendTo(container);
-
- that.link_span.append(': ');
-
- that.status_link = $('<a/>', {
- name: 'link',
- click: function() {
-
- var facet = that.entity.get_facet();
-
- if (facet.is_dirty()) {
- var dialog = IPA.dirty_dialog({
- facet: facet
- });
-
- dialog.callback = function() {
- that.show_activation_dialog();
- };
-
- dialog.open(container);
-
- } else {
- that.show_activation_dialog();
- }
-
- return false;
- }
- }).appendTo(that.link_span);
- };
-
- that.update = function(values) {
-
- //if (!that.record) return;
-
- //var lock_field = 'nsaccountlock';
- //var locked_field = that.record[lock_field];
- var locked_field = values;
- var locked = false;
-
- if (locked_field instanceof Array) {
- locked_field = locked_field[0];
- }
- if (typeof locked_field === 'boolean') {
- locked = locked_field;
- } else {
- locked = locked_field && locked_field.toLowerCase() === 'true';
- }
-
- var status;
- var action;
-
- if (locked) {
- status = IPA.messages.status.disabled;
- action = 'enable';
-
- } else {
- status = IPA.messages.status.enabled;
- action = 'disable';
- }
-
- that.status_span.html(status);
- that.status_link.attr('href', action);
-
- var message = IPA.messages.objects.user.status_link;
- var action_label = IPA.messages.status[action];
- message = message.replace('${action}', action_label);
-
- that.status_link.html(message);
-
- if (that.writable) {
- that.link_span.css('display', '');
-
- } else {
- that.link_span.css('display', 'none');
- }
- };
-
- that.clear = function() {
- that.link_span.css('display', 'none');
- that.status_span.text('');
- };
-
- that.show_activation_dialog = function() {
-
- var action = that.status_link.attr('href');
-
- var message = IPA.messages.objects.user.status_confirmation;
- var action_label = IPA.messages.status[action];
- message = message.replace('${action}', action_label.toLocaleLowerCase());
-
- var dialog = IPA.dialog({
- title: IPA.messages.dialogs.confirmation
- });
-
- dialog.create = function() {
- dialog.container.append(message);
- };
-
- dialog.create_button({
- name: 'set_status',
- label: action_label,
- click: function() {
- that.set_status(
- action,
- function(data, textStatus, xhr) {
- var facet = that.entity.get_facet();
- facet.refresh();
- dialog.close();
- }
- );
- }
- });
-
- dialog.create_button({
- name: 'cancel',
- label: IPA.messages.buttons.cancel,
- click: function() {
- dialog.close();
- }
- });
-
- dialog.open(that.container);
- };
-
- that.set_status = function(method, on_success, on_error) {
-
- var pkey = IPA.nav.get_state('user-pkey');
-
- IPA.command({
- entity: 'user',
- method: method,
- args: [pkey],
- on_success: on_success,
- on_error: on_error
- }).execute();
- };
-
- that.widgets_created = function() {
- that.widget = that;
- };
-
- return that;
-};
-
IPA.user_password_widget = function(spec) {
spec = spec || {};