mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Disable palette editor if npm not found
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2014, 2015 IBM Corp.
|
||||
* Copyright 2014, 2016 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,10 +15,12 @@
|
||||
**/
|
||||
var theme = require("./theme");
|
||||
var util = require('util');
|
||||
var runtime;
|
||||
var settings;
|
||||
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
init: function(_runtime) {
|
||||
runtime = _runtime;
|
||||
settings = runtime.settings;
|
||||
},
|
||||
settings: function(req,res) {
|
||||
@@ -40,6 +42,12 @@ module.exports = {
|
||||
if (settings.flowFilePretty) {
|
||||
safeSettings.flowFilePretty = settings.flowFilePretty;
|
||||
}
|
||||
if (!runtime.nodes.paletteEditorEnabled()) {
|
||||
safeSettings.editorTheme = safeSettings.editorTheme || {};
|
||||
safeSettings.editorTheme.palette = safeSettings.editorTheme.palette || {};
|
||||
safeSettings.editorTheme.palette.editable = false;
|
||||
}
|
||||
|
||||
|
||||
res.json(safeSettings);
|
||||
}
|
||||
|
@@ -38,6 +38,7 @@ var defaultContext = {
|
||||
var theme = null;
|
||||
var themeContext = clone(defaultContext);
|
||||
var themeSettings = null;
|
||||
var runtime = null;
|
||||
|
||||
function serveFile(app,baseUrl,file) {
|
||||
try {
|
||||
|
Reference in New Issue
Block a user