Replace dashes with underscores when searching for matching hosts #1178

Merged
merged 2 commits into from Aug 2, 2016

Conversation

Projects
None yet
2 participants
@Calvinp
Contributor

Calvinp commented Jul 28, 2016

Sometimes hostnames are presented with dashes, sometimes with underscores. On the tasks page they are presented with underscores. Because of this, when linked from a page where they're presented with dashes, no match would be found. This fixes that.

@Calvinp

This comment has been minimized.

Show comment
Hide comment
Contributor

Calvinp commented Jul 28, 2016

SingularityUI/app/selectors/tasks.es6
@@ -68,7 +68,7 @@ export const getFilteredTasks = createSelector(
_.each(tasks, (t) => {
t.id = id.extract(t);
});
- const hostMatch = fuzzy.filter(filter.filterText, tasks, host);
+ const hostMatch = fuzzy.filter(filter.filterText.split('-').join('_'), tasks, host);

This comment has been minimized.

@tpetr

tpetr Aug 2, 2016

Member

why split() and join() vs. replace()?

@tpetr

tpetr Aug 2, 2016

Member

why split() and join() vs. replace()?

This comment has been minimized.

@Calvinp

Calvinp Aug 2, 2016

Contributor

Because I didn't realize I could use a /g flag to make the replacement global.

@Calvinp

Calvinp Aug 2, 2016

Contributor

Because I didn't realize I could use a /g flag to make the replacement global.

@tpetr

This comment has been minimized.

Show comment
Hide comment
@tpetr

tpetr Aug 2, 2016

Member

LGTM

Member

tpetr commented Aug 2, 2016

LGTM

@Calvinp Calvinp merged commit f63ba0d into decaf Aug 2, 2016

0 of 2 checks passed

continuous-integration/travis-ci/push The Travis CI build could not complete due to an error
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@Calvinp Calvinp deleted the tasks_page_dashes_count_as_underscores_for_hosts branch Aug 2, 2016

@tpetr tpetr modified the milestone: 0.10.0 Aug 18, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment