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

Commit

Permalink
fix(ui): manage fullscreen even with iframe navigation (#6976)
Browse files Browse the repository at this point in the history
* fix

* fullscreen double refresh fix
  • Loading branch information
danielhalupka authored and kduret committed Dec 6, 2018
1 parent a226495 commit 3eed8b9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
16 changes: 15 additions & 1 deletion www/front_src/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ class App extends Component {
}

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

removeFullscreenParams = () => {
if(history.location.pathname == '/centreon/main.php'){
history.push({
pathname: '/centreon/main.php',
search: window['fullscreenParams']
})
}
delete window['fullscreenParams'];
}

// get allowed routes
Expand Down Expand Up @@ -99,6 +112,7 @@ class App extends Component {
<div id="fullscreen-wrapper">
<Fullscreen
enabled={this.state.isFullscreenEnabled}
onClose={this.removeFullscreenParams}
onChange={isFullscreenEnabled => this.setState({isFullscreenEnabled})}>
<div className="full-screenable-node">
<div className="main-content">
Expand Down
10 changes: 8 additions & 2 deletions www/front_src/src/route-components/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,16 @@ class ModuleRoute extends Component {
}

render() {
const { contentHeight, loading } = this.state
const { contentHeight, loading } = this.state;
const { history } = this.props,
{ search } = history.location;
const params = search || '';
let params;
if(window['fullscreenParams']){
params = '?';
params += window['fullscreenParams'] || '';
}else{
params = search || '';
}
return (
<>
{loading &&
Expand Down

0 comments on commit 3eed8b9

Please sign in to comment.