mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Remove when.js from runtime/lib/flow/index
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
**/
|
||||
|
||||
var clone = require("clone");
|
||||
var when = require("when");
|
||||
|
||||
var Flow = require('./Flow');
|
||||
|
||||
@@ -488,7 +487,7 @@ function updateMissingTypes() {
|
||||
}
|
||||
}
|
||||
|
||||
function addFlow(flow, user) {
|
||||
async function addFlow(flow, user) {
|
||||
var i,node;
|
||||
if (!flow.hasOwnProperty('nodes')) {
|
||||
throw new Error('missing nodes property');
|
||||
@@ -513,10 +512,10 @@ function addFlow(flow, user) {
|
||||
node = flow.nodes[i];
|
||||
if (activeFlowConfig.allNodes[node.id]) {
|
||||
// TODO nls
|
||||
return when.reject(new Error('duplicate id'));
|
||||
throw new Error('duplicate id');
|
||||
}
|
||||
if (node.type === 'tab' || node.type === 'subflow') {
|
||||
return when.reject(new Error('invalid node type: '+node.type));
|
||||
throw new Error('invalid node type: '+node.type);
|
||||
}
|
||||
node.z = flow.id;
|
||||
nodes.push(node);
|
||||
@@ -526,10 +525,10 @@ function addFlow(flow, user) {
|
||||
node = flow.configs[i];
|
||||
if (activeFlowConfig.allNodes[node.id]) {
|
||||
// TODO nls
|
||||
return when.reject(new Error('duplicate id'));
|
||||
throw new Error('duplicate id');
|
||||
}
|
||||
if (node.type === 'tab' || node.type === 'subflow') {
|
||||
return when.reject(new Error('invalid node type: '+node.type));
|
||||
throw new Error('invalid node type: '+node.type);
|
||||
}
|
||||
node.z = flow.id;
|
||||
nodes.push(node);
|
||||
@@ -614,7 +613,7 @@ function getFlow(id) {
|
||||
return result;
|
||||
}
|
||||
|
||||
function updateFlow(id,newFlow, user) {
|
||||
async function updateFlow(id,newFlow, user) {
|
||||
var label = id;
|
||||
if (id !== 'global') {
|
||||
if (!activeFlowConfig.flows[id]) {
|
||||
@@ -674,7 +673,7 @@ function updateFlow(id,newFlow, user) {
|
||||
})
|
||||
}
|
||||
|
||||
function removeFlow(id, user) {
|
||||
async function removeFlow(id, user) {
|
||||
if (id === 'global') {
|
||||
// TODO: nls + error code
|
||||
throw new Error('not allowed to remove global');
|
||||
|
Reference in New Issue
Block a user