+ client: handle logs configuration
This commit is contained in:
committed by
Simon Zolin
parent
27f895cf46
commit
a753ae86cc
@@ -12,6 +12,7 @@ import access from './access';
|
||||
import rewrites from './rewrites';
|
||||
import services from './services';
|
||||
import stats from './stats';
|
||||
import queryLogs from './queryLogs';
|
||||
|
||||
const settings = handleActions({
|
||||
[actions.initSettingsRequest]: state => ({ ...state, processing: true }),
|
||||
@@ -43,6 +44,7 @@ const settings = handleActions({
|
||||
processingTestUpstream: false,
|
||||
processingSetUpstream: false,
|
||||
processingDhcpStatus: false,
|
||||
settingsList: {},
|
||||
});
|
||||
|
||||
const dashboard = handleActions({
|
||||
@@ -54,7 +56,6 @@ const dashboard = handleActions({
|
||||
running,
|
||||
dns_port: dnsPort,
|
||||
dns_addresses: dnsAddresses,
|
||||
querylog_enabled: queryLogEnabled,
|
||||
upstream_dns: upstreamDns,
|
||||
bootstrap_dns: bootstrapDns,
|
||||
all_servers: allServers,
|
||||
@@ -69,7 +70,6 @@ const dashboard = handleActions({
|
||||
dnsVersion: version,
|
||||
dnsPort,
|
||||
dnsAddresses,
|
||||
queryLogEnabled,
|
||||
upstreamDns: upstreamDns.join('\n'),
|
||||
bootstrapDns: bootstrapDns.join('\n'),
|
||||
allServers,
|
||||
@@ -94,13 +94,6 @@ const dashboard = handleActions({
|
||||
return newState;
|
||||
},
|
||||
|
||||
[actions.toggleLogStatusRequest]: state => ({ ...state, logStatusProcessing: true }),
|
||||
[actions.toggleLogStatusFailure]: state => ({ ...state, logStatusProcessing: false }),
|
||||
[actions.toggleLogStatusSuccess]: (state) => {
|
||||
const { queryLogEnabled } = state;
|
||||
return ({ ...state, queryLogEnabled: !queryLogEnabled, logStatusProcessing: false });
|
||||
},
|
||||
|
||||
[actions.getVersionRequest]: state => ({ ...state, processingVersion: true }),
|
||||
[actions.getVersionFailure]: state => ({ ...state, processingVersion: false }),
|
||||
[actions.getVersionSuccess]: (state, { payload }) => {
|
||||
@@ -179,7 +172,6 @@ const dashboard = handleActions({
|
||||
}, {
|
||||
processing: true,
|
||||
isCoreRunning: false,
|
||||
logStatusProcessing: false,
|
||||
processingVersion: true,
|
||||
processingFiltering: true,
|
||||
processingClients: true,
|
||||
@@ -197,22 +189,6 @@ const dashboard = handleActions({
|
||||
autoClients: [],
|
||||
});
|
||||
|
||||
const queryLogs = handleActions({
|
||||
[actions.getLogsRequest]: state => ({ ...state, getLogsProcessing: true }),
|
||||
[actions.getLogsFailure]: state => ({ ...state, getLogsProcessing: false }),
|
||||
[actions.getLogsSuccess]: (state, { payload }) => {
|
||||
const newState = { ...state, logs: payload, getLogsProcessing: false };
|
||||
return newState;
|
||||
},
|
||||
[actions.downloadQueryLogRequest]: state => ({ ...state, logsDownloading: true }),
|
||||
[actions.downloadQueryLogFailure]: state => ({ ...state, logsDownloading: false }),
|
||||
[actions.downloadQueryLogSuccess]: state => ({ ...state, logsDownloading: false }),
|
||||
}, {
|
||||
getLogsProcessing: false,
|
||||
logsDownloading: false,
|
||||
logs: [],
|
||||
});
|
||||
|
||||
const filtering = handleActions({
|
||||
[actions.setRulesRequest]: state => ({ ...state, processingRules: true }),
|
||||
[actions.setRulesFailure]: state => ({ ...state, processingRules: false }),
|
||||
|
||||
49
client/src/reducers/queryLogs.js
Normal file
49
client/src/reducers/queryLogs.js
Normal file
@@ -0,0 +1,49 @@
|
||||
import { handleActions } from 'redux-actions';
|
||||
|
||||
import * as actions from '../actions/queryLogs';
|
||||
|
||||
const queryLogs = handleActions(
|
||||
{
|
||||
[actions.getLogsRequest]: state => ({ ...state, processingGetLogs: true }),
|
||||
[actions.getLogsFailure]: state => ({ ...state, processingGetLogs: false }),
|
||||
[actions.getLogsSuccess]: (state, { payload }) => {
|
||||
const newState = { ...state, logs: payload, processingGetLogs: false };
|
||||
return newState;
|
||||
},
|
||||
|
||||
[actions.clearLogsRequest]: state => ({ ...state, processingClear: true }),
|
||||
[actions.clearLogsFailure]: state => ({ ...state, processingClear: false }),
|
||||
[actions.clearLogsSuccess]: state => ({
|
||||
...state,
|
||||
logs: [],
|
||||
processingClear: false,
|
||||
}),
|
||||
|
||||
[actions.getLogsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
|
||||
[actions.getLogsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
|
||||
[actions.getLogsConfigSuccess]: (state, { payload }) => ({
|
||||
...state,
|
||||
...payload,
|
||||
processingGetConfig: false,
|
||||
}),
|
||||
|
||||
[actions.setLogsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
|
||||
[actions.setLogsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
|
||||
[actions.setLogsConfigSuccess]: (state, { payload }) => ({
|
||||
...state,
|
||||
...payload,
|
||||
processingSetConfig: false,
|
||||
}),
|
||||
},
|
||||
{
|
||||
processingGetLogs: true,
|
||||
processingClear: false,
|
||||
processingGetConfig: false,
|
||||
processingSetConfig: false,
|
||||
logs: [],
|
||||
interval: 1,
|
||||
enabled: true,
|
||||
},
|
||||
);
|
||||
|
||||
export default queryLogs;
|
||||
Reference in New Issue
Block a user