Skip to content

Commit

Permalink
backport of commit 3ca7288
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefAustin authored Oct 29, 2024
1 parent b9d1c88 commit 1b135f2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/24316.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Fix an issue where cmd+click or ctrl+click would double-open a var
```
18 changes: 16 additions & 2 deletions ui/app/components/variable-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
5 changes: 0 additions & 5 deletions ui/app/controllers/variables/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 1b135f2

Please sign in to comment.