mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Deprecate editorTheme.palette.editable for externalModules.palette.allowInstall
Also deprecates editorTheme.palette.editable for externalModules.palette.allowUpload
This commit is contained in:
parent
3151502a3f
commit
fc459be531
@ -269,7 +269,7 @@ var RED = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
// } else if (RED.settings.theme('palette.editable') !== false) {
|
// } else if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
|
||||||
} else {
|
} else {
|
||||||
options.buttons = [
|
options.buttons = [
|
||||||
{
|
{
|
||||||
@ -509,7 +509,7 @@ var RED = (function() {
|
|||||||
]});
|
]});
|
||||||
|
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
if (RED.settings.theme('palette.editable') !== false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
|
||||||
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
menuOptions.push({id:"menu-item-edit-palette",label:RED._("menu.label.editPalette"),onselect:"core:manage-palette"});
|
||||||
menuOptions.push(null);
|
menuOptions.push(null);
|
||||||
}
|
}
|
||||||
@ -544,7 +544,7 @@ var RED = (function() {
|
|||||||
RED.palette.init();
|
RED.palette.init();
|
||||||
RED.eventLog.init();
|
RED.eventLog.init();
|
||||||
|
|
||||||
if (RED.settings.theme('palette.editable') !== false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
|
||||||
RED.palette.editor.init();
|
RED.palette.editor.init();
|
||||||
} else {
|
} else {
|
||||||
console.log("Palette editor disabled");
|
console.log("Palette editor disabled");
|
||||||
|
@ -57,12 +57,11 @@ RED.settings = (function () {
|
|||||||
return JSON.parse(localStorage.getItem(key));
|
return JSON.parse(localStorage.getItem(key));
|
||||||
} else {
|
} else {
|
||||||
var v;
|
var v;
|
||||||
try {
|
try { v = RED.utils.getMessageProperty(userSettings,key); } catch(err) {}
|
||||||
v = RED.utils.getMessageProperty(userSettings,key);
|
if (v === undefined) {
|
||||||
if (v === undefined) {
|
try { v = RED.utils.getMessageProperty(RED.settings,key); } catch(err) {}
|
||||||
v = defaultIfUndefined;
|
}
|
||||||
}
|
if (v === undefined) {
|
||||||
} catch(err) {
|
|
||||||
v = defaultIfUndefined;
|
v = defaultIfUndefined;
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
|
@ -439,7 +439,7 @@ RED.palette.editor = (function() {
|
|||||||
|
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createSettingsPane();
|
createSettingsPane();
|
||||||
@ -880,7 +880,7 @@ RED.palette.editor = (function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (RED.settings.theme('palette.upload') !== false) {
|
if (RED.settings.get('externalModules.palette.allowUpload', true) !== false) {
|
||||||
var uploadSpan = $('<span class="button-group">').prependTo(toolBar);
|
var uploadSpan = $('<span class="button-group">').prependTo(toolBar);
|
||||||
var uploadButton = $('<button type="button" class="red-ui-sidebar-header-button red-ui-palette-editor-upload-button"><label><i class="fa fa-upload"></i><form id="red-ui-palette-editor-upload-form" enctype="multipart/form-data"><input name="tarball" type="file" accept=".tgz"></label></button>').appendTo(uploadSpan);
|
var uploadButton = $('<button type="button" class="red-ui-sidebar-header-button red-ui-palette-editor-upload-button"><label><i class="fa fa-upload"></i><form id="red-ui-palette-editor-upload-form" enctype="multipart/form-data"><input name="tarball" type="file" accept=".tgz"></label></button>').appendTo(uploadSpan);
|
||||||
|
|
||||||
@ -962,7 +962,7 @@ RED.palette.editor = (function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update(entry,version,url,container,done) {
|
function update(entry,version,url,container,done) {
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||||
done(new Error('Palette not editable'));
|
done(new Error('Palette not editable'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1021,7 +1021,7 @@ RED.palette.editor = (function() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
function remove(entry,container,done) {
|
function remove(entry,container,done) {
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||||
done(new Error('Palette not editable'));
|
done(new Error('Palette not editable'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1078,7 +1078,7 @@ RED.palette.editor = (function() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
function install(entry,container,done) {
|
function install(entry,container,done) {
|
||||||
if (RED.settings.theme('palette.editable') === false) {
|
if (RED.settings.get('externalModules.palette.allowInstall', true) === false) {
|
||||||
done(new Error('Palette not editable'));
|
done(new Error('Palette not editable'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -465,7 +465,7 @@ RED.projects.settings = (function() {
|
|||||||
metaRow = $('<div class="red-ui-palette-module-meta"></div>').appendTo(headerRow);
|
metaRow = $('<div class="red-ui-palette-module-meta"></div>').appendTo(headerRow);
|
||||||
var buttons = $('<div class="red-ui-palette-module-button-group"></div>').appendTo(metaRow);
|
var buttons = $('<div class="red-ui-palette-module-button-group"></div>').appendTo(metaRow);
|
||||||
if (RED.user.hasPermission("projects.write")) {
|
if (RED.user.hasPermission("projects.write")) {
|
||||||
if (!entry.installed && RED.settings.theme('palette.editable') !== false) {
|
if (!entry.installed && RED.settings.get('externalModules.palette.allowInstall', true) !== false) {
|
||||||
$('<a href="#" class="red-ui-button red-ui-button-small">' + RED._("sidebar.project.projectSettings.install") + '</a>').appendTo(buttons)
|
$('<a href="#" class="red-ui-button red-ui-button-small">' + RED._("sidebar.project.projectSettings.install") + '</a>').appendTo(buttons)
|
||||||
.on("click", function(evt) {
|
.on("click", function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
@ -335,7 +335,24 @@ function uninstallModule(module) {
|
|||||||
return activePromise;
|
return activePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPrereq() {
|
async function checkPrereq() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (settings.editorTheme.palette.editable === false) {
|
||||||
|
log.info(log._("server.palette-editor.disabled"));
|
||||||
|
installerEnabled = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch(err) {}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (settings.externalModules.palette.allowInstall === false) {
|
||||||
|
log.info(log._("server.palette-editor.disabled"));
|
||||||
|
installerEnabled = false;
|
||||||
|
return
|
||||||
|
}
|
||||||
|
} catch(err) {}
|
||||||
|
|
||||||
if (settings.hasOwnProperty('editorTheme') &&
|
if (settings.hasOwnProperty('editorTheme') &&
|
||||||
settings.editorTheme.hasOwnProperty('palette') &&
|
settings.editorTheme.hasOwnProperty('palette') &&
|
||||||
settings.editorTheme.palette.hasOwnProperty('editable') &&
|
settings.editorTheme.palette.hasOwnProperty('editable') &&
|
||||||
@ -343,7 +360,6 @@ function checkPrereq() {
|
|||||||
) {
|
) {
|
||||||
log.info(log._("server.palette-editor.disabled"));
|
log.info(log._("server.palette-editor.disabled"));
|
||||||
installerEnabled = false;
|
installerEnabled = false;
|
||||||
return Promise.resolve();
|
|
||||||
} else {
|
} else {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
child_process.execFile(npmCommand,['-v'],function(err,stdout) {
|
child_process.execFile(npmCommand,['-v'],function(err,stdout) {
|
||||||
|
@ -90,10 +90,15 @@ var api = module.exports = {
|
|||||||
safeSettings.flowFilePretty = runtime.settings.flowFilePretty;
|
safeSettings.flowFilePretty = runtime.settings.flowFilePretty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (runtime.settings.externalModules) {
|
||||||
|
safeSettings.externalModules = runtime.settings.externalModules;
|
||||||
|
}
|
||||||
|
|
||||||
if (!runtime.nodes.installerEnabled()) {
|
if (!runtime.nodes.installerEnabled()) {
|
||||||
safeSettings.editorTheme = safeSettings.editorTheme || {};
|
safeSettings.externalModules = safeSettings.externalModules || {};
|
||||||
safeSettings.editorTheme.palette = safeSettings.editorTheme.palette || {};
|
safeSettings.externalModules.palette = safeSettings.externalModules.palette || {};
|
||||||
safeSettings.editorTheme.palette.editable = false;
|
safeSettings.externalModules.palette.allowInstall = false;
|
||||||
|
safeSettings.externalModules.palette.allowUpload = false;
|
||||||
}
|
}
|
||||||
if (runtime.storage.projects) {
|
if (runtime.storage.projects) {
|
||||||
var activeProject = runtime.storage.projects.getActiveProject();
|
var activeProject = runtime.storage.projects.getActiveProject();
|
||||||
|
Loading…
Reference in New Issue
Block a user