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

Allow subflow env-var list to resize with the dialog

This commit is contained in:
Nick O'Leary 2019-02-04 17:20:13 +00:00
parent 79fe7d684c
commit 1fe8b388a3
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 27 additions and 6 deletions

View File

@ -372,6 +372,16 @@ RED.nodes = (function() {
paletteLabel: function() { return RED.nodes.subflow(sf.id).name }, paletteLabel: function() { return RED.nodes.subflow(sf.id).name },
inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null }, inputLabels: function(i) { return sf.inputLabels?sf.inputLabels[i]:null },
outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null }, outputLabels: function(i) { return sf.outputLabels?sf.outputLabels[i]:null },
oneditresize: function(size) {
var rows = $("#dialog-form>div:not(.node-input-env-container-row)");
var height = size.height;
for (var i=0; i<rows.size(); i++) {
height -= $(rows[i]).outerHeight(true);
}
var editorRow = $("#dialog-form>div.node-input-env-container-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-env-container").editableList('height',height-80);
},
set:{ set:{
module: "node-red" module: "node-red"
} }

View File

@ -543,20 +543,23 @@ RED.editor = (function() {
function buildEnvForm(container, node) { function buildEnvForm(container, node) {
var env_container = $('#node-input-env-container'); var env_container = $('#node-input-env-container');
env_container env_container
.css('min-height','250px').css('min-width','450px') .css({
'min-height':'150px',
'min-width':'450px'
})
.editableList({ .editableList({
addItem: function(container, i, opt) { addItem: function(container, i, opt) {
var row = $('<div/>').appendTo(container); var row = $('<div/>').appendTo(container);
var nameField = $('<input/>', { var nameField = $('<input/>', {
class: "node-input-env-name", class: "node-input-env-name",
type: "text", type: "text",
style: "margin-length: 5px; width: 32%;", style: "margin-left: 5px; width: calc(40% - 5px)",
placeholder: RED._("editor-tab.name") placeholder: RED._("editor-tab.name")
}).appendTo(row); }).appendTo(row);
var valueField = $('<input/>',{ var valueField = $('<input/>',{
class: "node-input-env-value", class: "node-input-env-value",
type: "text", type: "text",
style: "margin-left: 5px; width: 65%;" style: "margin-left: 5px; width: calc(60% - 5px)"
}).appendTo(row) }).appendTo(row)
valueField.typedInput({default:'str', valueField.typedInput({default:'str',
types:['str','num','bool','json','bin','re','date'] types:['str','num','bool','json','bin','re','date']
@ -2112,9 +2115,17 @@ RED.editor = (function() {
} }
} }
], ],
resize: function(dimensions) { resize: function(size) {
$(".editor-tray-content").height(dimensions.height - 50); // $(".editor-tray-content").height(size.height - 50);
var form = $(".editor-tray-content form").height(dimensions.height - 50 - 40); // var form = $(".editor-tray-content form").height(size.height - 50 - 40);
var rows = $("#dialog-form>div:not(.node-input-env-container-row)");
var height = size.height;
for (var i=0; i<rows.size(); i++) {
height -= $(rows[i]).outerHeight(true);
}
var editorRow = $("#dialog-form>div.node-input-env-container-row");
height -= (parseInt(editorRow.css("marginTop"))+parseInt(editorRow.css("marginBottom")));
$("#node-input-env-container").editableList('height',height-80);
}, },
open: function(tray) { open: function(tray) {
var trayFooter = tray.find(".editor-tray-footer"); var trayFooter = tray.find(".editor-tray-footer");