diff options
Diffstat (limited to 'install/ui')
-rw-r--r-- | install/ui/src/freeipa/automember.js | 44 | ||||
-rw-r--r-- | install/ui/src/freeipa/host.js | 18 | ||||
-rw-r--r-- | install/ui/src/freeipa/user.js | 16 | ||||
-rw-r--r-- | install/ui/test/data/ipa_init.json | 10 |
4 files changed, 81 insertions, 7 deletions
diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index f8083b89e..2dff34227 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -699,12 +699,55 @@ IPA.automember.default_group_widget = function(spec) { return that; }; +IPA.automember.rebuild_action = function(spec) { + + spec = spec || {}; + spec.name = spec.name || 'automember_rebuild'; + spec.label = spec.label || '@i18n:actions.automember_rebuild'; + + var that = IPA.action(spec); + + that.execute_action = function(facet) { + var entity = facet.entity.name; + if (facet.name == 'search') { + var entries = facet.get_selected_values(); + } else { + entries = facet.get_pkeys(); + } + + var options = {}; + if (entries.length > 0) { + options[entity + 's'] = entries; + } else if (entity == 'user') { + options['type'] = 'group'; + } else { + options['type'] = 'hostgroup'; + } + + var command = IPA.command({ + entity: 'automember', + method: 'rebuild', + options: options, + on_success: function() { + IPA.notify_success('@i18n:actions.automember_rebuild_success'); + }, + on_error: function() { + } + }); + + command.execute(); + }; + + return that; +}; + exp.entity_spec = make_spec(); exp.register = function() { var e = reg.entity; var w = reg.widget; var f = reg.field; + var a = reg.action; e.register({ type: 'automember', @@ -713,6 +756,7 @@ exp.register = function() { }); w.register('automember_condition', IPA.automember.condition_widget); f.register('automember_condition', IPA.automember.condition_field); + a.register('automember_rebuild', exp.rebuild_action); }; phases.on('registration', exp.register); diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index f5007538e..ff1e5da5b 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -63,7 +63,16 @@ return { label: '@i18n:objects.host.enrolled', formatter: 'boolean' } - ] + ], + actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + } + ], + header_actions: ['select_action', 'automember_rebuild'] }, { $type: 'details', @@ -144,6 +153,12 @@ return { } ], actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + }, 'host_unprovision', { $type: 'set_otp', @@ -165,6 +180,7 @@ return { 'cert_revoke', 'cert_restore' ], + header_actions: ['select_action', 'automember_rebuild'], state: { evaluators: [ IPA.host.has_password_evaluator, diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index 61bdb43b4..d2ee3293f 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -67,6 +67,12 @@ return { 'title' ], actions: [ + 'select', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + }, { $type: 'batch_disable', hide_cond: ['self-service'] @@ -76,6 +82,7 @@ return { hide_cond: ['self-service'] } ], + header_actions: ['select_action', 'automember_rebuild'], control_buttons: [ { name: 'disable', @@ -240,9 +247,14 @@ return { 'enable', 'disable', 'delete', - 'reset_password' + 'reset_password', + { + $type: 'automember_rebuild', + name: 'automember_rebuild', + label: '@i18n:actions.automember_rebuild' + } ], - header_actions: ['select_action', 'enable', 'disable', 'delete'], + header_actions: ['select_action', 'enable', 'disable', 'delete', 'automember_rebuild'], state: { evaluators: [ { diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 8e0b2a33c..bac77962e 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -14,10 +14,12 @@ }, "actions": { "apply": "Apply", - "confirm": "Are you sure you want to proceed with the action.", - "delete_confirm": "Are you sure you want to delete ${object}", - "disable_confirm": "Are you sure you want to disable ${object}", - "enable_confirm": "Are you sure you want to enable ${object}", + "automember_rebuild": "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}?", + "disable_confirm": "Are you sure you want to disable ${object}?", + "enable_confirm": "Are you sure you want to enable ${object}?", "title": "Actions" }, "association": { |