mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
4562b06a60
commit
0e1013a570
@ -530,15 +530,15 @@ RED.palette.editor = (function() {
|
||||
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
||||
removeButton.click(function(evt) {
|
||||
evt.preventDefault();
|
||||
shade.show();
|
||||
removeNodeModule(entry.name, function(xhr) {
|
||||
shade.hide();
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.removeFailed',{module: entry.name,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$("#palette-module-install-confirm").data('module',entry.name);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
$("#palette-module-install-confirm-body").html(RED._("palette.editor.confirm.remove.body"));
|
||||
$(".palette-module-install-confirm-button-install").hide();
|
||||
$(".palette-module-install-confirm-button-remove").show();
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title', RED._("palette.editor.confirm.remove.title"))
|
||||
.dialog('open');
|
||||
})
|
||||
if (!entry.local) {
|
||||
removeButton.hide();
|
||||
@ -726,13 +726,15 @@ RED.palette.editor = (function() {
|
||||
installButton.click(function(e) {
|
||||
e.preventDefault();
|
||||
if (!$(this).hasClass('disabled')) {
|
||||
installNodeModule(entry.id,shade,function(xhr) {
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
})
|
||||
$("#palette-module-install-confirm").data('module',entry.id);
|
||||
$("#palette-module-install-confirm").data('url',entry.url);
|
||||
$("#palette-module-install-confirm").data('shade',shade);
|
||||
$("#palette-module-install-confirm-body").html(RED._("palette.editor.confirm.install.body"));
|
||||
$(".palette-module-install-confirm-button-install").show();
|
||||
$(".palette-module-install-confirm-button-remove").hide();
|
||||
$("#palette-module-install-confirm")
|
||||
.dialog('option', 'title', RED._("palette.editor.confirm.install.title"))
|
||||
.dialog('open');
|
||||
}
|
||||
})
|
||||
if (nodeEntries.hasOwnProperty(entry.id)) {
|
||||
@ -751,6 +753,66 @@ RED.palette.editor = (function() {
|
||||
|
||||
$('<div id="palette-module-install-shade" class="palette-module-shade hide"><div class="palette-module-shade-status"></div><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(installTab);
|
||||
|
||||
$('<div id="palette-module-install-confirm" class="hide"><form class="form-horizontal"><div id="palette-module-install-confirm-body" class="node-dialog-confirm-row"></div></form></div>').appendTo(document.body);
|
||||
$("#palette-module-install-confirm").dialog({
|
||||
title: RED._('palette.editor.confirm.title'),
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
width: 550,
|
||||
height: "auto",
|
||||
buttons: [
|
||||
{
|
||||
text: RED._("common.label.cancel"),
|
||||
click: function() {
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.review"),
|
||||
class: "primary palette-module-install-confirm-button-install",
|
||||
click: function() {
|
||||
var url = $(this).data('url');
|
||||
window.open(url);
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.install"),
|
||||
class: "primary palette-module-install-confirm-button-install",
|
||||
click: function() {
|
||||
var id = $(this).data('module');
|
||||
var shade = $(this).data('shade');
|
||||
installNodeModule(id,shade,function(xhr) {
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.installFailed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
});
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
},
|
||||
{
|
||||
text: RED._("palette.editor.confirm.button.remove"),
|
||||
class: "primary palette-module-install-confirm-button-remove",
|
||||
click: function() {
|
||||
var id = $(this).data('module');
|
||||
var shade = $(this).data('shade');
|
||||
shade.show();
|
||||
removeNodeModule(id, function(xhr) {
|
||||
shade.hide();
|
||||
if (xhr) {
|
||||
if (xhr.responseJSON) {
|
||||
RED.notify(RED._('palette.editor.errors.removeFailed',{module: id,message:xhr.responseJSON.message}));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
$( this ).dialog( "close" );
|
||||
}
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
RED.events.on('registry:node-set-enabled', function(ns) {
|
||||
refreshNodeModule(ns.module);
|
||||
});
|
||||
|
@ -293,6 +293,21 @@
|
||||
"catalogLoadFailed": "Failed to load node catalogue.<br>Check the browser console for more information",
|
||||
"installFailed": "Failed to install: __module__<br>__message__<br>Check the log for more information",
|
||||
"removeFailed": "Failed to remove: __module__<br>__message__<br>Check the log for more information"
|
||||
},
|
||||
"confirm": {
|
||||
"install": {
|
||||
"body":"Before installing, please read the node's documentation. Some nodes have dependencies that cannot be automatically resolved and can require a restart of Node-RED. ",
|
||||
"title": "Install nodes"
|
||||
},
|
||||
"remove": {
|
||||
"body":"Removing the node will uninstall it from Node-RED. The node may continue to use resources until Node-RED is restarted.",
|
||||
"title": "Remove nodes"
|
||||
},
|
||||
"button": {
|
||||
"review": "Open node information",
|
||||
"install": "Install",
|
||||
"remove": "Remove"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user