1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Show node load errors in the palette manager

This commit is contained in:
Nick O'Leary 2018-05-10 11:21:59 +01:00
parent 7584820987
commit 08727e1938
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 38 additions and 3 deletions

View File

@ -208,6 +208,8 @@ RED.palette.editor = (function() {
if (nodeEntry) { if (nodeEntry) {
var activeTypeCount = 0; var activeTypeCount = 0;
var typeCount = 0; var typeCount = 0;
var errorCount = 0;
nodeEntry.errorList.empty();
nodeEntries[module].totalUseCount = 0; nodeEntries[module].totalUseCount = 0;
nodeEntries[module].setUseCount = {}; nodeEntries[module].setUseCount = {};
@ -216,7 +218,10 @@ RED.palette.editor = (function() {
var inUseCount = 0; var inUseCount = 0;
var set = moduleInfo.sets[setName]; var set = moduleInfo.sets[setName];
var setElements = nodeEntry.sets[setName]; var setElements = nodeEntry.sets[setName];
if (set.err) {
errorCount++;
$("<li>").text(set.err).appendTo(nodeEntry.errorList);
}
if (set.enabled) { if (set.enabled) {
activeTypeCount += set.types.length; activeTypeCount += set.types.length;
} }
@ -255,6 +260,13 @@ RED.palette.editor = (function() {
setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled); setElements.setRow.toggleClass("palette-module-set-disabled",!set.enabled);
} }
} }
if (errorCount === 0) {
nodeEntry.errorRow.hide()
} else {
nodeEntry.errorRow.show();
}
var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount; var nodeCount = (activeTypeCount === typeCount)?typeCount:activeTypeCount+" / "+typeCount;
nodeEntry.setCount.html(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount})); nodeEntry.setCount.html(RED._('palette.editor.nodeCount',{count:typeCount,label:nodeCount}));
@ -586,6 +598,9 @@ RED.palette.editor = (function() {
$('<span>').html(entry.name).appendTo(titleRow); $('<span>').html(entry.name).appendTo(titleRow);
var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow); var metaRow = $('<div class="palette-module-meta palette-module-version"><i class="fa fa-tag"></i></div>').appendTo(headerRow);
var versionSpan = $('<span>').html(entry.version).appendTo(metaRow); var versionSpan = $('<span>').html(entry.version).appendTo(metaRow);
var errorRow = $('<div class="palette-module-meta palette-module-errors"><i class="fa fa-warning"></i></div>').hide().appendTo(headerRow);
var errorList = $('<ul class="palette-module-error-list"></ul>').appendTo(errorRow);
var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow); var buttonRow = $('<div>',{class:"palette-module-meta"}).appendTo(headerRow);
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);
@ -620,6 +635,8 @@ RED.palette.editor = (function() {
updateButton: updateButton, updateButton: updateButton,
removeButton: removeButton, removeButton: removeButton,
enableButton: enableButton, enableButton: enableButton,
errorRow: errorRow,
errorList: errorList,
setCount: setCount, setCount: setCount,
container: container, container: container,
shade: shade, shade: shade,
@ -651,7 +668,6 @@ RED.palette.editor = (function() {
typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv); typeSwatches[t] = $('<span>',{class:"palette-module-type-swatch"}).appendTo(typeDiv);
$('<span>',{class:"palette-module-type-node"}).html(t).appendTo(typeDiv); $('<span>',{class:"palette-module-type-node"}).html(t).appendTo(typeDiv);
}) })
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(); evt.preventDefault();

View File

@ -49,7 +49,12 @@
.palette-module-version { .palette-module-version {
color: #aaa; color: #aaa;
} }
.palette-module-errors .fa-warning {
opacity: 0.5;
}
ul.palette-module-error-list li {
color: #aaa;
}
} }
@ -222,6 +227,20 @@
margin-left: 5px; margin-left: 5px;
} }
} }
.palette-module-meta .fa-warning {
color: #AD1625;
}
ul.palette-module-error-list {
display: inline-block;
list-style-type: none;
margin: 0;
font-size: 0.9em;
li {
border: none;
background: none;
}
}
.palette-module-shade { .palette-module-shade {
@include shade; @include shade;
text-align: center; text-align: center;