Add more steps to the loading progress bar

pull/1/head
yflory 4 years ago
parent 20f3263429
commit 6bdebad352

@ -294,6 +294,7 @@ button.primary:hover{
'<p id="cp-loading-message"></p>',
'</div>'
].join('');
var built = false;
// XXX
var types = ['less', 'drive', 'migrate', 'sf', 'team', 'pad'];
@ -334,18 +335,25 @@ button.primary:hover{
};
var updateLoadingProgress = function (data) {
if (!built) { return; }
var c = types.indexOf(data.type);
if (c < current) { return console.error(data); }
try {
document.querySelector('.cp-loading-progress-list').innerHTML = makeList(data);
document.querySelector('.cp-loading-progress-container').innerHTML = makeBar(data);
} catch (e) { console.error(e); }
};
window.CryptPad_updateLoadingProgress = updateLoadingProgress;
window.CryptPad_loadingError = function (err) {
if (!built) { return; }
try {
document.querySelector('.cp-loading-spinner-container').setAttribute('style', 'display:none;');
document.querySelector('#cp-loading-message').setAttribute('style', 'display:block;');
document.querySelector('#cp-loading-message').innerText = err;
} catch (e) { console.error(e); }
};
return function () {
built = true;
var intr;
var append = function () {
if (!document.body) { return; }

@ -2488,6 +2488,10 @@ define([
}).nThen(function (waitFor) {
initAnonRpc(null, null, waitFor());
initRpc(null, null, waitFor());
postMessage(clientId, 'LOADING_DRIVE', {
type: 'migrate',
progress: 0
});
}).nThen(function (waitFor) {
Migrate(proxy, waitFor(), function (version, progress) {
postMessage(clientId, 'LOADING_DRIVE', {
@ -2496,6 +2500,10 @@ define([
});
}, store);
}).nThen(function (waitFor) {
postMessage(clientId, 'LOADING_DRIVE', {
type: 'sf',
progress: 0
});
userObject.fixFiles();
SF.loadSharedFolders(Store, store.network, store, userObject, waitFor, function (obj) {
var data = {

@ -619,6 +619,13 @@ define([
}
window.CryptPad_sframe_common = true;
if (window.CryptPad_updateLoadingProgress) {
window.CryptPad_updateLoadingProgress({
type: 'drive',
progress: 0
});
}
nThen(function (waitFor) {
var msgEv = Util.mkEvent();
var iframe = window.parent;

Loading…
Cancel
Save