webui: add confirmation to action dropdown actions

Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
This commit is contained in:
Petr Vobornik 2014-04-14 16:44:03 +02:00
parent be3aadd06a
commit a98df325b6
6 changed files with 14 additions and 1 deletions

View File

@ -708,6 +708,8 @@ IPA.automember.rebuild_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'automember_rebuild';
spec.label = spec.label || '@i18n:actions.automember_rebuild';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.confirm_msg = spec.confirm_msg || '@i18n:actions.automember_rebuild_confirm';
var that = IPA.action(spec);

View File

@ -1857,7 +1857,7 @@ exp.object_action = IPA.object_action = function(spec) {
* @inheritDoc
*/
that.get_confirm_message = function(facet) {
var pkey = that.get_pkey();
var pkey = facet.get_pkey();
var msg = that.confirm_msg.replace('${object}', pkey);
return msg;
};
@ -1878,6 +1878,7 @@ exp.enable_action = IPA.enable_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'enable';
spec.method = spec.method || 'enable';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.confirm_msg = spec.confirm_msg || '@i18n:actions.enable_confirm';
spec.label = spec.label || '@i18n:buttons.enable';
spec.disable_cond = spec.disable_cond || ['enabled'];
@ -1898,6 +1899,7 @@ exp.disable_action = IPA.disable_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'disable';
spec.method = spec.method || 'disable';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.confirm_msg = spec.confirm_msg || '@i18n:actions.disable_confirm';
spec.label = spec.label || '@i18n:buttons.disable';
spec.enable_cond = spec.enable_cond || ['enabled'];
@ -1921,6 +1923,7 @@ exp.delete_action = IPA.delete_action = function(spec) {
spec = spec || {};
spec.name = spec.name || 'delete';
spec.method = spec.method || 'del';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.confirm_msg = spec.confirm_msg || '@i18n:actions.delete_confirm';
spec.label = spec.label || '@i18n:buttons.remove';

View File

@ -240,6 +240,7 @@ IPA.group.make_posix_action = function(spec) {
spec.name = spec.name || 'make_posix';
spec.method = spec.method || 'mod';
spec.label = spec.label || '@i18n:objects.group.make_posix';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.disable_cond = spec.disable_cond || ['oc_posixgroup', 'oc_ipaexternalgroup'];
spec.options = spec.options || {
posix: true
@ -256,6 +257,7 @@ IPA.group.make_external_action = function(spec) {
spec.name = spec.name || 'make_external';
spec.method = spec.method || 'mod';
spec.label = spec.label || '@i18n:objects.group.make_external';
spec.needs_confirm = spec.needs_confirm !== undefined ? spec.needs_confirm : true;
spec.disable_cond = spec.disable_cond || ['oc_posixgroup','oc_ipaexternalgroup'];
spec.options = spec.options || {
external: true

View File

@ -129,6 +129,8 @@ return {
name: 'otp_enable',
label: '@i18n:objects.otptoken.enable',
method: 'mod',
needs_confirm: true,
confirm_msg: '@i18n:actions.enable_confirm',
options: { ipatokendisabled: false },
enable_cond: ['disabled'],
hide_cond: ['self-service']
@ -138,6 +140,8 @@ return {
name: 'otp_disable',
label: '@i18n:objects.otptoken.disable',
method: 'mod',
needs_confirm: true,
confirm_msg: '@i18n:actions.disable_confirm',
options: { ipatokendisabled: true },
enable_cond: ['enabled'],
hide_cond: ['self-service']

View File

@ -15,6 +15,7 @@
"actions": {
"apply": "Apply",
"automember_rebuild": "Rebuild auto membership",
"automember_rebuild_confirm": "Are you sure you want to rebuild auto membership?",
"automember_rebuild_success": "Automember rebuild membership task completed",
"confirm": "Are you sure you want to proceed with the action?",
"delete_confirm": "Are you sure you want to delete ${object}?",

View File

@ -150,6 +150,7 @@ class i18n_messages(Command):
"actions": {
"apply": _("Apply"),
"automember_rebuild": _("Rebuild auto membership"),
"automember_rebuild_confirm": _("Are you sure you want to rebuild auto membership?"),
"automember_rebuild_success": _("Automember rebuild membership task completed"),
"confirm": _("Are you sure you want to proceed with the action?"),
"delete_confirm": _("Are you sure you want to delete ${object}?"),