From 242e5e136f60c024c167b6fc096fa5595c5ba9bd Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Tue, 17 Dec 2019 16:14:30 +0300 Subject: [PATCH 1/3] - client: hide dns is starting message by default --- client/src/components/App/index.js | 5 +++-- client/src/reducers/index.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/components/App/index.js b/client/src/components/App/index.js index 843047c3..e40ac78f 100644 --- a/client/src/components/App/index.js +++ b/client/src/components/App/index.js @@ -89,12 +89,13 @@ class App extends Component {
- {dashboard.processing && !dashboard.isCoreRunning && ( + {dashboard.processing && } + {!dashboard.isCoreRunning && (
+ />
diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 550c080b..159eac4f 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -187,7 +187,7 @@ const dashboard = handleActions( }, { processing: true, - isCoreRunning: false, + isCoreRunning: true, processingVersion: true, processingFiltering: true, processingClients: true, From 39640d81903a0b252da0ade7b37e3e25edecdb3c Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Tue, 17 Dec 2019 17:46:59 +0300 Subject: [PATCH 2/3] - client: save in store dnsStatus even if running false --- client/src/actions/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 0cb022d4..9d64c071 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -245,8 +245,7 @@ export const getDnsStatus = () => async (dispatch) => { const handleRequestSuccess = (response) => { const dnsStatus = response.data; - const runningStatus = dnsStatus && dnsStatus.running; - if (runningStatus === true) { + if (dnsStatus) { dispatch(dnsStatusSuccess(dnsStatus)); dispatch(getVersion()); dispatch(getTlsStatus()); From 7fade498b910a2492b2e214f0b2a706b51548b34 Mon Sep 17 00:00:00 2001 From: Artem Baskal Date: Tue, 17 Dec 2019 18:54:28 +0300 Subject: [PATCH 3/3] - client: add setDnsRunningStatus action --- client/src/actions/index.js | 8 ++++++-- client/src/reducers/index.js | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 9d64c071..ac3cf514 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -233,6 +233,7 @@ export const getProfile = () => async (dispatch) => { export const dnsStatusRequest = createAction('DNS_STATUS_REQUEST'); export const dnsStatusFailure = createAction('DNS_STATUS_FAILURE'); export const dnsStatusSuccess = createAction('DNS_STATUS_SUCCESS'); +export const setDnsRunningStatus = createAction('SET_DNS_RUNNING_STATUS'); export const getDnsStatus = () => async (dispatch) => { dispatch(dnsStatusRequest()); @@ -242,14 +243,17 @@ export const getDnsStatus = () => async (dispatch) => { dispatch(dnsStatusFailure()); window.location.reload(true); }; - const handleRequestSuccess = (response) => { const dnsStatus = response.data; - if (dnsStatus) { + const { running } = dnsStatus; + const runningStatus = dnsStatus && running; + if (runningStatus === true) { dispatch(dnsStatusSuccess(dnsStatus)); dispatch(getVersion()); dispatch(getTlsStatus()); dispatch(getProfile()); + } else { + dispatch(setDnsRunningStatus(running)); } }; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 159eac4f..ca2aeef8 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -58,12 +58,13 @@ const settings = handleActions( const dashboard = handleActions( { + [actions.setDnsRunningStatus]: (state, { payload }) => + ({ ...state, isCoreRunning: payload }), [actions.dnsStatusRequest]: state => ({ ...state, processing: true }), [actions.dnsStatusFailure]: state => ({ ...state, processing: false }), [actions.dnsStatusSuccess]: (state, { payload }) => { const { version, - running, dns_port: dnsPort, dns_addresses: dnsAddresses, upstream_dns: upstreamDns, @@ -75,7 +76,7 @@ const dashboard = handleActions( } = payload; const newState = { ...state, - isCoreRunning: running, + isCoreRunning: true, processing: false, dnsVersion: version, dnsPort,