diff --git a/.changelog/10666.txt b/.changelog/10666.txt new file mode 100644 index 000000000..2b2d74d52 --- /dev/null +++ b/.changelog/10666.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: Add ability to search across all namespaces +``` diff --git a/ui/app/components/global-search/control.js b/ui/app/components/global-search/control.js index 653617cdd..8f3967cca 100644 --- a/ui/app/components/global-search/control.js +++ b/ui/app/components/global-search/control.js @@ -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 }) => ({ diff --git a/ui/tests/acceptance/search-test.js b/ui/tests/acceptance/search-test.js index 45238e954..635aa0ee9 100644 --- a/ui/tests/acceptance/search-test.js +++ b/ui/tests/acceptance/search-test.js @@ -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}`);