Merge pull request #5748 from hashicorp/b-ui/prefix-regex

Include the _ prefix separator in both regexes
This commit is contained in:
Michael Lange 2019-05-21 14:44:14 -07:00 committed by GitHub
commit 99205e1865
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 11 deletions

View File

@ -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;

View File

@ -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 });