Skip to content

Commit

Permalink
Add a overall files count and uploaded chunk function
Browse files Browse the repository at this point in the history
I am the maintainer of the Flowupload app for Nextcloud which uses ng-flow extensively. Recently @TessyPowder added two functions to ng-flow which adds a counter for all files and a function to count already uploaded chunks. I would like to bring these changes to upstream so other projects can use them as well and so they are in the right place.

The original PR on my repository can be found here:

e-alfred/flowupload#57
  • Loading branch information
e-alfred authored May 14, 2019
1 parent f7815f6 commit 0fa10c4
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion dist/ng-flow-standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,16 @@
return ret;
},

/**
* Returns the count of files in the queue
* @function
* @returns {number}
*/
getFilesCount: function () {
var count = this.files.length;
return count;
},

/**
* Returns the total size of all files in bytes.
* @function
Expand Down Expand Up @@ -968,6 +978,22 @@
return this._prevProgress;
},

/**
* Get current number of complete chunks
* @function
* @returns {number} from 0 to chunks.length
*/
completeChunks: function () {
var completeChunks = 0;

each(this.chunks, function (c) {
if(c.progress() === 1){
completeChunks++;
}
});
return completeChunks;
},

/**
* Indicates if file is being uploaded at the moment
* @function
Expand Down Expand Up @@ -1922,4 +1948,4 @@ angular.module('flow.transfers', ['flow.init'])
};
}]);
angular.module('flow', ['flow.provider', 'flow.init', 'flow.events', 'flow.btn',
'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']);
'flow.drop', 'flow.transfers', 'flow.img', 'flow.dragEvents']);

0 comments on commit 0fa10c4

Please sign in to comment.