Add totals (selected, successful, skipped, failed) to long task dialog

This commit is contained in:
nathangray 2016-07-04 12:49:47 -06:00
parent 0e74579426
commit 9260dae493
3 changed files with 21 additions and 0 deletions

View File

@ -724,6 +724,12 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
var log = null; var log = null;
var progressbar = null; var progressbar = null;
var cancel = false; var cancel = false;
var totals = {
success: 0,
skipped: 0,
failed: 0,
widget: null
};
// Updates progressbar & log, calls next step // Updates progressbar & log, calls next step
var update = function(response) { var update = function(response) {
@ -731,6 +737,7 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
var index = this || 0; var index = this || 0;
progressbar.set_value(100*(index/_list.length)); progressbar.set_value(100*(index/_list.length));
progressbar.set_label(index +' / ' + _list.length);
// Display response information // Display response information
switch(response.type) switch(response.type)
@ -740,6 +747,8 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
.text(response.data) .text(response.data)
.appendTo(log); .appendTo(log);
totals.failed++
// Ask to retry / ignore / abort // Ask to retry / ignore / abort
et2_createWidget("dialog", { et2_createWidget("dialog", {
callback:function(button) { callback:function(button) {
@ -750,6 +759,7 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
return update.call(index,''); return update.call(index,'');
case 'dialog[skip]': case 'dialog[skip]':
// Continue with next index // Continue with next index
totals.skipped++;
return update.call(index,''); return update.call(index,'');
default: default:
// Try again with previous index // Try again with previous index
@ -772,6 +782,7 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
default: default:
if(response) if(response)
{ {
totals.success++;
log.append("<div class='message'>"+response+"</div>"); log.append("<div class='message'>"+response+"</div>");
} }
} }
@ -779,6 +790,12 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
var height = log[0].scrollHeight; var height = log[0].scrollHeight;
log.scrollTop(height); log.scrollTop(height);
// Update totals
totals.widget.set_value(egw.lang(
"Total: %1 Successful: %2 Failed: %3 Skipped: %4",
_list.length, totals.success, totals.failed, totals.skipped
));
// Fire next step // Fire next step
if(!cancel && index < _list.length) if(!cancel && index < _list.length)
{ {
@ -806,6 +823,8 @@ jQuery.extend(et2_dialog, //(function(){ "use strict"; return
// Get access to template widgets // Get access to template widgets
log = jQuery(dialog.template.widgetContainer.getWidgetById('log').getDOMNode()); log = jQuery(dialog.template.widgetContainer.getWidgetById('log').getDOMNode());
progressbar = dialog.template.widgetContainer.getWidgetById('progressbar'); progressbar = dialog.template.widgetContainer.getWidgetById('progressbar');
progressbar.set_label('0 / ' + _list.length);
totals.widget = dialog.template.widgetContainer.getWidgetById('totals');
// Start // Start
window.setTimeout(function() {update.call(0,'');},0); window.setTimeout(function() {update.call(0,'');},0);

View File

@ -1312,6 +1312,7 @@ tonga common en TONGA
too many unsucessful attempts to login: %1 for the user '%2', %3 for the ip %4 common en Too many unsuccessful attempts to log in: %1 for the user '%2', %3 for the IP %4 too many unsucessful attempts to login: %1 for the user '%2', %3 for the ip %4 common en Too many unsuccessful attempts to log in: %1 for the user '%2', %3 for the IP %4
top common en Top top common en Top
total common en Total total common en Total
total: %1 successful: %2 failed: %3 skipped: %4 common en Total: %1 Successful: %2 Failed: %3 Skipped: %4
transparant bg for the icons? common en Transparant bg for the icons transparant bg for the icons? common en Transparant bg for the icons
tree common en Tree tree common en Tree
trinidad and tobago common en TRINIDAD AND TOBAGO trinidad and tobago common en TRINIDAD AND TOBAGO

View File

@ -8,6 +8,7 @@
<vbox class="ui-dialog-content"> <vbox class="ui-dialog-content">
<label id="message"/> <label id="message"/>
<progress id="progressbar"/> <progress id="progressbar"/>
<label id="totals"/>
<box class="log" id="log"/> <box class="log" id="log"/>
</vbox> </vbox>
</hbox> </hbox>