Capital search#1705
Conversation
| }); | ||
| } | ||
|
|
||
| export const getStarredRequests = createSelector( |
There was a problem hiding this comment.
were the rest of these methods unused I take it?
There was a problem hiding this comment.
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.
|
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) |
There was a problem hiding this comment.
Doesn't the exact method have to be called in the all uppercase case too?
There was a problem hiding this comment.
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))); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
selectors/tasks has similar code and it looks like it makes more sense in that file and less sense here.
|
@kwm4385 I pushed it to hs_staging, but forgot to deploy it. I'll do it again once I've addressed the other comments. |
|
🚢 |
andyhuang91
left a comment
There was a problem hiding this comment.
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 |
| if (Utils.isGlobFilter(filter.searchFilter)) { | ||
| const res1 = _.filter(filteredRequests, (requestParent) => { | ||
| return micromatch.any(user.extract(requestParent), `${filter.searchFilter}*`); | ||
| const users = _.filter(filteredRequests, (requestParent) => ( |
There was a problem hiding this comment.
maybe userMatches and idMatches for clarity instead of just users
| 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 |
There was a problem hiding this comment.
comment here is also in the wrong place
|
Okay I've actually correctly deployed it to |
Request and task filtering with all caps
For example, filtering with "HWB" would return something like this: