mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-27 09:21:59 -06:00
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>
This commit is contained in:
parent
2cc78acf9b
commit
0e76bc1cb6
@ -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
|
||||
});
|
||||
|
||||
@ -477,6 +478,25 @@ idviews.apply_action = function(spec) {
|
||||
return command;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
|
Loading…
Reference in New Issue
Block a user