Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(ui): keep anchor in url on refresh (#7013)
Browse files Browse the repository at this point in the history
* fix(ui): keep anchor in url on refresh

* fix(front): fix fullscreen with anchor
  • Loading branch information
kduret authored Dec 6, 2018
1 parent 8d08320 commit 3f4c5b3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
15 changes: 8 additions & 7 deletions www/front_src/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,19 @@ class App extends Component {
}

goFull = () => {
window['fullscreenParams'] = window.location.search.split('?')[1] || '';
setTimeout(()=>{
const { search, hash } = history.location
window['fullscreenParams'] = (search.split('?')[1] || '') + (hash || '')
setTimeout(() => {
this.setState({ isFullscreenEnabled: true });
},200)
}, 200)
}

removeFullscreenParams = () => {
if(history.location.pathname == '/centreon/main.php'){
if (history.location.pathname == '/centreon/main.php') {
history.push({
pathname: '/centreon/main.php',
search: window['fullscreenParams']
})
pathname: '/centreon/main.php',
search: window['fullscreenParams']
})
}
delete window['fullscreenParams'];
}
Expand Down
16 changes: 8 additions & 8 deletions www/front_src/src/route-components/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ class ModuleRoute extends Component {
render() {
const { contentHeight, loading } = this.state;
const { history } = this.props,
{ search } = history.location;
let params;
if(window['fullscreenParams']){
params = '?';
params += window['fullscreenParams'] || '';
}else{
params = search || '';
}
{ search, hash } = history.location;
let params;
if (window['fullscreenParams']) {
params = '?';
params += window['fullscreenParams'] || '';
} else {
params = (search || '') + (hash || '');
}
return (
<>
{loading &&
Expand Down

0 comments on commit 3f4c5b3

Please sign in to comment.