move inject button off dialog and onto form

This commit is contained in:
Steve-Mcl 2021-05-21 13:26:50 +01:00
parent 845567d1ba
commit 70f975e4f0
2 changed files with 29 additions and 25 deletions

View File

@ -692,14 +692,6 @@
title: node.name || (node._def.label && node._def.label.call(node)) || node._('inject.inject'),
width: 'inherit',
buttons: [
{
id: 'node-dialog-cancel',
class: 'primary',
text: node._('inject.userValueButtons.close'),
click: function () {
RED.tray.close();
}
},
{
id: 'node-dialog-apply',
text: node._('inject.userValueButtons.apply'),
@ -742,29 +734,44 @@
}
},
{
id: 'node-dialog-ok',
text: node._('inject.userValueButtons.inject'),
id: 'node-dialog-cancel',
class: 'primary',
text: node._('inject.userValueButtons.close'),
click: function () {
var items = $('#node-inject-custom-list').editableList('items');
var result = getProps(items);
if (result && result.props && result.props.length) {
m = { __user_inject_props__: result.props };
}
doInject(m);
//RED.tray.close();
RED.tray.close();
}
}
},
],
resize: function (dimensions) {
$('#node-dialog-inject-custom .red-ui-editableList-container').css('height', '');//allow editable list to self size
},
open: function (tray) {
var trayBody = tray.find('.red-ui-tray-body');
var dialog = $('<div id="node-dialog-inject-custom"></div>');
// var dialog = $('<div id="node-dialog-inject-custom"></div>');
var dialog = $('<div id="dialog-form" class="form-horizontal"></div>');
var row1 = $('<div class="form-row" style="text-align: right;"></div>');
var button = $('<button class="ui-button ui-corner-all ui-widget" id="node-inject-inject"></button>');
button.text(node._('inject.userValueButtons.inject'));
row1.append(button);
var row2 = $('<div class="form-row"></div>');
var list = $('<ol id="node-inject-custom-list"></ol>');
dialog.append(list);
trayBody.append(dialog);
list.css('min-height', '120px').css('min-width', '400px');
row2.append(list);
dialog.append(row1);
dialog.append(row2);
trayBody.append(dialog);
button.on("click", function() {
var items = $('#node-inject-custom-list').editableList('items');
var result = getProps(items);
if (result && result.props && result.props.length) {
m = { __user_inject_props__: result.props };
}
doInject(m);
});
var legacyOptions = {
topic: node.topic,
payload: node.payload,
@ -778,9 +785,6 @@
}, 5);
},
show: function (tray) {
//primary button is the cancel button but, for aestetics, colour the inject button.
$('#node-dialog-cancel').removeClass('primary');
$('#node-dialog-ok').addClass('primary');
$('#node-dialog-inject-custom .red-ui-editableList-container').css('height', '');//allow editable list to self size
}
}

View File

@ -88,7 +88,7 @@
},
"userValueButtons": {
"close": "Close",
"apply": "Apply",
"apply": "Keep Changes",
"inject": "Inject"
}
},