diff --git a/ui/app/controllers/jobs/index.js b/ui/app/controllers/jobs/index.js index 98ec6ef1a..279b69434 100644 --- a/ui/app/controllers/jobs/index.js +++ b/ui/app/controllers/jobs/index.js @@ -61,11 +61,7 @@ export default Controller.extend(Sortable, Searchable, { optionsDatacenter: computed('visibleJobs.[]', function() { const flatten = (acc, val) => acc.concat(val); - const allDatacenters = new Set( - this.visibleJobs - .mapBy('datacenters') - .reduce(flatten, []) - ); + const allDatacenters = new Set(this.visibleJobs.mapBy('datacenters').reduce(flatten, [])); // Remove any invalid datacenters from the query param/selection const availableDatacenters = Array.from(allDatacenters).compact(); @@ -88,7 +84,7 @@ export default Controller.extend(Sortable, Searchable, { const allNames = this.visibleJobs.mapBy('name'); const nameHistogram = allNames.reduce((hist, name) => { if (hasPrefix.test(name)) { - const prefix = name.match(/(.+?)[-.]/)[1]; + const prefix = name.match(/(.+?)[-._]/)[1]; hist[prefix] = hist[prefix] ? hist[prefix] + 1 : 1; } return hist; diff --git a/ui/tests/acceptance/jobs-list-test.js b/ui/tests/acceptance/jobs-list-test.js index cb7d7e5ad..069151ea0 100644 --- a/ui/tests/acceptance/jobs-list-test.js +++ b/ui/tests/acceptance/jobs-list-test.js @@ -230,13 +230,13 @@ module('Acceptance | jobs list', function(hooks) { async beforeEach() { [ 'pre-one', - 'hashi-one', - 'nmd-one', + 'hashi_one', + 'nmd.one', 'one-alone', - 'pre-two', - 'hashi-two', + 'pre_two', + 'hashi.two', 'hashi-three', - 'nmd-two', + 'nmd_two', 'noprefix', ].forEach(name => { server.create('job', { name, createAllocations: false, childrenCount: 0 });