mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
move inject button off dialog and onto form
This commit is contained in:
parent
845567d1ba
commit
70f975e4f0
@ -692,14 +692,6 @@
|
|||||||
title: node.name || (node._def.label && node._def.label.call(node)) || node._('inject.inject'),
|
title: node.name || (node._def.label && node._def.label.call(node)) || node._('inject.inject'),
|
||||||
width: 'inherit',
|
width: 'inherit',
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
|
||||||
id: 'node-dialog-cancel',
|
|
||||||
class: 'primary',
|
|
||||||
text: node._('inject.userValueButtons.close'),
|
|
||||||
click: function () {
|
|
||||||
RED.tray.close();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: 'node-dialog-apply',
|
id: 'node-dialog-apply',
|
||||||
text: node._('inject.userValueButtons.apply'),
|
text: node._('inject.userValueButtons.apply'),
|
||||||
@ -742,29 +734,44 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'node-dialog-ok',
|
id: 'node-dialog-cancel',
|
||||||
text: node._('inject.userValueButtons.inject'),
|
class: 'primary',
|
||||||
|
text: node._('inject.userValueButtons.close'),
|
||||||
click: function () {
|
click: function () {
|
||||||
var items = $('#node-inject-custom-list').editableList('items');
|
RED.tray.close();
|
||||||
var result = getProps(items);
|
|
||||||
if (result && result.props && result.props.length) {
|
|
||||||
m = { __user_inject_props__: result.props };
|
|
||||||
}
|
|
||||||
doInject(m);
|
|
||||||
//RED.tray.close();
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
resize: function (dimensions) {
|
resize: function (dimensions) {
|
||||||
$('#node-dialog-inject-custom .red-ui-editableList-container').css('height', '');//allow editable list to self size
|
$('#node-dialog-inject-custom .red-ui-editableList-container').css('height', '');//allow editable list to self size
|
||||||
},
|
},
|
||||||
open: function (tray) {
|
open: function (tray) {
|
||||||
var trayBody = tray.find('.red-ui-tray-body');
|
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>');
|
var list = $('<ol id="node-inject-custom-list"></ol>');
|
||||||
dialog.append(list);
|
|
||||||
trayBody.append(dialog);
|
|
||||||
list.css('min-height', '120px').css('min-width', '400px');
|
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 = {
|
var legacyOptions = {
|
||||||
topic: node.topic,
|
topic: node.topic,
|
||||||
payload: node.payload,
|
payload: node.payload,
|
||||||
@ -778,9 +785,6 @@
|
|||||||
}, 5);
|
}, 5);
|
||||||
},
|
},
|
||||||
show: function (tray) {
|
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
|
$('#node-dialog-inject-custom .red-ui-editableList-container').css('height', '');//allow editable list to self size
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@
|
|||||||
},
|
},
|
||||||
"userValueButtons": {
|
"userValueButtons": {
|
||||||
"close": "Close",
|
"close": "Close",
|
||||||
"apply": "Apply",
|
"apply": "Keep Changes",
|
||||||
"inject": "Inject"
|
"inject": "Inject"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user