From 1b135f2ee57bd9785308079fa604ae7a08e554d7 Mon Sep 17 00:00:00 2001 From: Austin Culter Date: Tue, 29 Oct 2024 19:50:09 +0000 Subject: [PATCH] backport of commit 3ca728819bdeb7340fa980e7f3db879f8544782f --- .changelog/24316.txt | 3 +++ ui/app/components/variable-paths.js | 18 ++++++++++++++++-- ui/app/controllers/variables/index.js | 5 ----- 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 .changelog/24316.txt diff --git a/.changelog/24316.txt b/.changelog/24316.txt new file mode 100644 index 00000000000..4cf0785f6ae --- /dev/null +++ b/.changelog/24316.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Fix an issue where cmd+click or ctrl+click would double-open a var +``` diff --git a/ui/app/components/variable-paths.js b/ui/app/components/variable-paths.js index 3b5719b6459..abdb5a83739 100644 --- a/ui/app/components/variable-paths.js +++ b/ui/app/components/variable-paths.js @@ -26,13 +26,27 @@ export default class VariablePathsComponent extends Component { } @action - async handleFolderClick(path) { + async handleFolderClick(path, trigger) { + // Don't navigate if the user clicked on a link; this will happen with modifier keys like cmd/ctrl on the link itself + if ( + trigger instanceof PointerEvent && + /** @type {HTMLElement} */ (trigger.target).tagName === 'A' + ) { + return; + } this.router.transitionTo('variables.path', path); } @action - async handleFileClick({ path, variable: { id, namespace } }) { + async handleFileClick({ path, variable: { id, namespace } }, trigger) { if (this.can.can('read variable', null, { path, namespace })) { + // Don't navigate if the user clicked on a link; this will happen with modifier keys like cmd/ctrl on the link itself + if ( + trigger instanceof PointerEvent && + /** @type {HTMLElement} */ (trigger.target).tagName === 'A' + ) { + return; + } this.router.transitionTo('variables.variable', id); } } diff --git a/ui/app/controllers/variables/index.js b/ui/app/controllers/variables/index.js index deddbb910d2..b214b342f56 100644 --- a/ui/app/controllers/variables/index.js +++ b/ui/app/controllers/variables/index.js @@ -15,11 +15,6 @@ export default class VariablesIndexController extends Controller { isForbidden = false; - @action - goToVariable(variable) { - this.router.transitionTo('variables.variable', variable.path); - } - @action goToNewVariable() { this.router.transitionTo('variables.new'); }