Merge pull request #2148 from node-red/new-export-dialog

Updated Library UX
This commit is contained in:
Nick O'Leary
2019-04-26 16:23:23 +01:00
committed by GitHub
29 changed files with 1745 additions and 1335 deletions

View File

@@ -93,9 +93,8 @@ module.exports = {
// Library
var library = require("./library");
library.init(runtimeAPI);
editorApp.get("/library/flows",needsPermission("library.read"),library.getAll,apiUtil.errorHandler);
editorApp.get(/library\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
editorApp.post(/library\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
editorApp.get(/library\/([^\/]+)\/([^\/]+)(?:$|\/(.*))/,needsPermission("library.read"),library.getEntry);
editorApp.post(/library\/([^\/]+)\/([^\/]+)\/(.*)/,needsPermission("library.write"),library.saveEntry);
// Credentials

View File

@@ -25,23 +25,12 @@ module.exports = {
init: function(_runtimeAPI) {
runtimeAPI = _runtimeAPI;
},
getAll: function(req,res) {
var opts = {
user: req.user,
type: 'flows'
}
runtimeAPI.library.getEntries(opts).then(function(result) {
res.json(result);
}).catch(function(err) {
apiUtils.rejectHandler(req,res,err);
});
},
getEntry: function(req,res) {
var opts = {
user: req.user,
type: req.params[0],
path: req.params[1]||""
library: req.params[0],
type: req.params[1],
path: req.params[2]||""
}
runtimeAPI.library.getEntry(opts).then(function(result) {
if (typeof result === "string") {
@@ -62,8 +51,9 @@ module.exports = {
saveEntry: function(req,res) {
var opts = {
user: req.user,
type: req.params[0],
path: req.params[1]||""
library: req.params[0],
type: req.params[1],
path: req.params[2]||""
}
// TODO: horrible inconsistencies between flows and all other types
if (opts.type === "flows") {