From bbca1d9219bfab9f204cb0217495cbd94b7098be Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Wed, 5 Oct 2016 10:50:08 +0200 Subject: 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 Reviewed-By: Petr Vobornik --- install/ui/src/freeipa/details.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'install/ui/src') 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 @@ -538,6 +538,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 * @@ -884,6 +891,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 @@ -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; }; -- cgit