Add simplified git workflow to auto-commit changes

This commit is contained in:
Nick O'Leary
2019-01-21 15:20:56 +00:00
parent e6ffa3d143
commit 69d60ffb24
11 changed files with 125 additions and 57 deletions

View File

@@ -115,7 +115,7 @@ function load(forceStart) {
* type - full/nodes/flows/load (default full)
* muteLog - don't emit the standard log messages (used for individual flow api)
*/
function setFlows(_config,_credentials,type,muteLog,forceStart) {
function setFlows(_config,_credentials,type,muteLog,forceStart,user) {
if (typeof _credentials === "string") {
type = _credentials;
_credentials = null;
@@ -186,7 +186,7 @@ function setFlows(_config,_credentials,type,muteLog,forceStart) {
credentialsDirty:credsDirty,
credentials: creds
}
return storage.saveFlows(saveConfig);
return storage.saveFlows(saveConfig, user);
});
}
@@ -481,7 +481,7 @@ function updateMissingTypes() {
}
}
function addFlow(flow) {
function addFlow(flow, user) {
var i,node;
if (!flow.hasOwnProperty('nodes')) {
throw new Error('missing nodes property');
@@ -531,7 +531,7 @@ function addFlow(flow) {
var newConfig = clone(activeConfig.flows);
newConfig = newConfig.concat(nodes);
return setFlows(newConfig,null,'flows',true).then(function() {
return setFlows(newConfig, null, 'flows', true, null, user).then(function() {
log.info(log._("nodes.flows.added-flow",{label:(flow.label?flow.label+" ":"")+"["+flow.id+"]"}));
return flow.id;
});
@@ -607,7 +607,7 @@ function getFlow(id) {
return result;
}
function updateFlow(id,newFlow) {
function updateFlow(id,newFlow, user) {
var label = id;
if (id !== 'global') {
if (!activeFlowConfig.flows[id]) {
@@ -662,12 +662,12 @@ function updateFlow(id,newFlow) {
}
newConfig = newConfig.concat(nodes);
return setFlows(newConfig,null,'flows',true).then(function() {
return setFlows(newConfig, null, 'flows', true, null, user).then(function() {
log.info(log._("nodes.flows.updated-flow",{label:(label?label+" ":"")+"["+id+"]"}));
})
}
function removeFlow(id) {
function removeFlow(id, user) {
if (id === 'global') {
// TODO: nls + error code
throw new Error('not allowed to remove global');
@@ -684,7 +684,7 @@ function removeFlow(id) {
return node.z !== id && node.id !== id;
});
return setFlows(newConfig,null,'flows',true).then(function() {
return setFlows(newConfig, null, 'flows', true, null, user).then(function() {
log.info(log._("nodes.flows.removed-flow",{label:(flow.label?flow.label+" ":"")+"["+flow.id+"]"}));
});
}