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

View File

@ -1315,6 +1315,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
top common en Top
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
tree common en Tree
trinidad and tobago common en TRINIDAD AND TOBAGO

View File

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