summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-10-05 09:54:24 +0200
committerMartin Basti <mbasti@redhat.com>2017-03-14 10:40:10 +0100
commitc3115fa617fb049ba48d356d280fdb23c312ebca (patch)
treea4d6b81f4d4255c70b9bdfcafa6260ae45797f03
parentda5487c407bee9bce41f4012d07970916b9456c1 (diff)
downloadfreeipa-c3115fa617fb049ba48d356d280fdb23c312ebca.tar.gz
freeipa-c3115fa617fb049ba48d356d280fdb23c312ebca.tar.xz
freeipa-c3115fa617fb049ba48d356d280fdb23c312ebca.zip
Additional option to add and del operations can be set
By setting the property 'additional_add_del_field' to the name of one of the fields which are on current details page, we choose field which value will be added to *_add_* and *_del_* commands in this format: {field_name: field_value} --field_name: field_value Part of: https://fedorahosted.org/freeipa/ticket/5426 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
-rw-r--r--install/ui/src/freeipa/association.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js
index 7579bb095..d44f8c805 100644
--- a/install/ui/src/freeipa/association.js
+++ b/install/ui/src/freeipa/association.js
@@ -421,6 +421,14 @@ IPA.association_table_widget = function (spec) {
var that = IPA.table_widget(spec);
+ /**
+ * The value should be name of the field, which will be added to *_add_*,
+ * *_del_* commands as option: {fieldname: fieldvalue}.
+ *
+ * @property {String} fieldname
+ */
+ that.additional_add_del_field = spec.additional_add_del_field;
+
that.other_entity = IPA.get_entity(spec.other_entity);
that.attribute_member = spec.attribute_member;
@@ -677,9 +685,22 @@ IPA.association_table_widget = function (spec) {
});
command.set_option(that.other_entity.name, values);
+ that.join_additional_option(command);
+
command.execute();
};
+ that.join_additional_option = function(command) {
+ var add_opt = that.additional_add_del_field;
+ if (add_opt && typeof add_opt === 'string') {
+ var opt_field = that.entity.facet.get_field(add_opt);
+ var value;
+ if (opt_field) value = opt_field.get_value()[0];
+
+ command.set_option(add_opt, value);
+ }
+ };
+
that.show_remove_dialog = function() {
var selected_values = that.get_selected_values();
@@ -741,6 +762,7 @@ IPA.association_table_widget = function (spec) {
});
command.set_option(that.other_entity.name, values);
+ that.join_additional_option(command);
command.execute();
};