mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Don't hide install button on already-installed node modules
This commit is contained in:
parent
9af08ef26a
commit
f2d36b84b5
@ -456,7 +456,8 @@ RED.palette.editor = (function() {
|
|||||||
var setCount = $('<span>').appendTo(setButton);
|
var setCount = $('<span>').appendTo(setButton);
|
||||||
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
var buttonGroup = $('<div>',{class:"palette-module-button-group"}).appendTo(buttonRow);
|
||||||
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
var removeButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.remove')).appendTo(buttonGroup);
|
||||||
removeButton.click(function() {
|
removeButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
shade.show();
|
shade.show();
|
||||||
removeNodeModule(entry.name, function(xhr) {
|
removeNodeModule(entry.name, function(xhr) {
|
||||||
console.log(xhr);
|
console.log(xhr);
|
||||||
@ -478,7 +479,8 @@ RED.palette.editor = (function() {
|
|||||||
shade: shade,
|
shade: shade,
|
||||||
sets: {}
|
sets: {}
|
||||||
}
|
}
|
||||||
setButton.click(function() {
|
setButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
if (container.hasClass('expanded')) {
|
if (container.hasClass('expanded')) {
|
||||||
container.removeClass('expanded');
|
container.removeClass('expanded');
|
||||||
contentRow.slideUp();
|
contentRow.slideUp();
|
||||||
@ -505,6 +507,7 @@ RED.palette.editor = (function() {
|
|||||||
|
|
||||||
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
|
var enableButton = $('<a href="#" class="editor-button editor-button-small"></a>').appendTo(buttonGroup);
|
||||||
enableButton.click(function(evt) {
|
enableButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
if (object.setUseCount[setName] === 0) {
|
if (object.setUseCount[setName] === 0) {
|
||||||
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
var currentSet = RED.nodes.registry.getNodeSet(set.id);
|
||||||
shade.show();
|
shade.show();
|
||||||
@ -512,7 +515,6 @@ RED.palette.editor = (function() {
|
|||||||
console.log(xhr)
|
console.log(xhr)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
evt.preventDefault();
|
|
||||||
})
|
})
|
||||||
|
|
||||||
object.elements.sets[set.name] = {
|
object.elements.sets[set.name] = {
|
||||||
@ -522,12 +524,12 @@ RED.palette.editor = (function() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
enableButton.click(function(evt) {
|
enableButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
if (object.totalUseCount === 0) {
|
if (object.totalUseCount === 0) {
|
||||||
changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){
|
changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){
|
||||||
console.log(xhr)
|
console.log(xhr)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
evt.preventDefault();
|
|
||||||
})
|
})
|
||||||
refreshNodeModule(entry.name);
|
refreshNodeModule(entry.name);
|
||||||
} else {
|
} else {
|
||||||
@ -644,16 +646,19 @@ RED.palette.editor = (function() {
|
|||||||
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.install')).appendTo(buttonGroup);
|
var installButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.install')).appendTo(buttonGroup);
|
||||||
installButton.click(function(e) {
|
installButton.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
installNodeModule(entry.id,shade,function(xhr) {
|
if (!$(this).hasClass('disabled')) {
|
||||||
if (xhr) {
|
installNodeModule(entry.id,shade,function(xhr) {
|
||||||
if (xhr.responseJSON) {
|
if (xhr) {
|
||||||
RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}));
|
if (xhr.responseJSON) {
|
||||||
|
RED.notify(RED._('palette.editor.errors.installFailed',{module: entry.id,message:xhr.responseJSON.message}));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
if (nodeEntries.hasOwnProperty(entry.id)) {
|
if (nodeEntries.hasOwnProperty(entry.id)) {
|
||||||
installButton.hide();
|
installButton.addClass('disabled');
|
||||||
|
installButton.html(RED._('palette.editor.installed'));
|
||||||
}
|
}
|
||||||
|
|
||||||
object.elements = {
|
object.elements = {
|
||||||
|
@ -256,6 +256,7 @@
|
|||||||
"disable": "disable",
|
"disable": "disable",
|
||||||
"remove": "remove",
|
"remove": "remove",
|
||||||
"install": "install",
|
"install": "install",
|
||||||
|
"installed": "installed",
|
||||||
"loading": "Loading catalogues...",
|
"loading": "Loading catalogues...",
|
||||||
"tab-nodes": "Nodes",
|
"tab-nodes": "Nodes",
|
||||||
"tab-install": "Install",
|
"tab-install": "Install",
|
||||||
|
Loading…
Reference in New Issue
Block a user