mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Apply suggestions from code review
This commit is contained in:
parent
6e7fa6f921
commit
affa8ea42b
@ -341,8 +341,8 @@ RED.editor = (function() {
|
||||
nodeValue = node[property]
|
||||
}
|
||||
|
||||
const addBtnId = `${prefix}-add-${property}`;
|
||||
const editBtnId = `${prefix}-lookup-${property}`;
|
||||
const addBtnId = `${prefix}-btn-${property}-add`;
|
||||
const editBtnId = `${prefix}-btn-${property}-edit`;
|
||||
const selectId = prefix + '-' + property;
|
||||
const input = $(`#${selectId}`);
|
||||
if (input.length === 0) {
|
||||
@ -374,10 +374,13 @@ RED.editor = (function() {
|
||||
.css({ "margin-left": "10px" })
|
||||
.appendTo(outerWrap);
|
||||
|
||||
RED.popover.tooltip(editButton, RED._('editor.editConfig', { type }));
|
||||
|
||||
// create the add button
|
||||
const addButton = $('<a id="' + addBtnId + '-add" class="red-ui-button"><i class="fa fa-plus"></i></a>')
|
||||
const addButton = $('<a id="' + addBtnId + '" class="red-ui-button"><i class="fa fa-plus"></i></a>')
|
||||
.css({ "margin-left": "10px" })
|
||||
.appendTo(outerWrap);
|
||||
RED.popover.tooltip(addButton, RED._('editor.addNewConfig', { type }));
|
||||
|
||||
const disableButton = function(button, disabled) {
|
||||
$(button).prop("disabled", !!disabled)
|
||||
@ -409,6 +412,9 @@ RED.editor = (function() {
|
||||
} else if (optionsLength === 1 && selectedOpt.val() === "_ADD_") {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, true);
|
||||
} else if (selectedOpt.val() === "") {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, true);
|
||||
} else {
|
||||
disableButton(addButton, false);
|
||||
disableButton(editButton, false);
|
||||
@ -917,6 +923,8 @@ RED.editor = (function() {
|
||||
|
||||
if (!configNodes.length) {
|
||||
select.append('<option value="_ADD_" selected>' + RED._("editor.addNewType", { type: label }) + '</option>');
|
||||
} else {
|
||||
select.append('<option value="">' + RED._("editor.inputs.none") + '</option>');
|
||||
}
|
||||
|
||||
window.setTimeout(function() { select.trigger("change");},50);
|
||||
|
Loading…
x
Reference in New Issue
Block a user