issue-107: Modify Searcher to keep track of when a search is being performed and update BusyIndicator component#106
issue-107: Modify Searcher to keep track of when a search is being performed and update BusyIndicator component#106nikhilj13 wants to merge 7 commits intoattivio:masterfrom nikhilj13:show-spinner-while-searching
Conversation
- Added a new state isSearching in Searcher.js to keep track of when a search is being done - Added a new Spinner component
updated class name
- Added displayName to Spinner - Added Spinner to the styleguide
There was a problem hiding this comment.
Does the BusyIndicator component not do what you wanted this to do?
https://attivio.github.io/suit/styleguide/index.html#busyindicator
If you need to be able to use a custom image, can you change the existing one to take a property?
src/components/Searcher.js
Outdated
| type SearcherProps = { | ||
| location: PropTypes.object.isRequired; | ||
| history: PropTypes.object.isRequired; | ||
| location: PropTypes.object.isRequired, |
There was a problem hiding this comment.
Why are all of these semicolons changed into commas? Was this your formatter issue?
There was a problem hiding this comment.
Yes, but I'm not getting any lint errors because of this
src/components/Searcher.js
Outdated
| return facetFilters.map((facetFilter: FacetFilter): string => { | ||
| return `${facetFilter.facetName},+${facetFilter.bucketLabel},+${facetFilter.filter}`; | ||
| }); | ||
| return facetFilters.map( |
There was a problem hiding this comment.
Ditto here and in deserializeFacetFilter() below... it'll be good to revert this formatting change which is unnecessary, to make it simpler to do merges.
There was a problem hiding this comment.
Okay, I'll revert it.
src/components/Searcher.js
Outdated
| this.props.history.push(`?${updatedQueryString}`); | ||
| } | ||
| }); | ||
| const localCallBack = () => { |
There was a problem hiding this comment.
I was going to say "Can you name this something more descriptive?" Although, I think it's clearer what you're doing if you just include this function inline as the second parameter to setState(). For example:
this.setState({
isSearching: true,
}, () => {
// start the search...
});
There was a problem hiding this comment.
Sure, makes sense
- Fixed formaating issues
fixed formatting
luigivaldez
left a comment
There was a problem hiding this comment.
See inline comments.... Will add comments to the Search UI side of this too...
| if (state.debug !== this.props.debug) { | ||
| basicState.debug = state.debug; | ||
| } | ||
| basicState.isSearching = this.state.isSearching; |
There was a problem hiding this comment.
I don't think it makes sense to save the isSearching flag in the URL...
| return ( | ||
| <div className="attivio-spinner"> | ||
| {this.renderBusySymbol()} | ||
| <br /> |
There was a problem hiding this comment.
If there's no messageToShow, you probably don't want to add these <br>s and the message at all.
| import Configurable from './Configurable'; | ||
| import spinnyImage from '../img/spinner.gif'; | ||
|
|
||
| type BusyIndicatorType = 'ellipsis' | 'spinny'; |
There was a problem hiding this comment.
You need to add 'spinnyCentered' here...
Adds a new state variable isSearching to the searcher to keep track of when the system is searching. Also updates the BusyIndicator component to have a 'spinnyCentered' type spinner that can be shown when a search is being performed.
Below is an example of BusyIndicator with type 'spinnyCentered' being used in SearchUI:

BusyIndicator is configurable through SearchUI's configuration.properties file. Here is an example: