mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Check for target on click to prevent double-opening cmd+clicked links on jobs index (#23832)
This commit is contained in:
3
.changelog/23832.txt
Normal file
3
.changelog/23832.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
ui: Fix an issue where cmd+click or ctrl+click would double-open a job
|
||||
```
|
||||
@@ -12,6 +12,8 @@ import { tracked } from '@glimmer/tracking';
|
||||
import localStorageProperty from 'nomad-ui/utils/properties/local-storage';
|
||||
import { restartableTask, timeout } from 'ember-concurrency';
|
||||
import Ember from 'ember';
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
import JobModel from '../../models/job';
|
||||
|
||||
const JOB_LIST_THROTTLE = 5000;
|
||||
const JOB_DETAILS_THROTTLE = 1000;
|
||||
@@ -62,8 +64,20 @@ export default class JobsIndexController extends Controller {
|
||||
@tracked pendingJobs = null;
|
||||
@tracked pendingJobIDs = null;
|
||||
|
||||
/**
|
||||
* Trigger can either be the pointer event itself, or if the keyboard shorcut was used, the html element corresponding to the job.
|
||||
* @param {JobModel} job
|
||||
* @param {PointerEvent|HTMLElement} trigger
|
||||
*/
|
||||
@action
|
||||
gotoJob(job) {
|
||||
gotoJob(job, 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('jobs.job.index', job.idWithNamespace);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user