mirror of https://github.com/node-red/node-red.git
allow node defaults to be overridden by settings
and add commented example to blank settings filepull/5591/head
parent
89fe24929e
commit
2ec26dc31d
|
|
@ -293,6 +293,16 @@ RED.nodes = (function() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// override node defaults with any values from settings.js
|
||||
const over = RED.settings?.nodeDefaults?.[def.type]
|
||||
if (over) {
|
||||
for (var prop in over) {
|
||||
if (over.hasOwnProperty(prop) && def.defaults.hasOwnProperty(prop)) {
|
||||
def.defaults[prop].value = over[prop];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -406,9 +416,9 @@ RED.nodes = (function() {
|
|||
},
|
||||
/**
|
||||
* Add an object to our dirty/clean tracking state
|
||||
* @param {String} z
|
||||
* @param {String} id
|
||||
* @param {Boolean} isDirty
|
||||
* @param {String} z
|
||||
* @param {String} id
|
||||
* @param {Boolean} isDirty
|
||||
*/
|
||||
addObjectToWorkspace: function (z, id, isDirty) {
|
||||
if (isDirty) {
|
||||
|
|
@ -421,8 +431,8 @@ RED.nodes = (function() {
|
|||
},
|
||||
/**
|
||||
* Remove an object from our dirty/clean tracking state
|
||||
* @param {String} z
|
||||
* @param {String} id
|
||||
* @param {String} z
|
||||
* @param {String} id
|
||||
*/
|
||||
removeObjectFromWorkspace: function (z, id) {
|
||||
if (!addedDirtyObjects.has(id)) {
|
||||
|
|
@ -444,7 +454,7 @@ RED.nodes = (function() {
|
|||
api.addNode(n)
|
||||
},
|
||||
/**
|
||||
* @param {array} nodes
|
||||
* @param {array} nodes
|
||||
* @param {boolean} direction true:forwards false:back
|
||||
* @param {boolean} singleStep true:single-step false:all-the-way
|
||||
*/
|
||||
|
|
@ -2117,7 +2127,7 @@ RED.nodes = (function() {
|
|||
$("<li>").text(t).appendTo(typeList);
|
||||
})
|
||||
typeList = typeList[0].outerHTML;
|
||||
|
||||
|
||||
unknownNotification = RED.notify(
|
||||
"<p>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</p>"+typeList,
|
||||
notificationOptions
|
||||
|
|
@ -2358,7 +2368,7 @@ RED.nodes = (function() {
|
|||
// We need to sort new_nodes (which only contains config nodes at this point)
|
||||
// to ensure they get added in the right order. If NodeA depends on NodeB, then
|
||||
// NodeB must be added first.
|
||||
|
||||
|
||||
// Limit us to 5 full iterations of the list - this should be more than
|
||||
// enough to process the list as config->config node relationships are
|
||||
// not very common
|
||||
|
|
|
|||
|
|
@ -172,6 +172,10 @@ var api = module.exports = {
|
|||
safeSettings.runtimeState.ui = false; // cannot have UI without endpoint
|
||||
}
|
||||
|
||||
if (runtime.settings.nodeDefaults) {
|
||||
safeSettings.nodeDefaults = runtime.settings.nodeDefaults;
|
||||
}
|
||||
|
||||
runtime.settings.exportNodeSettings(safeSettings);
|
||||
runtime.plugins.exportPluginSettings(safeSettings);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -313,10 +313,10 @@ module.exports = {
|
|||
ui: false,
|
||||
},
|
||||
telemetry: {
|
||||
/**
|
||||
/**
|
||||
* By default, telemetry is disabled until the user provides consent the first
|
||||
* time they open the editor.
|
||||
*
|
||||
*
|
||||
* The following property can be uncommented and set to true/false to enable/disable
|
||||
* telemetry without seeking further consent in the editor.
|
||||
* The user can override this setting via the user settings dialog within the editor
|
||||
|
|
@ -620,4 +620,17 @@ module.exports = {
|
|||
// * - reason: if result is false, the HTTP reason string to return
|
||||
// */
|
||||
//},
|
||||
|
||||
/*******************************************************************************
|
||||
* Node Default Overrides
|
||||
* - allows the user to override node default values
|
||||
* the node type and properties can be found by looking at the info tab
|
||||
* of an existing node.
|
||||
*******************************************************************************
|
||||
// nodeDefaults: {
|
||||
// "debug": {
|
||||
// "complete": true // set the debug node to show complete msg by default
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue