mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Re-enable jshint on editor and fixup issues
This commit is contained in:
parent
ee6f6ae391
commit
9d4238e5cc
30
Gruntfile.js
30
Gruntfile.js
@ -80,20 +80,20 @@ module.exports = function(grunt) {
|
|||||||
//"loopfunc": true, // allow functions to be defined in loops
|
//"loopfunc": true, // allow functions to be defined in loops
|
||||||
//"sub": true // don't warn that foo['bar'] should be written as foo.bar
|
//"sub": true // don't warn that foo['bar'] should be written as foo.bar
|
||||||
},
|
},
|
||||||
all: [
|
// all: [
|
||||||
'Gruntfile.js',
|
// 'Gruntfile.js',
|
||||||
'red.js',
|
// 'red.js',
|
||||||
'packages/**/*.js'
|
// 'packages/**/*.js'
|
||||||
],
|
// ],
|
||||||
core: {
|
// core: {
|
||||||
files: {
|
// files: {
|
||||||
src: [
|
// src: [
|
||||||
'Gruntfile.js',
|
// 'Gruntfile.js',
|
||||||
'red.js',
|
// 'red.js',
|
||||||
'packages/**/*.js',
|
// 'packages/**/*.js',
|
||||||
]
|
// ]
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
nodes: {
|
nodes: {
|
||||||
files: {
|
files: {
|
||||||
src: [ 'nodes/core/*/*.js' ]
|
src: [ 'nodes/core/*/*.js' ]
|
||||||
@ -101,7 +101,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
editor: {
|
editor: {
|
||||||
files: {
|
files: {
|
||||||
src: [ 'editor/js/**/*.js' ]
|
src: [ 'packages/node_modules/@node-red/editor-client/src/js/**/*.js' ]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tests: {
|
tests: {
|
||||||
|
@ -56,8 +56,9 @@ RED.settings = (function () {
|
|||||||
if (key === "auth-tokens") {
|
if (key === "auth-tokens") {
|
||||||
return JSON.parse(localStorage.getItem(key));
|
return JSON.parse(localStorage.getItem(key));
|
||||||
} else {
|
} else {
|
||||||
|
var v;
|
||||||
try {
|
try {
|
||||||
var v = RED.utils.getMessageProperty(userSettings,key);
|
v = RED.utils.getMessageProperty(userSettings,key);
|
||||||
if (v === undefined) {
|
if (v === undefined) {
|
||||||
v = defaultIfUndefined;
|
v = defaultIfUndefined;
|
||||||
}
|
}
|
||||||
|
@ -410,7 +410,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (container.hasClass("expanded")) {
|
if (container.hasClass("expanded")) {
|
||||||
done && done();
|
if (done) { done() }
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!container.hasClass("built") && (item.deferBuild || typeof item.children === 'function')) {
|
if (!container.hasClass("built") && (item.deferBuild || typeof item.children === 'function')) {
|
||||||
@ -435,7 +435,7 @@
|
|||||||
spinner.remove();
|
spinner.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done && done();
|
if (done) { done() }
|
||||||
that._trigger("childrenloaded",null,item)
|
that._trigger("childrenloaded",null,item)
|
||||||
}
|
}
|
||||||
if (typeof item.children === 'function') {
|
if (typeof item.children === 'function') {
|
||||||
@ -457,7 +457,7 @@
|
|||||||
} else {
|
} else {
|
||||||
item.treeList.childList.slideDown('fast');
|
item.treeList.childList.slideDown('fast');
|
||||||
}
|
}
|
||||||
done && done();
|
if (done) { done() }
|
||||||
}
|
}
|
||||||
container.addClass("expanded");
|
container.addClass("expanded");
|
||||||
}
|
}
|
||||||
|
@ -1029,9 +1029,9 @@ RED.diff = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var localSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-local"}).on("click", function(e) { e.stopPropagation();}).appendTo(localDiv);
|
var localSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-local"}).on("click", function(e) { e.stopPropagation();}).appendTo(localDiv);
|
||||||
var localRadio = $('<input>',{class:"red-ui-diff-selectbox-input",id:safeNodeId+"-local",type:'radio',value:"local",name:safeNodeId,class:className+"-local"}).data('node-id',node.id).on("change", changeHandler).appendTo(localSelectDiv);
|
var localRadio = $('<input>',{class:"red-ui-diff-selectbox-input "+className+"-local",id:safeNodeId+"-local",type:'radio',value:"local",name:safeNodeId}).data('node-id',node.id).on("change", changeHandler).appendTo(localSelectDiv);
|
||||||
var remoteSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-remote"}).on("click", function(e) { e.stopPropagation();}).appendTo(remoteDiv);
|
var remoteSelectDiv = $('<label>',{class:"red-ui-diff-selectbox",for:safeNodeId+"-remote"}).on("click", function(e) { e.stopPropagation();}).appendTo(remoteDiv);
|
||||||
var remoteRadio = $('<input>',{class:"red-ui-diff-selectbox-input",id:safeNodeId+"-remote",type:'radio',value:"remote",name:safeNodeId,class:className+"-remote"}).data('node-id',node.id).on("change", changeHandler).appendTo(remoteSelectDiv);
|
var remoteRadio = $('<input>',{class:"red-ui-diff-selectbox-input "+className+"-remote",id:safeNodeId+"-remote",type:'radio',value:"remote",name:safeNodeId}).data('node-id',node.id).on("change", changeHandler).appendTo(remoteSelectDiv);
|
||||||
if (state === 'local') {
|
if (state === 'local') {
|
||||||
localRadio.prop('checked',true);
|
localRadio.prop('checked',true);
|
||||||
} else if (state === 'remote') {
|
} else if (state === 'remote') {
|
||||||
|
@ -327,10 +327,10 @@
|
|||||||
item.value = valValue;
|
item.value = valValue;
|
||||||
var valClass;
|
var valClass;
|
||||||
switch(valType) {
|
switch(valType) {
|
||||||
case 'str': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "string"; valClass = "red-ui-debug-msg-type-string"; valValue = '"'+valValue+'"'; break;
|
case 'str': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "string"; valClass = "red-ui-debug-msg-type-string"; valValue = '"'+valValue+'"'; break;
|
||||||
case 'num': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "number"; valClass = "red-ui-debug-msg-type-number"; break;
|
case 'num': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "number"; valClass = "red-ui-debug-msg-type-number"; break;
|
||||||
case 'bool': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "boolean"; valClass = "red-ui-debug-msg-type-other"; item.value = (valValue === "true"); break;
|
case 'bool': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "boolean"; valClass = "red-ui-debug-msg-type-other"; item.value = (valValue === "true"); break;
|
||||||
case 'null': item.children && (orphanedChildren = item.children); item.treeList.makeLeaf(true); item.type = "null"; valClass = "red-ui-debug-msg-type-null"; item.value = valValue = "null"; break;
|
case 'null': if (item.children) { orphanedChildren = item.children } item.treeList.makeLeaf(true); item.type = "null"; valClass = "red-ui-debug-msg-type-null"; item.value = valValue = "null"; break;
|
||||||
case 'object':
|
case 'object':
|
||||||
item.treeList.makeParent(orphanedChildren);
|
item.treeList.makeParent(orphanedChildren);
|
||||||
item.type = "object";
|
item.type = "object";
|
||||||
@ -485,7 +485,7 @@
|
|||||||
} else if (activeTab === "json-raw") {
|
} else if (activeTab === "json-raw") {
|
||||||
result = expressionEditor.getValue();
|
result = expressionEditor.getValue();
|
||||||
}
|
}
|
||||||
onComplete && onComplete(result);
|
if (onComplete) { onComplete(result) }
|
||||||
RED.tray.close();
|
RED.tray.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
'<button type="button" class="red-ui-button" data-style="bq"><i class="fa fa-quote-left"></i></button>'+
|
'<button type="button" class="red-ui-button" data-style="bq"><i class="fa fa-quote-left"></i></button>'+
|
||||||
'<button type="button" class="red-ui-button" data-style="hr"><i class="fa fa-minus"></i></button>'+
|
'<button type="button" class="red-ui-button" data-style="hr"><i class="fa fa-minus"></i></button>'+
|
||||||
'<button type="button" class="red-ui-button" data-style="link"><i class="fa fa-link"></i></button>'+
|
'<button type="button" class="red-ui-button" data-style="link"><i class="fa fa-link"></i></button>'+
|
||||||
'</span>'
|
'</span>'+
|
||||||
'</div>';
|
'</div>';
|
||||||
|
|
||||||
var template = '<script type="text/x-red" data-template-name="_markdown">'+
|
var template = '<script type="text/x-red" data-template-name="_markdown">'+
|
||||||
|
@ -212,16 +212,14 @@ RED.palette = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('<div/>', {
|
$('<div/>', {
|
||||||
class: "red-ui-palette-label"
|
class: "red-ui-palette-label"+(((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-label-right" : "")
|
||||||
+ (((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-label-right" : "")
|
|
||||||
}).appendTo(d);
|
}).appendTo(d);
|
||||||
|
|
||||||
|
|
||||||
if (def.icon) {
|
if (def.icon) {
|
||||||
var icon_url = RED.utils.getNodeIcon(def);
|
var icon_url = RED.utils.getNodeIcon(def);
|
||||||
var iconContainer = $('<div/>', {
|
var iconContainer = $('<div/>', {
|
||||||
class: "red-ui-palette-icon-container"
|
class: "red-ui-palette-icon-container"+(((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-icon-container-right" : "")
|
||||||
+ (((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " red-ui-palette-icon-container-right" : "")
|
|
||||||
}).appendTo(d);
|
}).appendTo(d);
|
||||||
RED.utils.createIconElement(icon_url, iconContainer, true);
|
RED.utils.createIconElement(icon_url, iconContainer, true);
|
||||||
}
|
}
|
||||||
@ -419,14 +417,10 @@ RED.palette = (function() {
|
|||||||
var portOutput = paletteNode.find(".red-ui-palette-port-output");
|
var portOutput = paletteNode.find(".red-ui-palette-port-output");
|
||||||
|
|
||||||
var paletteLabel = paletteNode.find(".red-ui-palette-label");
|
var paletteLabel = paletteNode.find(".red-ui-palette-label");
|
||||||
paletteLabel.attr("class","red-ui-palette-label"
|
paletteLabel.attr("class","red-ui-palette-label" + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-label-right" : ""));
|
||||||
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-label-right" : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
var paletteIconContainer = paletteNode.find(".red-ui-palette-icon-container");
|
var paletteIconContainer = paletteNode.find(".red-ui-palette-icon-container");
|
||||||
paletteIconContainer.attr("class","red-ui-palette-icon-container"
|
paletteIconContainer.attr("class","red-ui-palette-icon-container" + (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-icon-container-right" : ""));
|
||||||
+ (((!sf._def.align && sf.in.length !== 0 && sf.out.length === 0) || "right" === sf._def.align) ? " red-ui-palette-icon-container-right" : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
if (portInput.length === 0 && sf.in.length > 0) {
|
if (portInput.length === 0 && sf.in.length > 0) {
|
||||||
var portIn = document.createElement("div");
|
var portIn = document.createElement("div");
|
||||||
|
@ -1938,8 +1938,9 @@ RED.projects = (function() {
|
|||||||
resultCallbackArgs = data;
|
resultCallbackArgs = data;
|
||||||
}
|
}
|
||||||
}).fail(function(xhr,textStatus,err) {
|
}).fail(function(xhr,textStatus,err) {
|
||||||
|
var responses;
|
||||||
if (options.responses && options.responses[xhr.status]) {
|
if (options.responses && options.responses[xhr.status]) {
|
||||||
var responses = options.responses[xhr.status];
|
responses = options.responses[xhr.status];
|
||||||
if (typeof responses === 'function') {
|
if (typeof responses === 'function') {
|
||||||
resultCallback = responses;
|
resultCallback = responses;
|
||||||
resultCallbackArgs = {error:responses.statusText};
|
resultCallbackArgs = {error:responses.statusText};
|
||||||
|
@ -753,7 +753,7 @@ RED.view = (function() {
|
|||||||
// .attr("d","M 0 "+(node_height/2)+" H "+(gridSize * -2))
|
// .attr("d","M 0 "+(node_height/2)+" H "+(gridSize * -2))
|
||||||
// .attr("opacity",0);
|
// .attr("opacity",0);
|
||||||
|
|
||||||
var filter = undefined;
|
var filter;
|
||||||
if (drag_lines.length > 0) {
|
if (drag_lines.length > 0) {
|
||||||
if (drag_lines[0].virtualLink) {
|
if (drag_lines[0].virtualLink) {
|
||||||
filter = {type:drag_lines[0].node.type === 'link in'?'link out':'link in'}
|
filter = {type:drag_lines[0].node.type === 'link in'?'link out':'link in'}
|
||||||
@ -1495,6 +1495,7 @@ RED.view = (function() {
|
|||||||
var lastSelection = null;
|
var lastSelection = null;
|
||||||
function updateSelection() {
|
function updateSelection() {
|
||||||
var selection = {};
|
var selection = {};
|
||||||
|
var activeWorkspace = RED.workspaces.active();
|
||||||
|
|
||||||
var workspaceSelection = RED.workspaces.selection();
|
var workspaceSelection = RED.workspaces.selection();
|
||||||
if (workspaceSelection.length === 0) {
|
if (workspaceSelection.length === 0) {
|
||||||
@ -1504,7 +1505,6 @@ RED.view = (function() {
|
|||||||
if (selected_link != null) {
|
if (selected_link != null) {
|
||||||
selection.link = selected_link;
|
selection.link = selected_link;
|
||||||
}
|
}
|
||||||
var activeWorkspace = RED.workspaces.active();
|
|
||||||
activeLinks = RED.nodes.filterLinks({
|
activeLinks = RED.nodes.filterLinks({
|
||||||
source:{z:activeWorkspace},
|
source:{z:activeWorkspace},
|
||||||
target:{z:activeWorkspace}
|
target:{z:activeWorkspace}
|
||||||
@ -1622,7 +1622,7 @@ RED.view = (function() {
|
|||||||
var workspaceSelection = RED.workspaces.selection();
|
var workspaceSelection = RED.workspaces.selection();
|
||||||
if (workspaceSelection.length > 0) {
|
if (workspaceSelection.length > 0) {
|
||||||
var workspaceCount = 0;
|
var workspaceCount = 0;
|
||||||
workspaceSelection.forEach(function(ws) { if (ws.type === 'tab') workspaceCount++ });
|
workspaceSelection.forEach(function(ws) { if (ws.type === 'tab') { workspaceCount++ } });
|
||||||
if (workspaceCount === RED.workspaces.count()) {
|
if (workspaceCount === RED.workspaces.count()) {
|
||||||
// Cannot delete all workspaces
|
// Cannot delete all workspaces
|
||||||
return;
|
return;
|
||||||
@ -1663,7 +1663,7 @@ RED.view = (function() {
|
|||||||
var removedLinks = [];
|
var removedLinks = [];
|
||||||
var removedSubflowOutputs = [];
|
var removedSubflowOutputs = [];
|
||||||
var removedSubflowInputs = [];
|
var removedSubflowInputs = [];
|
||||||
var removedSubflowStatus = undefined;
|
var removedSubflowStatus;
|
||||||
var subflowInstances = [];
|
var subflowInstances = [];
|
||||||
|
|
||||||
var startDirty = RED.nodes.dirty();
|
var startDirty = RED.nodes.dirty();
|
||||||
|
Loading…
Reference in New Issue
Block a user