1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Do not show TypedInput context options if there's only one available

This commit is contained in:
Nick O'Leary 2018-07-04 13:36:23 +01:00
parent 33b4774c49
commit e6c5cfb703
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -27,6 +27,9 @@
return parts; return parts;
} }
var contextExport = function(v,opt) { var contextExport = function(v,opt) {
if (!opt) {
return v;
}
var store = ((typeof opt === "string")?opt:opt.value) var store = ((typeof opt === "string")?opt:opt.value)
if (store !== RED.settings.context.default) { if (store !== RED.settings.context.default) {
return "#:("+store+")::"+v; return "#:("+store+")::"+v;
@ -128,9 +131,14 @@
var contextOptions = contextStores.map(function(store) { var contextOptions = contextStores.map(function(store) {
return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database" style="color: #'+(store==='memory'?'ddd':'777')+'"></i>'} return {value:store,label: store, icon:'<i class="red-ui-typedInput-icon fa fa-database" style="color: #'+(store==='memory'?'ddd':'777')+'"></i>'}
}) })
if (contextOptions.length < 2) {
delete allOptions.flow.options;
delete allOptions.global.options
} else {
allOptions.flow.options = contextOptions; allOptions.flow.options = contextOptions;
allOptions.global.options = contextOptions; allOptions.global.options = contextOptions;
} }
}
nlsd = true; nlsd = true;
var that = this; var that = this;