Add spinner progress to gui.spinner
This commit is contained in:
parent
07df1ed883
commit
394ef0d1e3
|
@ -105,7 +105,7 @@ gui.spinnerCfg = {
|
||||||
top: '50%', // Top position relative to parent
|
top: '50%', // Top position relative to parent
|
||||||
left: '50%' // Left position relative to parent
|
left: '50%' // Left position relative to parent
|
||||||
};
|
};
|
||||||
gui.spinner = function (state, msg) {
|
gui.spinner = function (state, msg, progress) {
|
||||||
'use strict';
|
'use strict';
|
||||||
let target;
|
let target;
|
||||||
let spinner;
|
let spinner;
|
||||||
|
@ -115,19 +115,30 @@ gui.spinner = function (state, msg) {
|
||||||
if (state && !$('#spinner').hasClass('created')) {
|
if (state && !$('#spinner').hasClass('created')) {
|
||||||
target = document.getElementById('spinner');
|
target = document.getElementById('spinner');
|
||||||
spinner = new Spinner(gui.spinnerCfg).spin(target);
|
spinner = new Spinner(gui.spinnerCfg).spin(target);
|
||||||
|
$('#spinnerProgress').hide();
|
||||||
$('#spinner').addClass('created');
|
$('#spinner').addClass('created');
|
||||||
} else if (state) {
|
} else if (state) {
|
||||||
$('#spinner').show();
|
$('#spinner').show();
|
||||||
} else if (!state) {
|
} else if (!state) {
|
||||||
$('#spinner').hide();
|
$('#spinner').hide();
|
||||||
gui.spinnerMsg('');
|
gui.spinnerMsg('');
|
||||||
|
$('#spinnerProgress').hide();
|
||||||
|
}
|
||||||
|
if (progress) {
|
||||||
|
gui.spinnerProgress(progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
gui.spinnerMsg = function (msg) {
|
gui.spinnerMsg = function (msg) {
|
||||||
'use strict';
|
'use strict';
|
||||||
$('#spinnerMsg').text(msg);
|
$('#spinnerMsg').text(msg);
|
||||||
};
|
};
|
||||||
|
gui.spinnerProgress = function (progress) {
|
||||||
|
'use strict';
|
||||||
|
let elem = $('#spinnerProgress .progress-bar');
|
||||||
|
$('#spinnerProgress').show();
|
||||||
|
elem.attr('aria-valuenow', progress);
|
||||||
|
elem.css('width', `${progress}%`);
|
||||||
|
};
|
||||||
gui.overlay = function (state) {
|
gui.overlay = function (state) {
|
||||||
'use strict';
|
'use strict';
|
||||||
if (state) {
|
if (state) {
|
||||||
|
|
Loading…
Reference in New Issue