mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Refactor lib/flows code to include initial router component
This commit is contained in:
@@ -52,7 +52,7 @@ var api = module.exports = {
|
||||
getFlows: function(opts) {
|
||||
return new Promise(function(resolve,reject) {
|
||||
runtime.log.audit({event: "flows.get"}, opts.req);
|
||||
return resolve(runtime.nodes.getFlows());
|
||||
return resolve(runtime.flows.getFlows());
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -75,10 +75,10 @@ var api = module.exports = {
|
||||
|
||||
var apiPromise;
|
||||
if (deploymentType === 'reload') {
|
||||
apiPromise = runtime.nodes.loadFlows(true);
|
||||
apiPromise = runtime.flows.loadFlows(true);
|
||||
} else {
|
||||
if (flows.hasOwnProperty('rev')) {
|
||||
var currentVersion = runtime.nodes.getFlows().rev;
|
||||
var currentVersion = runtime.flows.getFlows().rev;
|
||||
if (currentVersion !== flows.rev) {
|
||||
var err;
|
||||
err = new Error();
|
||||
@@ -114,7 +114,7 @@ var api = module.exports = {
|
||||
return mutex.runExclusive(function() {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var flow = opts.flow;
|
||||
runtime.nodes.addFlow(flow,opts.user).then(function (id) {
|
||||
runtime.flows.addFlow(flow, opts.user).then(function (id) {
|
||||
runtime.log.audit({event: "flow.add", id: id}, opts.req);
|
||||
return resolve(id);
|
||||
}).catch(function (err) {
|
||||
@@ -141,7 +141,7 @@ var api = module.exports = {
|
||||
*/
|
||||
getFlow: function(opts) {
|
||||
return new Promise(function (resolve,reject) {
|
||||
var flow = runtime.nodes.getFlow(opts.id);
|
||||
var flow = runtime.flows.getFlow(opts.id);
|
||||
if (flow) {
|
||||
runtime.log.audit({event: "flow.get",id:opts.id}, opts.req);
|
||||
return resolve(flow);
|
||||
@@ -170,7 +170,7 @@ var api = module.exports = {
|
||||
var flow = opts.flow;
|
||||
var id = opts.id;
|
||||
try {
|
||||
runtime.nodes.updateFlow(id, flow, opts.user).then(function () {
|
||||
runtime.flows.updateFlow(id, flow, opts.user).then(function () {
|
||||
runtime.log.audit({event: "flow.update", id: id}, opts.req);
|
||||
return resolve(id);
|
||||
}).catch(function (err) {
|
||||
@@ -216,7 +216,7 @@ var api = module.exports = {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var id = opts.id;
|
||||
try {
|
||||
runtime.nodes.removeFlow(id, opts.user).then(function () {
|
||||
runtime.flows.removeFlow(id, opts.user).then(function () {
|
||||
runtime.log.audit({event: "flow.remove", id: id}, opts.req);
|
||||
return resolve();
|
||||
}).catch(function (err) {
|
||||
|
Reference in New Issue
Block a user