Ivan - Add maintenance mode structure [skip ci]
This commit is contained in:
parent
bac7ea444e
commit
e842755b9e
|
@ -59,6 +59,14 @@ class App extends React.Component {
|
||||||
loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff,
|
loggedInStaff: !_.includes(props.location.pathname, '/admin/panel') && props.session.logged && props.session.staff,
|
||||||
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
|
loggedOutStaff: _.includes(props.location.pathname, '/admin/panel') && !props.session.logged
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(props.config['maintenance-mode'] && !_.includes(props.location.pathname, '/admin') && !_.includes(props.location.pathname, '/maintenance')) {
|
||||||
|
browserHistory.push('/maintenance');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!props.config['maintenance-mode'] && _.includes(props.location.pathname, '/maintenance')) {
|
||||||
|
browserHistory.push('/');
|
||||||
|
}
|
||||||
|
|
||||||
if (validations.languageChanged) {
|
if (validations.languageChanged) {
|
||||||
browserHistory.push(props.location.pathname);
|
browserHistory.push(props.location.pathname);
|
||||||
|
|
|
@ -11,6 +11,7 @@ import MainLayout from 'app/main/main-layout';
|
||||||
import MainHomePage from 'app/main/main-home/main-home-page';
|
import MainHomePage from 'app/main/main-home/main-home-page';
|
||||||
import MainSignUpPage from 'app/main/main-signup/main-signup-page';
|
import MainSignUpPage from 'app/main/main-signup/main-signup-page';
|
||||||
import MainRecoverPasswordPage from 'app/main/main-recover-password/main-recover-password-page';
|
import MainRecoverPasswordPage from 'app/main/main-recover-password/main-recover-password-page';
|
||||||
|
import MainMaintenancePage from 'app/main/main-maintenance-page';
|
||||||
|
|
||||||
import DashboardLayout from 'app/main/dashboard/dashboard-layout';
|
import DashboardLayout from 'app/main/dashboard/dashboard-layout';
|
||||||
import DashboardListTicketsPage from 'app/main/dashboard/dashboard-list-tickets/dashboard-list-tickets-page';
|
import DashboardListTicketsPage from 'app/main/dashboard/dashboard-list-tickets/dashboard-list-tickets-page';
|
||||||
|
@ -59,6 +60,7 @@ export default (
|
||||||
<IndexRoute component={MainHomePage} />
|
<IndexRoute component={MainHomePage} />
|
||||||
<Route path='signup' component={MainSignUpPage}/>
|
<Route path='signup' component={MainSignUpPage}/>
|
||||||
<Route path='recover-password' component={MainRecoverPasswordPage}/>
|
<Route path='recover-password' component={MainRecoverPasswordPage}/>
|
||||||
|
<Route path='maintenance' component={MainMaintenancePage}/>
|
||||||
<Route path='dashboard' component={DashboardLayout}>
|
<Route path='dashboard' component={DashboardLayout}>
|
||||||
<IndexRoute component={DashboardListTicketsPage} />
|
<IndexRoute component={DashboardListTicketsPage} />
|
||||||
<Route path='articles' component={DashboardListArticlesPage}/>
|
<Route path='articles' component={DashboardListArticlesPage}/>
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
class MainMaintenancePage extends React.Component {
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
Maintenance
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default MainMaintenancePage;
|
|
@ -8,6 +8,7 @@ module.exports = [
|
||||||
data: {
|
data: {
|
||||||
'language': 'en',
|
'language': 'en',
|
||||||
'reCaptchaKey': '6LfM5CYTAAAAAGLz6ctpf-hchX2_l0Ge-Bn-n8wS',
|
'reCaptchaKey': '6LfM5CYTAAAAAGLz6ctpf-hchX2_l0Ge-Bn-n8wS',
|
||||||
|
'maintenance-mode': false,
|
||||||
'departments': [
|
'departments': [
|
||||||
{id: 1, name: 'Sales Support', owners: 2},
|
{id: 1, name: 'Sales Support', owners: 2},
|
||||||
{id: 2, name: 'Technical Issues', owners: 5},
|
{id: 2, name: 'Technical Issues', owners: 5},
|
||||||
|
|
|
@ -33,7 +33,7 @@ store.dispatch(SessionActions.initSession());
|
||||||
let unsubscribe = store.subscribe(() => {
|
let unsubscribe = store.subscribe(() => {
|
||||||
console.log(store.getState());
|
console.log(store.getState());
|
||||||
|
|
||||||
if (store.getState().session.initDone) {
|
if (store.getState().session.initDone && store.getState().config.initDone) {
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
renderApplication();
|
renderApplication();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ class ConfigReducer extends Reducer {
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
language: sessionStore.getItem('language')
|
language: sessionStore.getItem('language'),
|
||||||
|
initDone: false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,8 @@ class ConfigReducer extends Reducer {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return _.extend({}, state, payload.data, {
|
return _.extend({}, state, payload.data, {
|
||||||
language: currentLanguage || payload.language
|
language: currentLanguage || payload.language,
|
||||||
|
initDone: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue