Allow a project's flow file to be changed

This commit is contained in:
Nick O'Leary
2017-10-19 21:38:53 +01:00
parent 5218a3fbac
commit 3d6468326a
13 changed files with 711 additions and 201 deletions

View File

@@ -33,6 +33,7 @@ function handleStatus(event) {
publish("status/"+event.id,event.status,true);
}
function handleRuntimeEvent(event) {
log.trace("runtime event: "+JSON.stringify(event));
publish("notification/"+event.id,event.payload||{},event.retain);
}
function init(_server,runtime) {

View File

@@ -85,7 +85,8 @@
"nodeActionDisabled": "node actions disabled within subflow",
"missing-types": "Flows stopped due to missing node types. Check logs for details.",
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
"invalid-credentials-secret": "Flows stopped due to missing or invalid credentialSecret"
"credentials_load_failed": "Flows stopped due to missing or invalid credentialSecret",
"missing_flow_file": "Could not find the project flow file"
},
"error": "<strong>Error</strong>: __message__",

View File

@@ -77,14 +77,15 @@ module.exports = {
}
})
} else {
res.redirect(303,req.baseUrl + '/');
res.redirect(303,req.baseUrl + '/'+ req.params.id);
}
} else if (req.body.hasOwnProperty('credentialSecret') ||
req.body.hasOwnProperty('description') ||
req.body.hasOwnProperty('dependencies')||
req.body.hasOwnProperty('summary')) {
req.body.hasOwnProperty('summary') ||
req.body.hasOwnProperty('files')) {
runtime.storage.projects.updateProject(req.params.id, req.body).then(function() {
res.redirect(303,req.baseUrl + '/');
res.redirect(303,req.baseUrl + '/'+ req.params.id);
}).catch(function(err) {
if (err.code) {
res.status(400).json({error:err.code, message: err.message});
@@ -92,6 +93,8 @@ module.exports = {
res.status(400).json({error:"unexpected_error", message:err.toString()});
}
})
} else {
res.status(400).json({error:"unexpected_error", message:"invalid_request"});
}
});