From 362c8c54f4664e7d83d94959fcad4c204f6ed0ff Mon Sep 17 00:00:00 2001 From: Luiz Aoqui Date: Thu, 21 Oct 2021 10:24:07 -0400 Subject: [PATCH] ui: set * as the default namespace selector (#11357) --- .changelog/11357.txt | 3 +++ ui/app/controllers/csi/volumes/index.js | 2 +- ui/app/controllers/jobs/index.js | 2 +- ui/app/controllers/optimize.js | 2 +- ui/tests/acceptance/jobs-list-test.js | 3 +++ ui/tests/acceptance/optimize-test.js | 2 +- ui/tests/acceptance/task-detail-test.js | 2 +- ui/tests/acceptance/volumes-list-test.js | 3 +++ 8 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .changelog/11357.txt diff --git a/.changelog/11357.txt b/.changelog/11357.txt new file mode 100644 index 000000000..f1f4c819b --- /dev/null +++ b/.changelog/11357.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Display jobs from all namespaces by default +``` diff --git a/ui/app/controllers/csi/volumes/index.js b/ui/app/controllers/csi/volumes/index.js index da67964c9..eb3b12e78 100644 --- a/ui/app/controllers/csi/volumes/index.js +++ b/ui/app/controllers/csi/volumes/index.js @@ -80,7 +80,7 @@ export default class IndexController extends Controller.extend( // eslint-disable-next-line ember/no-incorrect-calls-with-inline-anonymous-functions scheduleOnce('actions', () => { // eslint-disable-next-line ember/no-side-effects - this.set('qpNamespace', this.system.cachedNamespace || 'default'); + this.set('qpNamespace', this.system.cachedNamespace || '*'); }); } diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js index 4dcf47d62..0fb9e0288 100644 --- a/ui/app/controllers/jobs/index.js +++ b/ui/app/controllers/jobs/index.js @@ -169,7 +169,7 @@ export default class IndexController extends Controller.extend(Sortable, Searcha if (!availableNamespaces.mapBy('key').includes(this.qpNamespace)) { scheduleOnce('actions', () => { // eslint-disable-next-line ember/no-side-effects - this.set('qpNamespace', this.system.cachedNamespace || 'default'); + this.set('qpNamespace', this.system.cachedNamespace || '*'); }); } diff --git a/ui/app/controllers/optimize.js b/ui/app/controllers/optimize.js index eed3f33ea..b5c438a99 100644 --- a/ui/app/controllers/optimize.js +++ b/ui/app/controllers/optimize.js @@ -84,7 +84,7 @@ export default class OptimizeController extends Controller { if (!availableNamespaces.mapBy('key').includes(this.qpNamespace)) { scheduleOnce('actions', () => { // eslint-disable-next-line ember/no-side-effects - this.qpNamespace = this.system.cachedNamespace || 'default'; + this.qpNamespace = this.system.cachedNamespace || '*'; }); } diff --git a/ui/tests/acceptance/jobs-list-test.js b/ui/tests/acceptance/jobs-list-test.js index ada334696..6a0038303 100644 --- a/ui/tests/acceptance/jobs-list-test.js +++ b/ui/tests/acceptance/jobs-list-test.js @@ -162,7 +162,10 @@ module('Acceptance | jobs list', function(hooks) { const job2 = server.create('job', { namespaceId: server.db.namespaces[1].id }); await JobsList.visit(); + assert.equal(JobsList.jobs.length, 2, 'All jobs by default'); + const firstNamespace = server.db.namespaces[0]; + await JobsList.visit({ namespace: firstNamespace.id }); assert.equal(JobsList.jobs.length, 1, 'One job in the default namespace'); assert.equal(JobsList.jobs.objectAt(0).name, job1.name, 'The correct job is shown'); diff --git a/ui/tests/acceptance/optimize-test.js b/ui/tests/acceptance/optimize-test.js index 435d9ae68..1826e33c6 100644 --- a/ui/tests/acceptance/optimize-test.js +++ b/ui/tests/acceptance/optimize-test.js @@ -359,7 +359,7 @@ module('Acceptance | optimize', function(hooks) { window.localStorage.nomadTokenSecret = clientToken.secretId; await Optimize.visit(); - assert.equal(currentURL(), '/jobs?namespace=default'); + assert.equal(currentURL(), '/jobs?namespace=*'); assert.ok(Layout.gutter.optimize.isHidden); }); diff --git a/ui/tests/acceptance/task-detail-test.js b/ui/tests/acceptance/task-detail-test.js index 4a8a92fd4..e15f47b62 100644 --- a/ui/tests/acceptance/task-detail-test.js +++ b/ui/tests/acceptance/task-detail-test.js @@ -298,7 +298,7 @@ module('Acceptance | task detail (different namespace)', function(hooks) { const job = server.db.jobs.find(jobId); await Layout.breadcrumbFor('jobs.index').visit(); - assert.equal(currentURL(), '/jobs?namespace=default', 'Jobs breadcrumb links correctly'); + assert.equal(currentURL(), '/jobs?namespace=*', 'Jobs breadcrumb links correctly'); await Task.visit({ id: allocation.id, name: task.name }); await Layout.breadcrumbFor('jobs.job.index').visit(); diff --git a/ui/tests/acceptance/volumes-list-test.js b/ui/tests/acceptance/volumes-list-test.js index 193d115f0..bec92893f 100644 --- a/ui/tests/acceptance/volumes-list-test.js +++ b/ui/tests/acceptance/volumes-list-test.js @@ -156,7 +156,10 @@ module('Acceptance | volumes list', function(hooks) { const volume2 = server.create('csi-volume', { namespaceId: server.db.namespaces[1].id }); await VolumesList.visit(); + assert.equal(VolumesList.volumes.length, 2); + const firstNamespace = server.db.namespaces[0]; + await VolumesList.visit({ namespace: firstNamespace.id }); assert.equal(VolumesList.volumes.length, 1); assert.equal(VolumesList.volumes.objectAt(0).name, volume1.id);