edit hierarchy to lead with namespace before job

This commit is contained in:
Jai Bhagat 2021-08-09 17:50:49 -04:00
parent e7f0cd28f3
commit a9b9132f35
3 changed files with 13 additions and 7 deletions

3
.changelog/10666.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: Add ability to search across all namespaces
```

View File

@ -64,7 +64,7 @@ export default class GlobalSearchControl extends Component {
type: 'job',
id,
namespace,
label: `${name} > ${namespace}`,
label: `${namespace} > ${name}`,
}));
const nodeResults = allNodeResults
@ -80,7 +80,7 @@ export default class GlobalSearchControl extends Component {
.map(({ ID: name, Scope: [namespace, id] }) => ({
type: 'allocation',
id,
label: `${name} > ${namespace}`,
label: `${namespace} > ${name}`,
}));
const taskGroupResults = allTaskGroupResults
@ -90,7 +90,7 @@ export default class GlobalSearchControl extends Component {
id,
namespace,
jobId,
label: id,
label: `${namespace} > ${jobId} > ${id}`,
}));
const csiPluginResults = allCSIPluginResults.slice(0, MAXIMUM_RESULTS).map(({ ID: id }) => ({

View File

@ -46,8 +46,8 @@ module('Acceptance | search', function(hooks) {
search.groups[0].as(jobs => {
assert.equal(jobs.name, 'Jobs (2)');
assert.equal(jobs.options.length, 2);
assert.equal(jobs.options[0].text, 'vwxyz > default');
assert.equal(jobs.options[1].text, 'xyz job > default');
assert.equal(jobs.options[0].text, 'default > vwxyz');
assert.equal(jobs.options[1].text, 'default > xyz job');
});
search.groups[1].as(clients => {
@ -83,13 +83,16 @@ module('Acceptance | search', function(hooks) {
await selectSearch(Layout.navbar.search.scope, firstAllocation.name);
assert.equal(
Layout.navbar.search.groups[2].options[0].text,
`${firstAllocation.name} > ${firstAllocation.namespace}`
`${firstAllocation.namespace} > ${firstAllocation.name}`
);
await Layout.navbar.search.groups[2].options[0].click();
assert.equal(currentURL(), `/allocations/${firstAllocation.id}`);
await selectSearch(Layout.navbar.search.scope, firstTaskGroup.name);
assert.equal(Layout.navbar.search.groups[3].options[0].text, firstTaskGroup.name);
assert.equal(
Layout.navbar.search.groups[3].options[0].text,
`default > vwxyz > ${firstTaskGroup.name}`
);
await Layout.navbar.search.groups[3].options[0].click();
assert.equal(currentURL(), `/jobs/vwxyz/${firstTaskGroup.name}`);