Disable palette editor if npm not found

This commit is contained in:
Nick O'Leary
2016-10-12 22:30:32 +01:00
parent a76674032d
commit 49f72881f4
11 changed files with 108 additions and 30 deletions

View File

@@ -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);
}

View File

@@ -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 {