Add spinner + fix typos

This commit is contained in:
GogoVega 2024-10-27 23:08:19 +01:00
parent 8255e62f31
commit 36e313c9ee
No known key found for this signature in database
GPG Key ID: E1E048B63AC5AC2B

View File

@ -1534,21 +1534,18 @@ RED.palette.editor = (function() {
const installModule = function (module) { const installModule = function (module) {
const [moduleName, moduleVersion] = module; const [moduleName, moduleVersion] = module;
const msg = RED.notify(RED._("palette.editor.installing", { module: moduleName })); const spinner = '<div style="text-align: center; height: 100%; padding-top: 20px;"><img src="red/images/spin.svg" style="width: 60px;"/></div>';
const msg = "<p>" + RED._("palette.editor.installing", { module: moduleName }) + "</p>" + spinner;
if (!notification) { if (!notification) {
notification = RED.notify(msg, notificationOptions); notification = RED.notify(msg, notificationOptions);
} else { } else {
notification.update(msg); notification.update(msg, notificationOptions);
} }
// TODO: add spinner to a div below the title
//const spinner = RED.utils.addSpinnerOverlay(container, true);
RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install") + " : " + moduleName + " " + moduleVersion); RED.eventLog.startEvent(RED._("palette.editor.confirm.button.install") + " : " + moduleName + " " + moduleVersion);
installNodeModule(moduleName, moduleVersion, undefined, function(xhr, textStatus, err) { installNodeModule(moduleName, moduleVersion, undefined, function(xhr, textStatus, err) {
//spinner.close();
if (err && xhr.status === 504) { if (err && xhr.status === 504) {
notification.update(RED._("palette.editor.errors.installTimeout"), { notification.update(RED._("palette.editor.errors.installTimeout"), {
modal: true, modal: true,
@ -1568,7 +1565,7 @@ RED.palette.editor = (function() {
if (moduleArray.length) { if (moduleArray.length) {
installModule(moduleArray.shift()); installModule(moduleArray.shift());
} else { } else {
notification.update(RED._("palette.editor.successfulInstall"), { ...notificationOptions, type: "success", timeout: 1000 }); notification.update(RED._("palette.editor.successfulInstall"), { ...notificationOptions, type: "success", timeout: 10000 });
} }
} }
}); });