mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add work-in-progress update button to palette-editor
This commit is contained in:
parent
5f0cab8cc2
commit
fc9835512d
@ -24,6 +24,7 @@ RED.palette.editor = (function() {
|
|||||||
var packageList;
|
var packageList;
|
||||||
var loadedList = [];
|
var loadedList = [];
|
||||||
var filteredList = [];
|
var filteredList = [];
|
||||||
|
var loadedIndex = {};
|
||||||
|
|
||||||
var typesInUse = {};
|
var typesInUse = {};
|
||||||
var nodeEntries = {};
|
var nodeEntries = {};
|
||||||
@ -90,6 +91,15 @@ RED.palette.editor = (function() {
|
|||||||
callback(xhr);
|
callback(xhr);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refreshNodeModuleList() {
|
||||||
|
for (var id in nodeEntries) {
|
||||||
|
if (nodeEntries.hasOwnProperty(id)) {
|
||||||
|
_refreshNodeModule(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function refreshNodeModule(module) {
|
function refreshNodeModule(module) {
|
||||||
if (!eventTimers.hasOwnProperty(module)) {
|
if (!eventTimers.hasOwnProperty(module)) {
|
||||||
eventTimers[module] = setTimeout(function() {
|
eventTimers[module] = setTimeout(function() {
|
||||||
@ -254,6 +264,19 @@ RED.palette.editor = (function() {
|
|||||||
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
nodeEntry.container.toggleClass("disabled",(activeTypeCount === 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodeEntry.updateButton.hide();
|
||||||
|
// if (loadedIndex.hasOwnProperty(module)) {
|
||||||
|
// if (moduleInfo.version !== loadedIndex[module].version) {
|
||||||
|
// nodeEntry.updateButton.show();
|
||||||
|
// nodeEntry.updateButton.html(RED._('palette.editor.update',{version:loadedIndex[module].version}));
|
||||||
|
// } else {
|
||||||
|
// nodeEntry.updateButton.hide();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// } else {
|
||||||
|
// nodeEntry.updateButton.hide();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -264,19 +287,25 @@ RED.palette.editor = (function() {
|
|||||||
if (disabled) {
|
if (disabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
initInstallTab();
|
initInstallTab();
|
||||||
$("#header-shade").show();
|
$("#header-shade").show();
|
||||||
$("#editor-shade").show();
|
$("#editor-shade").show();
|
||||||
$("#sidebar-shade").show();
|
$("#sidebar-shade").show();
|
||||||
$("#sidebar-separator").hide();
|
$("#sidebar-separator").hide();
|
||||||
|
|
||||||
|
editorTabs.activateTab('nodes');
|
||||||
|
|
||||||
$("#main-container").addClass("palette-expanded");
|
$("#main-container").addClass("palette-expanded");
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
editorTabs.resize();
|
editorTabs.resize();
|
||||||
|
filterInput.focus();
|
||||||
},250);
|
},250);
|
||||||
RED.events.emit("palette-editor:open");
|
RED.events.emit("palette-editor:open");
|
||||||
|
RED.keyboard.add("*",/* ESCAPE */ 27,function(){hidePaletteEditor();d3.event.preventDefault();});
|
||||||
}
|
}
|
||||||
function hidePaletteEditor() {
|
function hidePaletteEditor() {
|
||||||
|
RED.keyboard.remove("*");
|
||||||
$("#main-container").removeClass("palette-expanded");
|
$("#main-container").removeClass("palette-expanded");
|
||||||
$("#header-shade").hide();
|
$("#header-shade").hide();
|
||||||
$("#editor-shade").hide();
|
$("#editor-shade").hide();
|
||||||
@ -314,6 +343,7 @@ RED.palette.editor = (function() {
|
|||||||
catalogueLoadStatus.push(v);
|
catalogueLoadStatus.push(v);
|
||||||
if (v.modules) {
|
if (v.modules) {
|
||||||
v.modules.forEach(function(m) {
|
v.modules.forEach(function(m) {
|
||||||
|
loadedIndex[m.id] = m;
|
||||||
m.index = [m.id];
|
m.index = [m.id];
|
||||||
if (m.keywords) {
|
if (m.keywords) {
|
||||||
m.index = m.index.concat(m.keywords);
|
m.index = m.index.concat(m.keywords);
|
||||||
@ -342,6 +372,7 @@ RED.palette.editor = (function() {
|
|||||||
function initInstallTab() {
|
function initInstallTab() {
|
||||||
if (loadedList.length === 0) {
|
if (loadedList.length === 0) {
|
||||||
loadedList = [];
|
loadedList = [];
|
||||||
|
loadedIndex = {};
|
||||||
packageList.editableList('empty');
|
packageList.editableList('empty');
|
||||||
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
$(".palette-module-shade-status").html(RED._('palette.editor.loading'));
|
||||||
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
var catalogues = RED.settings.theme('palette.catalogues')||['https://catalogue.nodered.org/catalogue.json'];
|
||||||
@ -355,6 +386,7 @@ RED.palette.editor = (function() {
|
|||||||
catalogues.forEach(function(catalog,index) {
|
catalogues.forEach(function(catalog,index) {
|
||||||
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
$.getJSON(catalog, {_: new Date().getTime()},function(v) {
|
||||||
handleCatalogResponse(catalog,index,v);
|
handleCatalogResponse(catalog,index,v);
|
||||||
|
refreshNodeModuleList();
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -472,6 +504,13 @@ RED.palette.editor = (function() {
|
|||||||
var setButton = $('<a href="#" class="editor-button editor-button-small palette-module-set-button"><i class="fa fa-angle-right palette-module-node-chevron"></i> </a>').appendTo(buttonRow);
|
var setButton = $('<a href="#" class="editor-button editor-button-small palette-module-set-button"><i class="fa fa-angle-right palette-module-node-chevron"></i> </a>').appendTo(buttonRow);
|
||||||
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 updateButton = $('<a href="#" class="editor-button editor-button-small"></a>').html(RED._('palette.editor.update')).appendTo(buttonGroup);
|
||||||
|
updateButton.click(function(evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
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(evt) {
|
removeButton.click(function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
@ -489,6 +528,7 @@ RED.palette.editor = (function() {
|
|||||||
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
var shade = $('<div class="palette-module-shade hide"><img src="red/images/spin.svg" class="palette-spinner"/></div>').appendTo(container);
|
||||||
|
|
||||||
object.elements = {
|
object.elements = {
|
||||||
|
updateButton: updateButton,
|
||||||
removeButton: removeButton,
|
removeButton: removeButton,
|
||||||
enableButton: enableButton,
|
enableButton: enableButton,
|
||||||
setCount: setCount,
|
setCount: setCount,
|
||||||
@ -621,6 +661,7 @@ RED.palette.editor = (function() {
|
|||||||
refreshButton.click(function(e) {
|
refreshButton.click(function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
loadedList = [];
|
loadedList = [];
|
||||||
|
loadedIndex = {};
|
||||||
initInstallTab();
|
initInstallTab();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -256,6 +256,7 @@
|
|||||||
"enable": "enable",
|
"enable": "enable",
|
||||||
"disable": "disable",
|
"disable": "disable",
|
||||||
"remove": "remove",
|
"remove": "remove",
|
||||||
|
"update": "update to __version__",
|
||||||
"install": "install",
|
"install": "install",
|
||||||
"installed": "installed",
|
"installed": "installed",
|
||||||
"loading": "Loading catalogues...",
|
"loading": "Loading catalogues...",
|
||||||
|
Loading…
Reference in New Issue
Block a user