diff --git a/nodes/config/locales/en-US/ui_base.json b/nodes/config/locales/en-US/ui_base.json index 3f6725af3..dfc4fdbf5 100644 --- a/nodes/config/locales/en-US/ui_base.json +++ b/nodes/config/locales/en-US/ui_base.json @@ -7,6 +7,7 @@ "layout": { "pages": "Pages", "edit": "Edit", + "focus": "Focus", "collapse": "Collapse", "expand": "Expand" }, diff --git a/nodes/config/ui_base.html b/nodes/config/ui_base.html index 10365c221..b159f6d4d 100644 --- a/nodes/config/ui_base.html +++ b/nodes/config/ui_base.html @@ -79,6 +79,8 @@ .nrdb2-sb-list-header-button-group { position: absolute; right: 1rem; + display: flex; + gap: 4px; } .nrdb2-sb-list-header-button-group, .nrdb2-sb-list-handle { @@ -258,10 +260,19 @@ * @param {Object} row - The page/group/widget that these actions are bound to */ function addRowActions (row, item) { + const configNodes = ['ui-base', 'ui-page', 'ui-group'] const btnGroup = $('
', { class: 'nrdb2-sb-list-header-button-group', id: item.id }).appendTo(row) - const editButton = $(' ' + c_('layout.edit') + '').appendTo(btnGroup) + if (!configNodes.includes(item.type)) { + const focusButton = $(' ' + c_('layout.focus') + '').appendTo(btnGroup) + focusButton.on('click', function (evt) { + RED.view.reveal(item.id) + evt.stopPropagation() + evt.preventDefault() + }) + } + const editButton = $(' ' + c_('layout.edit') + '').appendTo(btnGroup) editButton.on('click', function (evt) { - if (item.type === 'ui-page' || item.type === 'ui-group') { + if (configNodes.includes(item.type)) { RED.editor.editConfig('', item.type, item.id) } else { RED.editor.edit(item) @@ -348,8 +359,8 @@ const titleRow = $('
', { class: 'nrdb2-sb-list-header nrdb2-sb-widgets-list-header' }).appendTo(container) $('').appendTo(titleRow) - const groupicon = 'fa-image' - $('', { class: 'nrdb2-sb-icon nrdb2-sb-widget-icon fa ' + groupicon }).appendTo(titleRow) + const widgeticon = 'fa-image' + $('', { class: 'nrdb2-sb-icon nrdb2-sb-widget-icon fa ' + widgeticon }).appendTo(titleRow) $('', { class: 'nrdb2-sb-title' }).text(widget.name || widget.label || widget.type || widget.id).appendTo(titleRow) addRowActions(titleRow, widget)