mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Flows lib honours flowFilePretty setting (#837)
* Flow lib now adheres to pretty flow file, ui also adheres to this as well * added settings mock object in flows_spec get api test * reverted api changes, fixed parse of flow only * try spell flows correctly
This commit is contained in:
parent
bcff74327b
commit
3454e5ac77
@ -119,8 +119,13 @@ RED.clipboard = (function() {
|
|||||||
var selection = RED.view.selection();
|
var selection = RED.view.selection();
|
||||||
if (selection.nodes) {
|
if (selection.nodes) {
|
||||||
var nns = RED.nodes.createExportableNodeSet(selection.nodes);
|
var nns = RED.nodes.createExportableNodeSet(selection.nodes);
|
||||||
|
if (RED.settings.flowFilePretty) {
|
||||||
|
nns = JSON.stringify(nns,null,4);
|
||||||
|
} else {
|
||||||
|
nns = JSON.stringify(nns);
|
||||||
|
}
|
||||||
$("#clipboard-export")
|
$("#clipboard-export")
|
||||||
.val(JSON.stringify(nns))
|
.val(nns)
|
||||||
.focus(function() {
|
.focus(function() {
|
||||||
var textarea = $(this);
|
var textarea = $(this);
|
||||||
textarea.select();
|
textarea.select();
|
||||||
|
@ -37,6 +37,10 @@ module.exports = {
|
|||||||
safeSettings.paletteCategories = settings.paletteCategories;
|
safeSettings.paletteCategories = settings.paletteCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.flowFilePretty) {
|
||||||
|
safeSettings.flowFilePretty = settings.flowFilePretty;
|
||||||
|
}
|
||||||
|
|
||||||
res.json(safeSettings);
|
res.json(safeSettings);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -390,6 +390,9 @@ var localfilesystem = {
|
|||||||
headers += "// "+i+": "+meta[i]+"\n";
|
headers += "// "+i+": "+meta[i]+"\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (type === "flows" && settings.flowFilePretty) {
|
||||||
|
body = JSON.stringify(JSON.parse(body),null,4);
|
||||||
|
}
|
||||||
return promiseDir(fspath.dirname(fn)).then(function () {
|
return promiseDir(fspath.dirname(fn)).then(function () {
|
||||||
writeFile(fn,headers+body);
|
writeFile(fn,headers+body);
|
||||||
});
|
});
|
||||||
|
@ -36,6 +36,7 @@ describe("flows api", function() {
|
|||||||
|
|
||||||
it('returns flow', function(done) {
|
it('returns flow', function(done) {
|
||||||
flows.init({
|
flows.init({
|
||||||
|
settings: {},
|
||||||
log:{warn:function(){},_:function(){},audit:function(){}},
|
log:{warn:function(){},_:function(){},audit:function(){}},
|
||||||
nodes:{
|
nodes:{
|
||||||
getFlows: function() { return [1,2,3]; }
|
getFlows: function() { return [1,2,3]; }
|
||||||
|
Loading…
Reference in New Issue
Block a user