diff options
author | Zuul <zuul@review.opendev.org> | 2020-11-23 06:17:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2020-11-23 06:17:23 +0000 |
commit | 213b1867f574257adf3c2b66f16be2e472cf3e75 (patch) | |
tree | 3740ac224281fbbfd4eab3238e5faaa185672cbf /web/src/pages | |
parent | ebad14f1f97821e80e957e94d34ddafdefb0c724 (diff) | |
parent | 75173d7b6beb4af58f101f59d28b6b43aa0b33a3 (diff) | |
download | zuul-213b1867f574257adf3c2b66f16be2e472cf3e75.tar.gz |
Merge "web: store status filter in the location hash"
Diffstat (limited to 'web/src/pages')
-rw-r--r-- | web/src/pages/Status.jsx | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/web/src/pages/Status.jsx b/web/src/pages/Status.jsx index dd83ba7e5..38490a923 100644 --- a/web/src/pages/Status.jsx +++ b/web/src/pages/Status.jsx @@ -28,6 +28,7 @@ import { PageSection, PageSectionVariants } from '@patternfly/react-core' import { fetchStatusIfNeeded } from '../actions/status' import Pipeline from '../containers/status/Pipeline' import { Fetchable } from '../containers/Fetching' +import { removeHash } from '../Misc' class StatusPage extends React.Component { @@ -57,7 +58,6 @@ class StatusPage extends React.Component { constructor () { super() - this.filterLoaded = false this.timer = null this.visible = true @@ -125,9 +125,15 @@ class StatusPage extends React.Component { } setFilter = (filter) => { + // Update form ref value this.filter.value = filter + // Store value in location + if (filter) { + window.location.hash = '#' + filter + } else { + removeHash() + } this.setState({filter: filter}) - localStorage.setItem('zuul_filter_string', filter) } handleKeyPress = (e) => { @@ -144,15 +150,11 @@ class StatusPage extends React.Component { } loadState = () => { - let filter = localStorage.getItem('zuul_filter_string') || '' + const filter = this.props.location.hash ? this.props.location.hash.slice(1) : null let expanded = localStorage.getItem('zuul_expand_by_default') || false if (typeof expanded === 'string') { expanded = (expanded === 'true') } - - if (this.props.location.hash) { - filter = this.props.location.hash.slice(1) - } if (filter || expanded) { this.setState({ filter: filter, @@ -193,10 +195,6 @@ class StatusPage extends React.Component { const { remoteData } = this.props const { filter, expanded } = this.state const status = remoteData.status - if (this.filter && !this.filterLoaded && filter) { - this.filterLoaded = true - this.filter.value = filter - } const statusControl = ( <Form inline> <FormGroup controlId='status'> |