Skip to content

Capital search#1705

Merged
benheng merged 7 commits into
masterfrom
capital-search
Feb 20, 2018
Merged

Capital search#1705
benheng merged 7 commits into
masterfrom
capital-search

Conversation

@benheng
Copy link
Copy Markdown
Contributor

@benheng benheng commented Feb 6, 2018

Request and task filtering with all caps
For example, filtering with "HWB" would return something like this:

HelloWorldBen
LookHeyWheresBillyGoneTo

@benheng benheng requested review from kwm4385 and ssalinas and removed request for ssalinas February 9, 2018 21:59
});
}

export const getStarredRequests = createSelector(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

were the rest of these methods unused I take it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah none of these were used anywhere and I was wondering if it was duplicated by selectors/requests/filterSelector but now I'm not sure. It looks like it has selectors for some incomplete features, like getStarredRequests. I preferring removing unused code, but I can see how this could be helpful for completing some feature requests.

Copy link
Copy Markdown
Contributor

@ssalinas ssalinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will let @kwm4385 have the final word, but seems fine to me, and will match closer to the matching in our deployer 👍

@kwm4385
Copy link
Copy Markdown
Contributor

kwm4385 commented Feb 12, 2018

This doesn't seem to be working on staging, did you deploy after merging there?

// search heuristics to just the upper case characters of each option
const options = {
extract: Utils.isAllUpperCase(filter.searchFilter)
? (requestParent) => Utils.getUpperCaseCharacters(requestParent.id)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't the exact method have to be called in the all uppercase case too?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the extract method. In the uppercase case, it's returning only the capitals of each request.

filteredRequests = _.union(res1, res2).reverse();
} else {
_.each(filteredRequests, (requestParent) => {requestParent.id = id.extract(requestParent);});
_.each(filteredRequests, (requestParent) => (requestParent.id = id.extract(requestParent)));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning a value in _.each shouldn't do anything so I'm not sure why this change was necessary. The existing code is pretty unclear about what this loop actually does. There appears to be some sort of side effect with the extract function. Would it be easy to clean up the existing code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I did seem to make it less clear since now it's returning something and we don't use it. it was unclear to begin so I'll see if I can clean it up.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectors/tasks has similar code and it looks like it makes more sense in that file and less sense here.

@benheng
Copy link
Copy Markdown
Contributor Author

benheng commented Feb 12, 2018

@kwm4385 I pushed it to hs_staging, but forgot to deploy it. I'll do it again once I've addressed the other comments.

@kwm4385
Copy link
Copy Markdown
Contributor

kwm4385 commented Feb 12, 2018

🚢

Copy link
Copy Markdown

@andyhuang91 andyhuang91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor comments. Overall this looks good. 👍

filteredRequests = _.union(users, ids);
} else {
// Allow searching by the first letter of each word by applying same
// search heuristics to just the upper case characters of each option
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is in wrong place

if (Utils.isGlobFilter(filter.searchFilter)) {
const res1 = _.filter(filteredRequests, (requestParent) => {
return micromatch.any(user.extract(requestParent), `${filter.searchFilter}*`);
const users = _.filter(filteredRequests, (requestParent) => (
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe userMatches and idMatches for clarity instead of just users

Comment thread SingularityUI/app/selectors/tasks.es6 Outdated
tasks = _.union(hosts, ids, racks);
} else {
// Allow searching by the first letter of each word by applying same
// search heuristics to just the upper case characters of each option
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment here is also in the wrong place

@benheng
Copy link
Copy Markdown
Contributor Author

benheng commented Feb 12, 2018

Okay I've actually correctly deployed it to hs_staging this time.

@ssalinas ssalinas added this to the 0.20.0 milestone Feb 15, 2018
@benheng benheng merged commit 7813c11 into master Feb 20, 2018
@benheng benheng deleted the capital-search branch February 20, 2018 16:48
@ssalinas ssalinas modified the milestones: 0.20.0, 0.19.0 Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants