Skip to content

Commit

Permalink
fix some issues with reset search button breaking css (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Bulicek committed Apr 2, 2020
1 parent b4f9c7b commit 537b9a2
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions src/components/universalSearch/searchBar/autosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const ESC = 27;
export default class Autosuggest extends React.Component {
static propTypes = {
uiState: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
options: PropTypes.object,
search: PropTypes.func.isRequired,
serviceStore: PropTypes.object.isRequired,
Expand Down Expand Up @@ -486,7 +487,10 @@ export default class Autosuggest extends React.Component {
this.inputRef.value = '';
this.props.uiState.pendingQuery = [];
this.props.uiState.queries = [];
this.props.search();
this.setState({
inputError: false
});
this.props.history.push('/');
}

render() {
Expand All @@ -509,16 +513,16 @@ export default class Autosuggest extends React.Component {
onFocus={this.handleFocus}
placeholder={uiState.pendingQuery.length ? '' : 'Search tags and services...'}
/>
</div>
{(uiState.queries.length > 0 || uiState.pendingQuery.length > 0) &&
{(uiState.queries.length > 0 || uiState.pendingQuery.length > 0) &&
<div
className="usb-reset-button"
role="button"
tabIndex="-1"
onClick={this.resetSearch}
>Reset Search
</div>
}
}
</div>
<TimeWindowPicker uiState={uiState} />
<SearchSubmit handleSearch={this.handleSearch} />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/universalSearch/searchBar/autosuggest.less
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,6 @@
text-decoration: underline;
cursor: pointer;
position: absolute;
right: 150px;
right: -80px;
top: 10px;
}
3 changes: 2 additions & 1 deletion src/components/universalSearch/searchBar/searchBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const subsystems = (window.haystackUiConfig && window.haystackUiConfig.subsystem
export default class SearchBar extends React.Component {
static propTypes = {
search: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,
handleSearch: PropTypes.func.isRequired
};

Expand Down Expand Up @@ -66,7 +67,7 @@ export default class SearchBar extends React.Component {
render() {
return (
<article className="universal-search-container container">
<Autosuggest search={this.handleSubmit} uiState={uiState} operationStore={OperationStore} serviceStore={ServiceStore} options={SearchableKeysStore.keys} />
<Autosuggest search={this.handleSubmit} history={this.props.history} uiState={uiState} operationStore={OperationStore} serviceStore={ServiceStore} options={SearchableKeysStore.keys} />
</article>
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/universalSearch/universalSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const UniversalSearch = observer(({location, history}) => {
<article className="universal-search-panel">
{window.haystackUiConfig.enableSSO && authenticationStore.timedOut ? <AuthenticationTimeoutModal /> : null}
<Header />
<SearchBar search={search} handleSearch={handleSearch} />
<SearchBar history={history} search={search} handleSearch={handleSearch} />
<Tabs search={search} tabProperties={tabProperties} handleTabSelection={handleTabSelection} history={history} location={location} />
<Footer />
</article>
Expand Down

0 comments on commit 537b9a2

Please sign in to comment.