mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Don't hide install button on already-installed node modules
This commit is contained in:
		| @@ -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,6 +646,7 @@ 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(); | ||||||
|  |                        if (!$(this).hasClass('disabled')) { | ||||||
|                            installNodeModule(entry.id,shade,function(xhr) { |                            installNodeModule(entry.id,shade,function(xhr) { | ||||||
|                                if (xhr) { |                                if (xhr) { | ||||||
|                                    if (xhr.responseJSON) { |                                    if (xhr.responseJSON) { | ||||||
| @@ -651,9 +654,11 @@ RED.palette.editor = (function() { | |||||||
|                                    } |                                    } | ||||||
|                                } |                                } | ||||||
|                            }) |                            }) | ||||||
|  |                        } | ||||||
|                    }) |                    }) | ||||||
|                    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", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user