mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix displaying of success message
Make sure that the success message is properly populated with actual number of items that were successfully added/removed. https://fedorahosted.org/freeipa/ticket/3708
This commit is contained in:
parent
daa9b4e348
commit
851b091832
@ -609,10 +609,13 @@ IPA.association_table_widget = function (spec) {
|
||||
dialog.execute = function() {
|
||||
that.add(
|
||||
dialog.get_selected_values(),
|
||||
function() {
|
||||
function(data) {
|
||||
that.refresh();
|
||||
dialog.close();
|
||||
IPA.notify_success('@i18n:association.added');
|
||||
|
||||
var succeeded = IPA.get_succeeded(data);
|
||||
var msg = text.get('@i18n:association.added').replace('${count}', succeeded);
|
||||
IPA.notify_success(msg);
|
||||
},
|
||||
function() {
|
||||
that.refresh();
|
||||
@ -671,9 +674,12 @@ IPA.association_table_widget = function (spec) {
|
||||
dialog.execute = function() {
|
||||
that.remove(
|
||||
selected_values,
|
||||
function() {
|
||||
function(data) {
|
||||
that.refresh();
|
||||
IPA.notify_success('@i18n:association.removed');
|
||||
|
||||
var succeeded = IPA.get_succeeded(data);
|
||||
var msg = text.get('@i18n:association.removed').replace('${count}', succeeded);
|
||||
IPA.notify_success(msg);
|
||||
},
|
||||
function() {
|
||||
that.refresh();
|
||||
@ -1084,17 +1090,8 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) {
|
||||
on_success: function(data) {
|
||||
that.refresh();
|
||||
dialog.close();
|
||||
var succeeded = data.result.completed;
|
||||
|
||||
if (!succeeded) {
|
||||
succeeded = 0;
|
||||
for (var i = 0; i< data.result.results.length; i++) {
|
||||
if (data.result.results[i].completed === 1) {
|
||||
succeeded++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var succeeded = IPA.get_succeeded(data);
|
||||
var msg = text.get('@i18n:association.added').replace('${count}', succeeded);
|
||||
IPA.notify_success(msg);
|
||||
},
|
||||
@ -1148,17 +1145,7 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) {
|
||||
on_success: function(data) {
|
||||
that.refresh();
|
||||
|
||||
var succeeded = data.result.completed;
|
||||
|
||||
if (!succeeded) {
|
||||
succeeded = 0;
|
||||
for (var i = 0; i< data.result.results.length; i++) {
|
||||
if (data.result.results[i].completed === 1) {
|
||||
succeeded++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var succeeded = IPA.get_succeeded(data);
|
||||
var msg = text.get('@i18n:association.removed').replace('${count}', succeeded);
|
||||
IPA.notify_success(msg);
|
||||
},
|
||||
@ -1417,7 +1404,10 @@ exp.attribute_facet = IPA.attribute_facet = function(spec, no_init) {
|
||||
function(data) {
|
||||
that.load(data);
|
||||
that.show_content();
|
||||
IPA.notify_success('@i18n:association.removed');
|
||||
|
||||
var succeeded = IPA.get_succeeded(data);
|
||||
var msg = text.get('@i18n:association.removed').replace('${count}', succeeded);
|
||||
IPA.notify_success(msg);
|
||||
},
|
||||
function() {
|
||||
that.refresh();
|
||||
|
@ -1949,6 +1949,21 @@ IPA.notify_success = function(message, timeout) {
|
||||
}, timeout || IPA.config.message_timeout);
|
||||
};
|
||||
|
||||
IPA.get_succeeded = function(data) {
|
||||
var succeeded = data.result.completed;
|
||||
|
||||
if (typeof succeeded !== 'number') {
|
||||
succeeded = 0;
|
||||
for (var i = 0; i< data.result.results.length; i++) {
|
||||
if (data.result.results[i].completed === 1) {
|
||||
succeeded++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return succeeded;
|
||||
};
|
||||
|
||||
IPA.config = {
|
||||
default_priority: 500,
|
||||
message_timeout: 3000, // [ms]
|
||||
|
Loading…
Reference in New Issue
Block a user