@node-red/editor-api 3.0.0-beta.3 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin/flows.js +23 -0
- package/lib/admin/index.js +6 -0
- package/lib/editor/theme.js +66 -3
- package/package.json +4 -4
package/lib/admin/flows.js
CHANGED
|
@@ -68,5 +68,28 @@ module.exports = {
|
|
|
68
68
|
}).catch(function(err) {
|
|
69
69
|
apiUtils.rejectHandler(req,res,err);
|
|
70
70
|
})
|
|
71
|
+
},
|
|
72
|
+
getState: function(req,res) {
|
|
73
|
+
const opts = {
|
|
74
|
+
user: req.user,
|
|
75
|
+
req: apiUtils.getRequestLogObject(req)
|
|
76
|
+
}
|
|
77
|
+
runtimeAPI.flows.getState(opts).then(function(result) {
|
|
78
|
+
res.json(result);
|
|
79
|
+
}).catch(function(err) {
|
|
80
|
+
apiUtils.rejectHandler(req,res,err);
|
|
81
|
+
})
|
|
82
|
+
},
|
|
83
|
+
postState: function(req,res) {
|
|
84
|
+
const opts = {
|
|
85
|
+
user: req.user,
|
|
86
|
+
state: req.body.state || "",
|
|
87
|
+
req: apiUtils.getRequestLogObject(req)
|
|
88
|
+
}
|
|
89
|
+
runtimeAPI.flows.setState(opts).then(function(result) {
|
|
90
|
+
res.json(result);
|
|
91
|
+
}).catch(function(err) {
|
|
92
|
+
apiUtils.rejectHandler(req,res,err);
|
|
93
|
+
})
|
|
71
94
|
}
|
|
72
95
|
}
|
package/lib/admin/index.js
CHANGED
|
@@ -54,6 +54,12 @@ module.exports = {
|
|
|
54
54
|
adminApp.get("/flows",needsPermission("flows.read"),flows.get,apiUtil.errorHandler);
|
|
55
55
|
adminApp.post("/flows",needsPermission("flows.write"),flows.post,apiUtil.errorHandler);
|
|
56
56
|
|
|
57
|
+
// Flows/state
|
|
58
|
+
adminApp.get("/flows/state", needsPermission("flows.read"), flows.getState, apiUtil.errorHandler);
|
|
59
|
+
if (settings.runtimeState && settings.runtimeState.enabled === true) {
|
|
60
|
+
adminApp.post("/flows/state", needsPermission("flows.write"), flows.postState, apiUtil.errorHandler);
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
// Flow
|
|
58
64
|
adminApp.get("/flow/:id",needsPermission("flows.read"),flow.get,apiUtil.errorHandler);
|
|
59
65
|
adminApp.post("/flow",needsPermission("flows.write"),flow.post,apiUtil.errorHandler);
|
package/lib/editor/theme.js
CHANGED
|
@@ -101,7 +101,10 @@ module.exports = {
|
|
|
101
101
|
}
|
|
102
102
|
themeSettings = null;
|
|
103
103
|
theme = settings.editorTheme || {};
|
|
104
|
-
themeContext.asset.vendorMonaco =
|
|
104
|
+
themeContext.asset.vendorMonaco = "vendor/monaco/monaco-bootstrap.js"
|
|
105
|
+
if (theme.codeEditor && theme.codeEditor.lib === 'ace') {
|
|
106
|
+
themeContext.asset.vendorMonaco = ''
|
|
107
|
+
}
|
|
105
108
|
activeTheme = theme.theme;
|
|
106
109
|
},
|
|
107
110
|
|
|
@@ -263,9 +266,69 @@ module.exports = {
|
|
|
263
266
|
theme.page = theme.page || {_:{}}
|
|
264
267
|
theme.page._.scripts = scriptFiles.concat(theme.page._.scripts || [])
|
|
265
268
|
}
|
|
266
|
-
|
|
267
|
-
|
|
269
|
+
// check and load page settings from theme
|
|
270
|
+
if (themePlugin.page) {
|
|
271
|
+
if (themePlugin.page.favicon && !theme.page.favicon) {
|
|
272
|
+
const result = serveFilesFromTheme(
|
|
273
|
+
[themePlugin.page.favicon],
|
|
274
|
+
themeApp,
|
|
275
|
+
"/",
|
|
276
|
+
themePlugin.path
|
|
277
|
+
)
|
|
278
|
+
if(result && result.length > 0) {
|
|
279
|
+
// update themeContext page favicon
|
|
280
|
+
themeContext.page.favicon = result[0]
|
|
281
|
+
theme.page = theme.page || {_:{}}
|
|
282
|
+
theme.page._.favicon = result[0]
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (themePlugin.page.tabicon && themePlugin.page.tabicon.icon && !theme.page.tabicon) {
|
|
286
|
+
const result = serveFilesFromTheme(
|
|
287
|
+
[themePlugin.page.tabicon.icon],
|
|
288
|
+
themeApp,
|
|
289
|
+
"/page/",
|
|
290
|
+
themePlugin.path
|
|
291
|
+
)
|
|
292
|
+
if(result && result.length > 0) {
|
|
293
|
+
// update themeContext page tabicon
|
|
294
|
+
themeContext.page.tabicon.icon = result[0]
|
|
295
|
+
themeContext.page.tabicon.colour = themeContext.page.tabicon.colour || themeContext.page.tabicon.colour
|
|
296
|
+
theme.page = theme.page || {_:{}}
|
|
297
|
+
theme.page._.tabicon = theme.page._.tabicon || {}
|
|
298
|
+
theme.page._.tabicon.icon = themeContext.page.tabicon.icon
|
|
299
|
+
theme.page._.tabicon.colour = themeContext.page.tabicon.colour
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// if the plugin has a title AND the users settings.js does NOT
|
|
303
|
+
if (themePlugin.page.title && !theme.page.title) {
|
|
304
|
+
themeContext.page.title = themePlugin.page.title || themeContext.page.title
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// check and load header settings from theme
|
|
308
|
+
if (themePlugin.header) {
|
|
309
|
+
if (themePlugin.header.image && !theme.header.image) {
|
|
310
|
+
const result = serveFilesFromTheme(
|
|
311
|
+
[themePlugin.header.image],
|
|
312
|
+
themeApp,
|
|
313
|
+
"/header/",
|
|
314
|
+
themePlugin.path
|
|
315
|
+
)
|
|
316
|
+
if(result && result.length > 0) {
|
|
317
|
+
// update themeContext header image
|
|
318
|
+
themeContext.header.image = result[0]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// if the plugin has a title AND the users settings.js does NOT have a title
|
|
322
|
+
if (themePlugin.header.title && !theme.header.title) {
|
|
323
|
+
themeContext.header.title = themePlugin.header.title || themeContext.header.title
|
|
324
|
+
}
|
|
325
|
+
// if the plugin has a header url AND the users settings.js does NOT
|
|
326
|
+
if (themePlugin.header.url && !theme.header.url) {
|
|
327
|
+
themeContext.header.url = themePlugin.header.url || themeContext.header.url
|
|
328
|
+
}
|
|
268
329
|
}
|
|
330
|
+
theme.codeEditor = theme.codeEditor || {}
|
|
331
|
+
theme.codeEditor.options = Object.assign({}, themePlugin.monacoOptions, theme.codeEditor.options);
|
|
269
332
|
}
|
|
270
333
|
activeThemeInitialised = true;
|
|
271
334
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/editor-api",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@node-red/util": "3.0.
|
|
20
|
-
"@node-red/editor-client": "3.0.
|
|
19
|
+
"@node-red/util": "3.0.1",
|
|
20
|
+
"@node-red/editor-client": "3.0.1",
|
|
21
21
|
"bcryptjs": "2.4.3",
|
|
22
22
|
"body-parser": "1.20.0",
|
|
23
23
|
"clone": "2.1.2",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"oauth2orize": "1.11.1",
|
|
32
32
|
"passport-http-bearer": "1.0.1",
|
|
33
33
|
"passport-oauth2-client-password": "0.1.2",
|
|
34
|
-
"passport": "0.
|
|
34
|
+
"passport": "0.6.0",
|
|
35
35
|
"ws": "7.5.6"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|