Merge: - client: hide dns is starting message by default

* commit '7fade498b910a2492b2e214f0b2a706b51548b34':
  - client: add setDnsRunningStatus action
  - client: save in store dnsStatus even if running false
  - client: hide dns is starting message by default
This commit is contained in:
Andrey Meshkov 2019-12-17 22:35:34 +03:00
commit b54bf94697
3 changed files with 12 additions and 7 deletions

View File

@ -233,6 +233,7 @@ export const getProfile = () => async (dispatch) => {
export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST'); export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST');
export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE'); export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE');
export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS'); export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS');
export const setDnsRunningStatus = createAction('SET_DNS_RUNNING_STATUS');
export const getDnsStatus = () => async (dispatch) => { export const getDnsStatus = () => async (dispatch) => {
dispatch(dnsStatusRequest()); dispatch(dnsStatusRequest());
@ -242,15 +243,17 @@ export const getDnsStatus = () => async (dispatch) => {
dispatch(dnsStatusFailure()); dispatch(dnsStatusFailure());
window.location.reload(true); window.location.reload(true);
}; };
const handleRequestSuccess = (response) => { const handleRequestSuccess = (response) => {
const dnsStatus = response.data; const dnsStatus = response.data;
const runningStatus = dnsStatus && dnsStatus.running; const { running } = dnsStatus;
const runningStatus = dnsStatus && running;
if (runningStatus === true) { if (runningStatus === true) {
dispatch(dnsStatusSuccess(dnsStatus)); dispatch(dnsStatusSuccess(dnsStatus));
dispatch(getVersion()); dispatch(getVersion());
dispatch(getTlsStatus()); dispatch(getTlsStatus());
dispatch(getProfile()); dispatch(getProfile());
} else {
dispatch(setDnsRunningStatus(running));
} }
}; };

View File

@ -89,7 +89,8 @@ class App extends Component {
<LoadingBar className="loading-bar" updateTime={1000} /> <LoadingBar className="loading-bar" updateTime={1000} />
<Route component={Header} /> <Route component={Header} />
<div className="container container--wrap"> <div className="container container--wrap">
{dashboard.processing && !dashboard.isCoreRunning && ( {dashboard.processing && <Loading />}
{!dashboard.isCoreRunning && (
<div className="row row-cards"> <div className="row row-cards">
<div className="col-lg-12"> <div className="col-lg-12">
<Status reloadPage={this.reloadPage} <Status reloadPage={this.reloadPage}

View File

@ -58,12 +58,13 @@ const settings = handleActions(
const dashboard = handleActions( const dashboard = handleActions(
{ {
[actions.setDnsRunningStatus]: (state, { payload }) =>
({ ...state, isCoreRunning: payload }),
[actions.dnsStatusRequest]: state => ({ ...state, processing: true }), [actions.dnsStatusRequest]: state => ({ ...state, processing: true }),
[actions.dnsStatusFailure]: state => ({ ...state, processing: false }), [actions.dnsStatusFailure]: state => ({ ...state, processing: false }),
[actions.dnsStatusSuccess]: (state, { payload }) => { [actions.dnsStatusSuccess]: (state, { payload }) => {
const { const {
version, version,
running,
dns_port: dnsPort, dns_port: dnsPort,
dns_addresses: dnsAddresses, dns_addresses: dnsAddresses,
upstream_dns: upstreamDns, upstream_dns: upstreamDns,
@ -75,7 +76,7 @@ const dashboard = handleActions(
} = payload; } = payload;
const newState = { const newState = {
...state, ...state,
isCoreRunning: running, isCoreRunning: true,
processing: false, processing: false,
dnsVersion: version, dnsVersion: version,
dnsPort, dnsPort,
@ -187,7 +188,7 @@ const dashboard = handleActions(
}, },
{ {
processing: true, processing: true,
isCoreRunning: false, isCoreRunning: true,
processingVersion: true, processingVersion: true,
processingFiltering: true, processingFiltering: true,
processingClients: true, processingClients: true,