/*::
props: {
children?: React.Element<*>,
- router: { push: (path: string) => void }
+ router: { push: ({ pathname: string, query?: { return_to: string } }) => void }
};
*/
- state = {
- loading: true
- };
+ state = { loading: true };
componentDidMount() {
getSystemStatus().then(r => {
if (r.status === 'UP') {
this.setState({ loading: false });
} else {
- this.props.router.push('/maintenance');
+ this.props.router.push({
+ pathname: '/maintenance',
+ query: {
+ return_to: window.location.pathname + window.location.search + window.location.hash
+ }
+ });
}
});
}
import * as React from 'react';
import init from '../init';
-export default class MaintenanceAppContainer extends React.PureComponent {
+interface Props {
+ location: { query: { return_to: string } };
+}
+
+export default class MaintenanceAppContainer extends React.PureComponent<Props> {
componentDidMount() {
- init(this.refs.container, false);
+ init(this.refs.container, false, this.props.location.query['return_to']);
}
render() {
import * as React from 'react';
import init from '../init';
-export default class SetupAppContainer extends React.PureComponent {
+interface Props {
+ location: { query: { return_to: string } };
+}
+
+export default class SetupAppContainer extends React.PureComponent<Props> {
componentDidMount() {
- init(this.refs.container, true);
+ init(this.refs.container, true, this.props.location.query['return_to']);
}
render() {
mainView.render().refresh();
});
-export default function(el, setup) {
- App.start({ el, setup });
+export default function(el, setup, returnTo) {
+ App.start({ el, setup, returnTo });
}
this.stopPolling();
}
if (this.model.get('status') === 'UP' && this.wasStarting) {
- this.goHome();
+ this.loadPreviousPage();
}
if (this.model.get('state') === 'MIGRATION_SUCCEEDED') {
- this.goHome();
+ this.loadPreviousPage();
}
});
},
);
},
- goHome() {
+ loadPreviousPage() {
setInterval(() => {
- window.location = window.baseUrl + '/';
+ window.location = window.baseUrl + (this.options.returnTo || '/');
}, 2500);
},