Index: trunk/extensions/UploadWizard/resources/mw.GroupProgressBar.js |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | /** |
3 | 3 | * this is a progress bar for monitoring multiple objects, giving summary view |
4 | 4 | */ |
5 | | -mw.GroupProgressBar = function( selector, text, uploads, endStates, progressProperty, weightProperty ) { |
| 5 | +mw.GroupProgressBar = function( selector, text, uploads, successStates, errorStates, progressProperty, weightProperty ) { |
6 | 6 | var _this = this; |
7 | 7 | |
8 | 8 | // XXX need to figure out a way to put text inside bar |
— | — | @@ -21,7 +21,8 @@ |
22 | 22 | _this.$selector.find( '.mwe-upwiz-progress-bar' ).progressbar( { value : 0 } ); |
23 | 23 | |
24 | 24 | _this.uploads = uploads; |
25 | | - _this.endStates = endStates; |
| 25 | + _this.successStates = successStates; |
| 26 | + _this.errorStates = errorStates; |
26 | 27 | _this.progressProperty = progressProperty; |
27 | 28 | _this.weightProperty = weightProperty; |
28 | 29 | _this.beginTime = undefined; |
— | — | @@ -31,7 +32,7 @@ |
32 | 33 | mw.GroupProgressBar.prototype = { |
33 | 34 | |
34 | 35 | /** |
35 | | - * Show the progress bar with a slideout motion |
| 36 | + * Show the progress bar |
36 | 37 | */ |
37 | 38 | showBar: function() { |
38 | 39 | this.$selector.find( '.mwe-upwiz-progress-bar-etr' ).fadeIn( 200 ); |
— | — | @@ -53,12 +54,16 @@ |
54 | 55 | |
55 | 56 | var displayer = function() { |
56 | 57 | var fraction = 0.0; |
57 | | - var endStateCount = 0; |
| 58 | + var successStateCount = 0; |
| 59 | + var errorStateCount = 0; |
58 | 60 | var hasData = false; |
59 | 61 | $j.each( _this.uploads, function( i, upload ) { |
60 | | - if ( $j.inArray( upload.state, _this.endStates ) !== -1 ) { |
61 | | - endStateCount++; |
| 62 | + if ( $j.inArray( upload.state, _this.successStates ) !== -1 ) { |
| 63 | + successStateCount++; |
62 | 64 | } |
| 65 | + if ( $j.inArray( upload.state, _this.errorStates ) !== -1 ) { |
| 66 | + errorStateCount++; |
| 67 | + } |
63 | 68 | if (upload[_this.progressProperty] !== undefined) { |
64 | 69 | fraction += upload[_this.progressProperty] * ( upload[_this.weightProperty] / totalWeight ); |
65 | 70 | if (upload[_this.progressProperty] > 0 ) { |
— | — | @@ -66,7 +71,7 @@ |
67 | 72 | } |
68 | 73 | } |
69 | 74 | } ); |
70 | | - //mw.log( 'hasdata:' + hasData + ' endstatecount:' + endStateCount ); |
| 75 | + |
71 | 76 | // sometimes, the first data we have just tells us that it's over. So only show the bar |
72 | 77 | // if we have good data AND the fraction is less than 1. |
73 | 78 | if ( hasData && fraction < 1.0 ) { |
— | — | @@ -76,14 +81,13 @@ |
77 | 82 | } |
78 | 83 | _this.showProgress( fraction ); |
79 | 84 | } |
80 | | - _this.showCount( endStateCount ); |
| 85 | + _this.showCount( successStateCount ); |
81 | 86 | |
82 | | - if ( endStateCount < _this.uploads.length ) { |
| 87 | + if ( successStateCount + errorStateCount < _this.uploads.length ) { |
83 | 88 | setTimeout( displayer, 200 ); |
84 | 89 | } else { |
85 | 90 | _this.showProgress( 1.0 ); |
86 | | - // not necessary to hide bar since we're going to the next step. |
87 | | - /* setTimeout( function() { _this.hideBar(); }, 500 ); */ |
| 91 | + setTimeout( function() { _this.hideBar(); }, 500 ); |
88 | 92 | } |
89 | 93 | }; |
90 | 94 | displayer(); |
Index: trunk/extensions/UploadWizard/resources/combined.js |
— | — | @@ -8352,7 +8352,7 @@ |
8353 | 8353 | /** |
8354 | 8354 | * this is a progress bar for monitoring multiple objects, giving summary view |
8355 | 8355 | */ |
8356 | | -mw.GroupProgressBar = function( selector, text, uploads, endStates, progressProperty, weightProperty ) { |
| 8356 | +mw.GroupProgressBar = function( selector, text, uploads, successStates, errorStates, progressProperty, weightProperty ) { |
8357 | 8357 | var _this = this; |
8358 | 8358 | |
8359 | 8359 | // XXX need to figure out a way to put text inside bar |
— | — | @@ -8372,7 +8372,8 @@ |
8373 | 8373 | _this.$selector.find( '.mwe-upwiz-progress-bar' ).progressbar( { value : 0 } ); |
8374 | 8374 | |
8375 | 8375 | _this.uploads = uploads; |
8376 | | - _this.endStates = endStates; |
| 8376 | + _this.successStates = successStates; |
| 8377 | + _this.errorStates = errorStates; |
8377 | 8378 | _this.progressProperty = progressProperty; |
8378 | 8379 | _this.weightProperty = weightProperty; |
8379 | 8380 | _this.beginTime = undefined; |
— | — | @@ -8404,12 +8405,16 @@ |
8405 | 8406 | |
8406 | 8407 | var displayer = function() { |
8407 | 8408 | var fraction = 0.0; |
8408 | | - var endStateCount = 0; |
| 8409 | + var successStateCount = 0; |
| 8410 | + var errorStateCount = 0; |
8409 | 8411 | var hasData = false; |
8410 | 8412 | $j.each( _this.uploads, function( i, upload ) { |
8411 | | - if ( $j.inArray( upload.state, _this.endStates ) !== -1 ) { |
8412 | | - endStateCount++; |
| 8413 | + if ( $j.inArray( upload.state, _this.successStates ) !== -1 ) { |
| 8414 | + successStateCount++; |
8413 | 8415 | } |
| 8416 | + if ( $j.inArray( upload.state, _this.errorStates ) !== -1 ) { |
| 8417 | + errorStateCount++; |
| 8418 | + } |
8414 | 8419 | if (upload[_this.progressProperty] !== undefined) { |
8415 | 8420 | fraction += upload[_this.progressProperty] * ( upload[_this.weightProperty] / totalWeight ); |
8416 | 8421 | if (upload[_this.progressProperty] > 0 ) { |
— | — | @@ -8417,7 +8422,7 @@ |
8418 | 8423 | } |
8419 | 8424 | } |
8420 | 8425 | } ); |
8421 | | - //mw.log( 'hasdata:' + hasData + ' endstatecount:' + endStateCount ); |
| 8426 | + |
8422 | 8427 | // sometimes, the first data we have just tells us that it's over. So only show the bar |
8423 | 8428 | // if we have good data AND the fraction is less than 1. |
8424 | 8429 | if ( hasData && fraction < 1.0 ) { |
— | — | @@ -8427,14 +8432,13 @@ |
8428 | 8433 | } |
8429 | 8434 | _this.showProgress( fraction ); |
8430 | 8435 | } |
8431 | | - _this.showCount( endStateCount ); |
| 8436 | + _this.showCount( successStateCount ); |
8432 | 8437 | |
8433 | | - if ( endStateCount < _this.uploads.length ) { |
| 8438 | + if ( successStateCount + errorStateCount < _this.uploads.length ) { |
8434 | 8439 | setTimeout( displayer, 200 ); |
8435 | 8440 | } else { |
8436 | 8441 | _this.showProgress( 1.0 ); |
8437 | | - // not necessary to hide bar since we're going to the next step. |
8438 | | - /* setTimeout( function() { _this.hideBar(); }, 500 ); */ |
| 8442 | + setTimeout( function() { _this.hideBar(); }, 500 ); |
8439 | 8443 | } |
8440 | 8444 | }; |
8441 | 8445 | displayer(); |
— | — | @@ -10994,8 +10998,9 @@ |
10995 | 10999 | |
10996 | 11000 | var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress', |
10997 | 11001 | gM( 'mwe-upwiz-uploading' ), |
10998 | | - _this.uploads, |
10999 | | - [ 'stashed' ], |
| 11002 | + _this.uploads, |
| 11003 | + [ 'stashed' ], |
| 11004 | + [ 'error' ], |
11000 | 11005 | 'transportProgress', |
11001 | 11006 | 'transportWeight' ); |
11002 | 11007 | progressBar.start(); |
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -1878,8 +1878,9 @@ |
1879 | 1879 | |
1880 | 1880 | var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress', |
1881 | 1881 | gM( 'mwe-upwiz-uploading' ), |
1882 | | - _this.uploads, |
1883 | | - [ 'stashed' ], |
| 1882 | + _this.uploads, |
| 1883 | + [ 'stashed' ], |
| 1884 | + [ 'error' ], |
1884 | 1885 | 'transportProgress', |
1885 | 1886 | 'transportWeight' ); |
1886 | 1887 | progressBar.start(); |
Index: trunk/extensions/UploadWizard/resources/combined.min.js |
— | — | @@ -8352,7 +8352,7 @@ |
8353 | 8353 | |
8354 | 8354 | |
8355 | 8355 | |
8356 | | -mw.GroupProgressBar=function(selector,text,uploads,endStates,progressProperty,weightProperty){ |
| 8356 | +mw.GroupProgressBar=function(selector,text,uploads,successStates,errorStates,progressProperty,weightProperty){ |
8357 | 8357 | var _this=this; |
8358 | 8358 | |
8359 | 8359 | |
— | — | @@ -8372,7 +8372,8 @@ |
8373 | 8373 | _this.$selector.find('.mwe-upwiz-progress-bar').progressbar({value:0}); |
8374 | 8374 | |
8375 | 8375 | _this.uploads=uploads; |
8376 | | -_this.endStates=endStates; |
| 8376 | +_this.successStates=successStates; |
| 8377 | +_this.errorStates=errorStates; |
8377 | 8378 | _this.progressProperty=progressProperty; |
8378 | 8379 | _this.weightProperty=weightProperty; |
8379 | 8380 | _this.beginTime=undefined; |
— | — | @@ -8404,12 +8405,16 @@ |
8405 | 8406 | |
8406 | 8407 | var displayer=function(){ |
8407 | 8408 | var fraction=0.0; |
8408 | | -var endStateCount=0; |
| 8409 | +var successStateCount=0; |
| 8410 | +var errorStateCount=0; |
8409 | 8411 | var hasData=false; |
8410 | 8412 | $j.each(_this.uploads,function(i,upload){ |
8411 | | -if($j.inArray(upload.state,_this.endStates)!==-1){ |
8412 | | -endStateCount++; |
| 8413 | +if($j.inArray(upload.state,_this.successStates)!==-1){ |
| 8414 | +successStateCount++; |
8413 | 8415 | } |
| 8416 | +if($j.inArray(upload.state,_this.errorStates)!==-1){ |
| 8417 | +errorStateCount++; |
| 8418 | +} |
8414 | 8419 | if(upload[_this.progressProperty]!==undefined){ |
8415 | 8420 | fraction+=upload[_this.progressProperty]*(upload[_this.weightProperty]/totalWeight); |
8416 | 8421 | if(upload[_this.progressProperty]>0){ |
— | — | @@ -8427,14 +8432,13 @@ |
8428 | 8433 | } |
8429 | 8434 | _this.showProgress(fraction); |
8430 | 8435 | } |
8431 | | -_this.showCount(endStateCount); |
| 8436 | +_this.showCount(successStateCount); |
8432 | 8437 | |
8433 | | -if(endStateCount<_this.uploads.length){ |
| 8438 | +if(successStateCount+errorStateCount<_this.uploads.length){ |
8434 | 8439 | setTimeout(displayer,200); |
8435 | 8440 | }else{ |
8436 | 8441 | _this.showProgress(1.0); |
8437 | | - |
8438 | | - |
| 8442 | +setTimeout(function(){_this.hideBar();},500); |
8439 | 8443 | } |
8440 | 8444 | }; |
8441 | 8445 | displayer(); |
— | — | @@ -10996,6 +11000,7 @@ |
10997 | 11001 | gM('mwe-upwiz-uploading'), |
10998 | 11002 | _this.uploads, |
10999 | 11003 | ['stashed'], |
| 11004 | +['error'], |
11000 | 11005 | 'transportProgress', |
11001 | 11006 | 'transportWeight'); |
11002 | 11007 | progressBar.start(); |