mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Handle cloning a bare repository
This commit is contained in:
@@ -86,7 +86,8 @@
|
||||
"missing-types": "Flows stopped due to missing node types. Check logs for details.",
|
||||
"restartRequired": "Node-RED must be restarted to enable upgraded modules",
|
||||
"credentials_load_failed": "Flows stopped due to missing or invalid credentialSecret",
|
||||
"missing_flow_file": "Could not find the project flow file"
|
||||
"missing_flow_file": "Could not find the project flow file",
|
||||
"project_empty": "<p>The project repository is empty.</p><p>Do you want to create a default set of project files?<br/>Otherwise, you will have to manually add files to the project outside of the editor.</p>"
|
||||
},
|
||||
|
||||
"error": "<strong>Error</strong>: __message__",
|
||||
|
@@ -90,6 +90,17 @@ module.exports = {
|
||||
} else {
|
||||
res.redirect(303,req.baseUrl + '/'+ req.params.id);
|
||||
}
|
||||
} else if (req.body.initialise) {
|
||||
// Initialised set when creating default files for an empty repo
|
||||
runtime.storage.projects.initialiseProject(req.user, req.params.id, req.body).then(function() {
|
||||
res.redirect(303,req.baseUrl + '/'+ req.params.id);
|
||||
}).catch(function(err) {
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
}
|
||||
})
|
||||
} else if (req.body.hasOwnProperty('credentialSecret') ||
|
||||
req.body.hasOwnProperty('description') ||
|
||||
req.body.hasOwnProperty('dependencies')||
|
||||
@@ -145,8 +156,11 @@ module.exports = {
|
||||
res.status(404).end();
|
||||
}
|
||||
}).catch(function(err) {
|
||||
console.log(err.stack);
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -154,12 +168,15 @@ module.exports = {
|
||||
// Project file listing
|
||||
app.get("/:id/files", needsPermission("projects.read"), function(req,res) {
|
||||
runtime.storage.projects.getFiles(req.user, req.params.id).then(function(data) {
|
||||
console.log("TODO: REMOVE /:id/files as /:id/status is better!")
|
||||
// console.log("TODO: REMOVE /:id/files as /:id/status is better!")
|
||||
res.json(data);
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log(err.stack);
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
if (err.code) {
|
||||
res.status(400).json({error:err.code, message: err.message});
|
||||
} else {
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
@@ -48,6 +48,16 @@ module.exports = {
|
||||
safeSettings.editorTheme.palette = safeSettings.editorTheme.palette || {};
|
||||
safeSettings.editorTheme.palette.editable = false;
|
||||
}
|
||||
if (runtime.storage.projects) {
|
||||
var activeProject = runtime.storage.projects.getActiveProject();
|
||||
if (activeProject) {
|
||||
safeSettings.project = activeProject;
|
||||
}
|
||||
safeSettings.files = {
|
||||
flow: runtime.storage.projects.getFlowFilename(),
|
||||
credentials: runtime.storage.projects.getCredentialsFilename()
|
||||
}
|
||||
}
|
||||
|
||||
safeSettings.flowEncryptionType = runtime.nodes.getCredentialKeyType();
|
||||
|
||||
|
Reference in New Issue
Block a user