summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Vomacka <pvomacka@redhat.com>2016-10-05 10:50:08 +0200
committerMartin Basti <mbasti@redhat.com>2017-03-14 10:40:10 +0100
commitbbca1d9219bfab9f204cb0217495cbd94b7098be (patch)
tree2cd947aa5b6800f91e377a6abfa9d9bfda1a99be
parent6d1374f7f82d144b8aa361e9e637c5388f8f7edb (diff)
downloadfreeipa-bbca1d9219bfab9f204cb0217495cbd94b7098be.tar.gz
freeipa-bbca1d9219bfab9f204cb0217495cbd94b7098be.tar.xz
freeipa-bbca1d9219bfab9f204cb0217495cbd94b7098be.zip
Add property which allows refresh command to use url value
'refresh_attribute' can be set to the name of url parameter name. This parameter with its value is then passed to refresh command of the details facet. 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/details.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js
index 87b355a63..d1f230527 100644
--- a/install/ui/src/freeipa/details.js
+++ b/install/ui/src/freeipa/details.js
@@ -539,6 +539,13 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
that.refresh_command_name = spec.refresh_command_name || 'show';
/**
+ * Name of url argument which will be added to refresh RPC command as option.
+ *
+ * @property {string}
+ */
+ that.refresh_attribute = spec.refresh_attribute || null;
+
+ /**
* Name of update command
*
* - defaults to 'mod'
@@ -885,6 +892,23 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
};
/**
+ * Takes url argument which is named arg_name and its value. Creates object
+ * from this infromation {arg_name: arg_name_value} and attach it as option
+ * to command.
+ *
+ * @protected
+ * @param {rpc.command} command
+ * @param {string} argumnent name
+ */
+ that.add_url_arg_to_command = function(command, arg_name) {
+ var additional_opt = {};
+ command.options = command.options || {};
+
+ additional_opt[arg_name] = that.state[arg_name];
+ $.extend(command.options, additional_opt);
+ };
+
+ /**
* Create update command based on field part of update info
* @protected
* @param {details.update_info} update_info
@@ -1034,6 +1058,10 @@ exp.details_facet = IPA.details_facet = function(spec, no_init) {
command.args = that.get_pkeys();
}
+ if (that.refresh_attribute) {
+ that.add_url_arg_to_command(command, that.refresh_attribute);
+ }
+
return command;
};