Skip to content

Commit

Permalink
Merge: - client: hide dns is starting message by default
Browse files Browse the repository at this point in the history
* commit '7fade498b910a2492b2e214f0b2a706b51548b34':
  - client: add setDnsRunningStatus action
  - client: save in store dnsStatus even if running false
  - client: hide dns is starting message by default
  • Loading branch information
ameshkov committed Dec 17, 2019
2 parents b105f20 + 7fade49 commit b54bf94
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 5 additions & 2 deletions client/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -242,15 +243,17 @@ export const getDnsStatus = () => async (dispatch) => {
dispatch(dnsStatusFailure());
window.location.reload(true);
};

const handleRequestSuccess = (response) => {
const dnsStatus = response.data;
const runningStatus = dnsStatus && dnsStatus.running;
const { running } = dnsStatus;
const runningStatus = dnsStatus && running;
if (runningStatus === true) {
dispatch(dnsStatusSuccess(dnsStatus));
dispatch(getVersion());
dispatch(getTlsStatus());
dispatch(getProfile());
} else {
dispatch(setDnsRunningStatus(running));
}
};

Expand Down
5 changes: 3 additions & 2 deletions client/src/components/App/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ class App extends Component {
<LoadingBar className="loading-bar" updateTime={1000} />
<Route component={Header} />
<div className="container container--wrap">
{dashboard.processing && !dashboard.isCoreRunning && (
{dashboard.processing && <Loading />}
{!dashboard.isCoreRunning && (
<div className="row row-cards">
<div className="col-lg-12">
<Status reloadPage={this.reloadPage}
message="dns_start"
/>
/>
<Loading />
</div>
</div>
Expand Down
7 changes: 4 additions & 3 deletions client/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -75,7 +76,7 @@ const dashboard = handleActions(
} = payload;
const newState = {
...state,
isCoreRunning: running,
isCoreRunning: true,
processing: false,
dnsVersion: version,
dnsPort,
Expand Down Expand Up @@ -187,7 +188,7 @@ const dashboard = handleActions(
},
{
processing: true,
isCoreRunning: false,
isCoreRunning: true,
processingVersion: true,
processingFiltering: true,
processingClients: true,
Expand Down

0 comments on commit b54bf94

Please sign in to comment.