-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1860 from HubSpot/y_u_load_so_slow
Make SingularityUI snappier
- Loading branch information
Showing
19 changed files
with
4,095 additions
and
3,606 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,17 @@ | ||
import { FetchRequestsInState } from '../../actions/api/requests'; | ||
import { FetchRequestsInState, FetchRequestIds } from '../../actions/api/requests'; | ||
import { FetchRequestUtilizations } from '../../actions/api/utilization'; | ||
|
||
export const refresh = (state) => (dispatch) => { | ||
const promises = [] | ||
promises.push(dispatch(FetchRequestsInState.trigger(state === 'cleaning' ? 'cleanup' : state, true))); | ||
promises.push(dispatch(FetchRequestUtilizations.trigger())); | ||
return Promise.all(promises); | ||
export const refresh = (state, propertyFilter) => (dispatch) => { | ||
const promises = [] | ||
promises.push(dispatch(FetchRequestsInState.trigger(state === 'cleaning' ? 'cleanup' : state, true, propertyFilter))); | ||
promises.push(dispatch(FetchRequestUtilizations.trigger())); | ||
return Promise.all(promises); | ||
} | ||
|
||
export const initialize = (requestIds) => (dispatch) => { | ||
if (requestIds.isFetching || requestIds.data.length) { | ||
return Promise.resolve(); | ||
} else { | ||
return dispatch(FetchRequestIds.trigger()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { createSelector } from 'reselect'; | ||
import micromatch from 'micromatch'; | ||
import fuzzy from 'fuzzy'; | ||
import Utils from '../utils'; | ||
|
||
const getOptions = (state) => state.options; | ||
const getFilter = (state) => state.filter; | ||
|
||
export default createSelector([getOptions, getFilter], (options, filter) => { | ||
let filteredOptions = options; | ||
const getId = (parent) => parent.id || ''; | ||
if (Utils.isGlobFilter(filter.searchFilter)) { | ||
const idMatches = _.filter(filteredOptions, (parent) => ( | ||
micromatch.isMatch(getId(parent), `${filter.searchFilter}*`) | ||
)); | ||
filteredOptions = idMatches; | ||
} else if (filter.searchFilter) { | ||
// Allow searching by the first letter of each word by applying same | ||
// search heuristics to just the upper case characters of each option | ||
const idMatches = fuzzy.filter(filter.searchFilter, filteredOptions, { | ||
extract: Utils.isAllUpperCase(filter.searchFilter) | ||
? (parent) => Utils.getUpperCaseCharacters(getId(parent)) | ||
: getId, | ||
}); | ||
filteredOptions = Utils.fuzzyFilter(filter.searchFilter, idMatches); | ||
} | ||
return filteredOptions; | ||
}); |
Oops, something went wrong.