diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-09-26 16:41:00 +0200 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-09-30 10:47:03 +0200 |
commit | 0e76bc1cb65b3eb81b37b4b45ccb71bf91fe5fbc (patch) | |
tree | 7472e5bb720d6af7d8ea292c6e316d67e0e43d49 /install | |
parent | 2cc78acf9b45b5f8a2d12e232d53267a31732df6 (diff) | |
download | freeipa-0e76bc1cb65b3eb81b37b4b45ccb71bf91fe5fbc.tar.gz freeipa-0e76bc1cb65b3eb81b37b4b45ccb71bf91fe5fbc.tar.xz freeipa-0e76bc1cb65b3eb81b37b4b45ccb71bf91fe5fbc.zip |
webui: list only not-applied hosts in "apply to host" dialog
https://fedorahosted.org/freeipa/ticket/4535
Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
Diffstat (limited to 'install')
-rw-r--r-- | install/ui/src/freeipa/idviews.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/install/ui/src/freeipa/idviews.js b/install/ui/src/freeipa/idviews.js index 2ba1fd681..18f48acb6 100644 --- a/install/ui/src/freeipa/idviews.js +++ b/install/ui/src/freeipa/idviews.js @@ -415,11 +415,12 @@ idviews.apply_action = function(spec) { /** * Create and open dialog */ - that.show_dialog = function(facet, current_pkeys) { + that.show_dialog = function(facet) { var pkey = facet.get_pkey(); var other_entity = reg.entity.get(that.other_entity); var other_entity_label = other_entity.metadata.label; + var exclude = that.get_exclude(facet); var title = text.get(that.dialog_title); title = title.replace('${entity}', other_entity_label); title = title.replace('${primary_key}', pkey); @@ -430,7 +431,7 @@ idviews.apply_action = function(spec) { pkey: pkey, other_entity: other_entity, attribute_member: that.attribute_member, - exclude: current_pkeys || [], + exclude: exclude, add_button_label: that.confirm_button_label }); @@ -478,6 +479,25 @@ idviews.apply_action = function(spec) { }; /** + * Get pkeys which should be excluded from offered pkeys in the dialog + * + * By default it works only for 'host' of 'appliedtohosts' facet since + * other facets might contain completely different values or might have + * different API. + * + * @param {facet.facet} facet + * @return {string[]} + */ + that.get_exclude = function(facet) { + if (facet && facet.name === 'appliedtohosts' && + that.other_entity === 'host') { + var records = facet.get_records_map(facet.data); + return records.keys; + } + return []; + }; + + /** * Notify idview.appliedtohosts facet that there were possible changes * and a refresh is needed. */ |