Merge pull request #5748 from hashicorp/b-ui/prefix-regex
Include the _ prefix separator in both regexes
This commit is contained in:
commit
99205e1865
|
@ -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;
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Reference in a new issue