Added optional option in refreshing after modifying association table

The 'refresh_option' of association field takes string. This string has to
correspond with field name on details page. In case that the field is present
the value of the field is passed to command as option in following format:

{fieldname: field_value}

Part of: https://fedorahosted.org/freeipa/ticket/5426

Reviewed-By: Martin Basti <mbasti@redhat.com>
Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
Pavel Vomacka 2016-10-05 10:27:19 +02:00 committed by Martin Basti
parent 93a7f4c88d
commit 6d1374f7f8

View File

@ -838,6 +838,15 @@ IPA.association_table_field = function (spec) {
var that = IPA.field(spec);
/**
* In case that facet has a state attribute set this is the way how to user
* that attribute in refresh command as option in format:
* {attributename: attributevalue}.
*
* @property {String}
*/
that.refresh_attribute = spec.refresh_attribute || '';
that.load = function(data) {
that.values = that.adapter.load(data);
that.widget.update(that.values);
@ -865,14 +874,19 @@ IPA.association_table_field = function (spec) {
}
var pkey = that.facet.get_pkey();
rpc.command({
var command = rpc.command({
entity: that.entity.name,
method: 'show',
args: [pkey],
options: { all: true, rights: true },
on_success: on_success,
on_error: on_error
}).execute();
});
var additional_option = that.facet.state[that.refresh_attribute];
if (additional_option) command.set_option(that.refresh_attribute, additional_option);
command.execute();
};
that.widgets_created = function() {