ui: set * as the default namespace selector (#11357)

This commit is contained in:
Luiz Aoqui 2021-10-21 10:24:07 -04:00 committed by GitHub
parent dceeccfc5d
commit 362c8c54f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 14 additions and 5 deletions

3
.changelog/11357.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
ui: Display jobs from all namespaces by default
```

View File

@ -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 || '*');
});
}

View File

@ -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 || '*');
});
}

View File

@ -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 || '*';
});
}

View File

@ -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');

View File

@ -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);
});

View File

@ -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();

View File

@ -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);