Show files remaining in library in sync button tooltip
This commit is contained in:
parent
0df967418b
commit
4c13d51f24
3 changed files with 31 additions and 3 deletions
|
@ -34,6 +34,7 @@ if (!Zotero.Sync.Storage) {
|
|||
* @param {Object} options
|
||||
* @param {Integer} options.libraryID
|
||||
* @param {Object} options.controller - Storage controller instance (ZFS_Controller/WebDAV_Controller)
|
||||
* @param {Function} [onProgress] - Function to run when a request finishes: f(progress, progressMax)
|
||||
* @param {Function} [onError] - Function to run on error
|
||||
* @param {Boolean} [stopOnError]
|
||||
*/
|
||||
|
@ -52,11 +53,15 @@ Zotero.Sync.Storage.Engine = function (options) {
|
|||
this.library = Zotero.Libraries.get(options.libraryID);
|
||||
this.controller = options.controller;
|
||||
|
||||
this.numRequests = 0;
|
||||
this.requestsRemaining = 0;
|
||||
|
||||
this.local = Zotero.Sync.Storage.Local;
|
||||
this.utils = Zotero.Sync.Storage.Utilities;
|
||||
|
||||
this.setStatus = options.setStatus || function () {};
|
||||
this.onError = options.onError || function (e) {};
|
||||
this.onProgress = options.onProgress || function (progress, progressMax) {};
|
||||
this.stopOnError = options.stopOnError || false;
|
||||
|
||||
this.queues = [];
|
||||
|
@ -136,6 +141,7 @@ Zotero.Sync.Storage.Engine.prototype.start = Zotero.Promise.coroutine(function*
|
|||
}
|
||||
|
||||
var filesEditable = Zotero.Libraries.get(libraryID).filesEditable;
|
||||
this.requestsRemaining = 0;
|
||||
|
||||
// Check for updated files to upload
|
||||
if (!filesEditable) {
|
||||
|
@ -322,8 +328,13 @@ Zotero.Sync.Storage.Engine.prototype.queueItem = Zotero.Promise.coroutine(functi
|
|||
libraryID: this.libraryID,
|
||||
name: item.libraryKey,
|
||||
onStart: request => this.controller[fn](request),
|
||||
onProgress: this.onProgress
|
||||
onStop: () => {
|
||||
this.requestsRemaining--;
|
||||
this.onProgress(this.numRequests - this.requestsRemaining, this.numRequests);
|
||||
}
|
||||
});
|
||||
return request.start();
|
||||
});
|
||||
this.numRequests++;
|
||||
this.requestsRemaining++;
|
||||
})
|
||||
|
|
|
@ -609,12 +609,27 @@ Zotero.Sync.Runner_Module = function (options = {}) {
|
|||
*/
|
||||
var _doFileSync = Zotero.Promise.coroutine(function* (libraries, options) {
|
||||
Zotero.debug("Starting file syncing");
|
||||
this.setSyncStatus(Zotero.getString('sync.status.syncingFiles'));
|
||||
var resyncLibraries = []
|
||||
for (let libraryID of libraries) {
|
||||
_stopCheck();
|
||||
this.setSyncStatus(
|
||||
Zotero.getString(
|
||||
'sync.status.syncingFilesInLibrary', Zotero.Libraries.get(libraryID).name
|
||||
)
|
||||
);
|
||||
try {
|
||||
let opts = {};
|
||||
let opts = {
|
||||
onProgress: (progress, progressMax) => {
|
||||
var remaining = progressMax - progress;
|
||||
this.setSyncStatus(
|
||||
Zotero.getString(
|
||||
'sync.status.syncingFilesInLibraryWithRemaining',
|
||||
[Zotero.Libraries.get(libraryID).name, remaining],
|
||||
remaining
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
Object.assign(opts, options);
|
||||
opts.libraryID = libraryID;
|
||||
|
||||
|
|
|
@ -967,6 +967,8 @@ sync.status.processingUpdatedData = Processing updated data from sync server
|
|||
sync.status.uploadingData = Uploading data to sync server
|
||||
sync.status.uploadAccepted = Upload accepted \u2014 waiting for sync server
|
||||
sync.status.syncingFiles = Syncing files
|
||||
sync.status.syncingFilesInLibrary = Syncing files in %S
|
||||
sync.status.syncingFilesInLibraryWithRemaining = Syncing files in %1$S (%2$S remaining);Syncing files in %1$S (%2$S remaining)
|
||||
sync.status.syncingFullText = Syncing full-text content
|
||||
|
||||
sync.storage.mbRemaining = %SMB remaining
|
||||
|
|
Loading…
Add table
Reference in a new issue