Skip to content

Commit

Permalink
edit hierarchy to lead with namespace before job
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaiWithJai committed Aug 10, 2021
1 parent 2649d19 commit 00df085
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .changelog/10666.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: Add ability to search across all namespaces
```
6 changes: 3 additions & 3 deletions ui/app/components/global-search/control.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class GlobalSearchControl extends Component {
type: 'job',
id,
namespace,
label: `${name} > ${namespace}`,
label: `${namespace} > ${name}`,
}));

const nodeResults = allNodeResults
Expand All @@ -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
Expand All @@ -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 }) => ({
Expand Down
11 changes: 7 additions & 4 deletions ui/tests/acceptance/search-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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}`);

Expand Down

0 comments on commit 00df085

Please sign in to comment.