Add more steps to the loading progress bar

pull/1/head
yflory 4 years ago committed by ansuz
parent a9e2ebc72a
commit c4aa9ff8dc

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

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

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

Loading…
Cancel
Save