From 565aae5967878769d0d2b272b3662835887868ba Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 5 Jun 2020 09:51:45 +0100 Subject: [PATCH] Add tooltips to outliner buttons --- .../@node-red/editor-client/locales/en-US/editor.json | 8 ++++++-- .../editor-client/src/js/ui/tab-info-outliner.js | 11 ++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index f71bd2577..57a41fb81 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -20,7 +20,9 @@ "fill": "Fill", "label": "Label", "color": "Color", - "position": "Position" + "position": "Position", + "enable": "Enable", + "disable": "Disable" }, "type": { "string": "string", @@ -595,7 +597,9 @@ "showTips":"You can open the tips from the settings panel", "outline": "Outline", "empty": "empty", - "globalConfig": "Global Configuration Nodes" + "globalConfig": "Global Configuration Nodes", + "triggerAction": "Trigger action", + "find": "Find in workspace" }, "help": { "name": "Help", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js index f9064c65b..9fd08ba3f 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/tab-info-outliner.js @@ -135,11 +135,12 @@ RED.sidebar.info.outliner = (function() { function addControls(n,div) { var controls = $('
',{class:"red-ui-info-outline-item-controls red-ui-info-outline-item-hover-controls"}).appendTo(div); if (n._def.button) { - $('').appendTo(controls).on("click",function(evt) { + var triggerButton = $('').appendTo(controls).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); RED.view.clickNodeButton(n); }) + RED.popover.tooltip(triggerButton,RED._("sidebar.info.triggerAction")); } // $('').appendTo(controls).on("click",function(evt) { // evt.preventDefault(); @@ -147,7 +148,7 @@ RED.sidebar.info.outliner = (function() { // RED.view.reveal(n.id); // }) if (n.type !== 'group' && n.type !== 'subflow') { - $('').appendTo(controls).on("click",function(evt) { + var toggleButton = $('').appendTo(controls).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); if (n.type === 'tab') { @@ -179,6 +180,9 @@ RED.sidebar.info.outliner = (function() { RED.view.redraw(); } }); + RED.popover.tooltip(toggleButton,function() { + return RED._("common.label."+((n.type==='tab' && n.disabled) || (n.type!=='tab' && n.d))?"enable":"disable") + }); } else { $('
').appendTo(controls) } @@ -401,11 +405,12 @@ RED.sidebar.info.outliner = (function() { } function getGutter(n) { var span = $("",{class:"red-ui-info-outline-gutter"}); - $('').appendTo(span).on("click",function(evt) { + var revealButton = $('').appendTo(span).on("click",function(evt) { evt.preventDefault(); evt.stopPropagation(); RED.view.reveal(n.id); }) + RED.popover.tooltip(revealButton,RED._("sidebar.info.find")); return span; } function onNodeAdd(n) {