diff --git a/client/src/login/Login/Form.js b/client/src/login/Login/Form.js
index 45274b55..d3d825d7 100644
--- a/client/src/login/Login/Form.js
+++ b/client/src/login/Login/Form.js
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Field, reduxForm } from 'redux-form';
-import { Trans, withNamespaces } from 'react-i18next';
+import { Trans, withTranslation } from 'react-i18next';
import flow from 'lodash/flow';
import { renderInputField, required } from '../../helpers/form';
@@ -69,7 +69,7 @@ Form.propTypes = {
};
export default flow([
- withNamespaces(),
+ withTranslation(),
reduxForm({
form: 'loginForm',
}),
diff --git a/client/src/login/Login/index.js b/client/src/login/Login/index.js
index 424a7a9d..88354dc2 100644
--- a/client/src/login/Login/index.js
+++ b/client/src/login/Login/index.js
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import flow from 'lodash/flow';
-import { withNamespaces, Trans } from 'react-i18next';
+import { withTranslation, Trans } from 'react-i18next';
import * as actionCreators from '../../actions/login';
import logo from '../../components/ui/svg/logo.svg';
@@ -23,7 +23,7 @@ class Login extends Component {
};
toggleText = () => {
- this.setState(prevState => ({
+ this.setState((prevState) => ({
isForgotPasswordVisible: !prevState.isForgotPasswordVisible,
}));
};
@@ -82,7 +82,7 @@ Login.propTypes = {
const mapStateToProps = ({ login, toasts }) => ({ login, toasts });
export default flow([
- withNamespaces(),
+ withTranslation(),
connect(
mapStateToProps,
actionCreators,
diff --git a/client/src/reducers/access.js b/client/src/reducers/access.js
index 79110279..cf1ad958 100644
--- a/client/src/reducers/access.js
+++ b/client/src/reducers/access.js
@@ -4,8 +4,8 @@ import * as actions from '../actions/access';
const access = handleActions(
{
- [actions.getAccessListRequest]: state => ({ ...state, processing: true }),
- [actions.getAccessListFailure]: state => ({ ...state, processing: false }),
+ [actions.getAccessListRequest]: (state) => ({ ...state, processing: true }),
+ [actions.getAccessListFailure]: (state) => ({ ...state, processing: false }),
[actions.getAccessListSuccess]: (state, { payload }) => {
const {
allowed_clients,
@@ -22,8 +22,8 @@ const access = handleActions(
return newState;
},
- [actions.setAccessListRequest]: state => ({ ...state, processingSet: true }),
- [actions.setAccessListFailure]: state => ({ ...state, processingSet: false }),
+ [actions.setAccessListRequest]: (state) => ({ ...state, processingSet: true }),
+ [actions.setAccessListFailure]: (state) => ({ ...state, processingSet: false }),
[actions.setAccessListSuccess]: (state) => {
const newState = {
...state,
@@ -32,8 +32,8 @@ const access = handleActions(
return newState;
},
- [actions.toggleClientBlockRequest]: state => ({ ...state, processingSet: true }),
- [actions.toggleClientBlockFailure]: state => ({ ...state, processingSet: false }),
+ [actions.toggleClientBlockRequest]: (state) => ({ ...state, processingSet: true }),
+ [actions.toggleClientBlockFailure]: (state) => ({ ...state, processingSet: false }),
[actions.toggleClientBlockSuccess]: (state, { payload }) => {
const {
allowed_clients,
diff --git a/client/src/reducers/clients.js b/client/src/reducers/clients.js
index 0946e437..7c6c309c 100644
--- a/client/src/reducers/clients.js
+++ b/client/src/reducers/clients.js
@@ -3,8 +3,8 @@ import { handleActions } from 'redux-actions';
import * as actions from '../actions/clients';
const clients = handleActions({
- [actions.addClientRequest]: state => ({ ...state, processingAdding: true }),
- [actions.addClientFailure]: state => ({ ...state, processingAdding: false }),
+ [actions.addClientRequest]: (state) => ({ ...state, processingAdding: true }),
+ [actions.addClientFailure]: (state) => ({ ...state, processingAdding: false }),
[actions.addClientSuccess]: (state) => {
const newState = {
...state,
@@ -13,8 +13,8 @@ const clients = handleActions({
return newState;
},
- [actions.deleteClientRequest]: state => ({ ...state, processingDeleting: true }),
- [actions.deleteClientFailure]: state => ({ ...state, processingDeleting: false }),
+ [actions.deleteClientRequest]: (state) => ({ ...state, processingDeleting: true }),
+ [actions.deleteClientFailure]: (state) => ({ ...state, processingDeleting: false }),
[actions.deleteClientSuccess]: (state) => {
const newState = {
...state,
@@ -23,8 +23,8 @@ const clients = handleActions({
return newState;
},
- [actions.updateClientRequest]: state => ({ ...state, processingUpdating: true }),
- [actions.updateClientFailure]: state => ({ ...state, processingUpdating: false }),
+ [actions.updateClientRequest]: (state) => ({ ...state, processingUpdating: true }),
+ [actions.updateClientFailure]: (state) => ({ ...state, processingUpdating: false }),
[actions.updateClientSuccess]: (state) => {
const newState = {
...state,
diff --git a/client/src/reducers/dnsConfig.js b/client/src/reducers/dnsConfig.js
index 9f55bee7..b3978217 100644
--- a/client/src/reducers/dnsConfig.js
+++ b/client/src/reducers/dnsConfig.js
@@ -8,9 +8,8 @@ const DEFAULT_BLOCKING_IPV6 = '::';
const dnsConfig = handleActions(
{
- [actions.getDnsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
- [actions.getDnsConfigFailure]: state =>
- ({ ...state, processingGetConfig: false }),
+ [actions.getDnsConfigRequest]: (state) => ({ ...state, processingGetConfig: true }),
+ [actions.getDnsConfigFailure]: (state) => ({ ...state, processingGetConfig: false }),
[actions.getDnsConfigSuccess]: (state, { payload }) => {
const {
blocking_ipv4,
@@ -31,9 +30,8 @@ const dnsConfig = handleActions(
};
},
- [actions.setDnsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
- [actions.setDnsConfigFailure]: state =>
- ({ ...state, processingSetConfig: false }),
+ [actions.setDnsConfigRequest]: (state) => ({ ...state, processingSetConfig: true }),
+ [actions.setDnsConfigFailure]: (state) => ({ ...state, processingSetConfig: false }),
[actions.setDnsConfigSuccess]: (state, { payload }) => ({
...state,
...payload,
diff --git a/client/src/reducers/encryption.js b/client/src/reducers/encryption.js
index c94e9015..a5cd7cbf 100644
--- a/client/src/reducers/encryption.js
+++ b/client/src/reducers/encryption.js
@@ -3,8 +3,8 @@ import { handleActions } from 'redux-actions';
import * as actions from '../actions/encryption';
const encryption = handleActions({
- [actions.getTlsStatusRequest]: state => ({ ...state, processing: true }),
- [actions.getTlsStatusFailure]: state => ({ ...state, processing: false }),
+ [actions.getTlsStatusRequest]: (state) => ({ ...state, processing: true }),
+ [actions.getTlsStatusFailure]: (state) => ({ ...state, processing: false }),
[actions.getTlsStatusSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -14,8 +14,8 @@ const encryption = handleActions({
return newState;
},
- [actions.setTlsConfigRequest]: state => ({ ...state, processingConfig: true }),
- [actions.setTlsConfigFailure]: state => ({ ...state, processingConfig: false }),
+ [actions.setTlsConfigRequest]: (state) => ({ ...state, processingConfig: true }),
+ [actions.setTlsConfigFailure]: (state) => ({ ...state, processingConfig: false }),
[actions.setTlsConfigSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -25,8 +25,8 @@ const encryption = handleActions({
return newState;
},
- [actions.validateTlsConfigRequest]: state => ({ ...state, processingValidate: true }),
- [actions.validateTlsConfigFailure]: state => ({ ...state, processingValidate: false }),
+ [actions.validateTlsConfigRequest]: (state) => ({ ...state, processingValidate: true }),
+ [actions.validateTlsConfigFailure]: (state) => ({ ...state, processingValidate: false }),
[actions.validateTlsConfigSuccess]: (state, { payload }) => {
const {
issuer = '',
diff --git a/client/src/reducers/filtering.js b/client/src/reducers/filtering.js
index 544e0aad..a8e5a766 100644
--- a/client/src/reducers/filtering.js
+++ b/client/src/reducers/filtering.js
@@ -4,38 +4,38 @@ import * as actions from '../actions/filtering';
const filtering = handleActions(
{
- [actions.setRulesRequest]: state => ({ ...state, processingRules: true }),
- [actions.setRulesFailure]: state => ({ ...state, processingRules: false }),
- [actions.setRulesSuccess]: state => ({ ...state, processingRules: false }),
+ [actions.setRulesRequest]: (state) => ({ ...state, processingRules: true }),
+ [actions.setRulesFailure]: (state) => ({ ...state, processingRules: false }),
+ [actions.setRulesSuccess]: (state) => ({ ...state, processingRules: false }),
[actions.handleRulesChange]: (state, { payload }) => {
const { userRules } = payload;
return { ...state, userRules };
},
- [actions.getFilteringStatusRequest]: state => ({
+ [actions.getFilteringStatusRequest]: (state) => ({
...state,
processingFilters: true,
check: {},
}),
- [actions.getFilteringStatusFailure]: state => ({ ...state, processingFilters: false }),
+ [actions.getFilteringStatusFailure]: (state) => ({ ...state, processingFilters: false }),
[actions.getFilteringStatusSuccess]: (state, { payload }) => ({
...state,
...payload,
processingFilters: false,
}),
- [actions.addFilterRequest]: state => ({
+ [actions.addFilterRequest]: (state) => ({
...state,
processingAddFilter: true,
isFilterAdded: false,
}),
- [actions.addFilterFailure]: state => ({
+ [actions.addFilterFailure]: (state) => ({
...state,
processingAddFilter: false,
isFilterAdded: false,
}),
- [actions.addFilterSuccess]: state => ({
+ [actions.addFilterSuccess]: (state) => ({
...state,
processingAddFilter: false,
isFilterAdded: true,
@@ -60,32 +60,32 @@ const filtering = handleActions(
return newState;
},
- [actions.toggleFilterRequest]: state => ({ ...state, processingConfigFilter: true }),
- [actions.toggleFilterFailure]: state => ({ ...state, processingConfigFilter: false }),
- [actions.toggleFilterSuccess]: state => ({ ...state, processingConfigFilter: false }),
+ [actions.toggleFilterRequest]: (state) => ({ ...state, processingConfigFilter: true }),
+ [actions.toggleFilterFailure]: (state) => ({ ...state, processingConfigFilter: false }),
+ [actions.toggleFilterSuccess]: (state) => ({ ...state, processingConfigFilter: false }),
- [actions.editFilterRequest]: state => ({ ...state, processingConfigFilter: true }),
- [actions.editFilterFailure]: state => ({ ...state, processingConfigFilter: false }),
- [actions.editFilterSuccess]: state => ({ ...state, processingConfigFilter: false }),
+ [actions.editFilterRequest]: (state) => ({ ...state, processingConfigFilter: true }),
+ [actions.editFilterFailure]: (state) => ({ ...state, processingConfigFilter: false }),
+ [actions.editFilterSuccess]: (state) => ({ ...state, processingConfigFilter: false }),
- [actions.refreshFiltersRequest]: state => ({ ...state, processingRefreshFilters: true }),
- [actions.refreshFiltersFailure]: state => ({ ...state, processingRefreshFilters: false }),
- [actions.refreshFiltersSuccess]: state => ({ ...state, processingRefreshFilters: false }),
+ [actions.refreshFiltersRequest]: (state) => ({ ...state, processingRefreshFilters: true }),
+ [actions.refreshFiltersFailure]: (state) => ({ ...state, processingRefreshFilters: false }),
+ [actions.refreshFiltersSuccess]: (state) => ({ ...state, processingRefreshFilters: false }),
- [actions.removeFilterRequest]: state => ({ ...state, processingRemoveFilter: true }),
- [actions.removeFilterFailure]: state => ({ ...state, processingRemoveFilter: false }),
- [actions.removeFilterSuccess]: state => ({ ...state, processingRemoveFilter: false }),
+ [actions.removeFilterRequest]: (state) => ({ ...state, processingRemoveFilter: true }),
+ [actions.removeFilterFailure]: (state) => ({ ...state, processingRemoveFilter: false }),
+ [actions.removeFilterSuccess]: (state) => ({ ...state, processingRemoveFilter: false }),
- [actions.setFiltersConfigRequest]: state => ({ ...state, processingSetConfig: true }),
- [actions.setFiltersConfigFailure]: state => ({ ...state, processingSetConfig: false }),
+ [actions.setFiltersConfigRequest]: (state) => ({ ...state, processingSetConfig: true }),
+ [actions.setFiltersConfigFailure]: (state) => ({ ...state, processingSetConfig: false }),
[actions.setFiltersConfigSuccess]: (state, { payload }) => ({
...state,
...payload,
processingSetConfig: false,
}),
- [actions.checkHostRequest]: state => ({ ...state, processingCheck: true }),
- [actions.checkHostFailure]: state => ({ ...state, processingCheck: false }),
+ [actions.checkHostRequest]: (state) => ({ ...state, processingCheck: true }),
+ [actions.checkHostFailure]: (state) => ({ ...state, processingCheck: false }),
[actions.checkHostSuccess]: (state, { payload }) => ({
...state,
check: payload,
diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js
index 245cf17d..7cbeb4b5 100644
--- a/client/src/reducers/index.js
+++ b/client/src/reducers/index.js
@@ -18,8 +18,8 @@ import filtering from './filtering';
const settings = handleActions(
{
- [actions.initSettingsRequest]: state => ({ ...state, processing: true }),
- [actions.initSettingsFailure]: state => ({ ...state, processing: false }),
+ [actions.initSettingsRequest]: (state) => ({ ...state, processing: true }),
+ [actions.initSettingsFailure]: (state) => ({ ...state, processing: false }),
[actions.initSettingsSuccess]: (state, { payload }) => {
const { settingsList } = payload;
const newState = { ...state, settingsList, processing: false };
@@ -35,9 +35,9 @@ const settings = handleActions(
const newSettingsList = { ...settingsList, [settingKey]: newSetting };
return { ...state, settingsList: newSettingsList };
},
- [actions.testUpstreamRequest]: state => ({ ...state, processingTestUpstream: true }),
- [actions.testUpstreamFailure]: state => ({ ...state, processingTestUpstream: false }),
- [actions.testUpstreamSuccess]: state => ({ ...state, processingTestUpstream: false }),
+ [actions.testUpstreamRequest]: (state) => ({ ...state, processingTestUpstream: true }),
+ [actions.testUpstreamFailure]: (state) => ({ ...state, processingTestUpstream: false }),
+ [actions.testUpstreamSuccess]: (state) => ({ ...state, processingTestUpstream: false }),
},
{
processing: true,
@@ -49,10 +49,11 @@ 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.setDnsRunningStatus]: (state, { payload }) => (
+ { ...state, isCoreRunning: payload }
+ ),
+ [actions.dnsStatusRequest]: (state) => ({ ...state, processing: true }),
+ [actions.dnsStatusFailure]: (state) => ({ ...state, processing: false }),
[actions.dnsStatusSuccess]: (state, { payload }) => {
const {
version,
@@ -76,8 +77,8 @@ const dashboard = handleActions(
return newState;
},
- [actions.getVersionRequest]: state => ({ ...state, processingVersion: true }),
- [actions.getVersionFailure]: state => ({ ...state, processingVersion: false }),
+ [actions.getVersionRequest]: (state) => ({ ...state, processingVersion: true }),
+ [actions.getVersionFailure]: (state) => ({ ...state, processingVersion: false }),
[actions.getVersionSuccess]: (state, { payload }) => {
const currentVersion = state.dnsVersion === 'undefined' ? 0 : state.dnsVersion;
@@ -105,15 +106,15 @@ const dashboard = handleActions(
};
},
- [actions.getUpdateRequest]: state => ({ ...state, processingUpdate: true }),
- [actions.getUpdateFailure]: state => ({ ...state, processingUpdate: false }),
+ [actions.getUpdateRequest]: (state) => ({ ...state, processingUpdate: true }),
+ [actions.getUpdateFailure]: (state) => ({ ...state, processingUpdate: false }),
[actions.getUpdateSuccess]: (state) => {
const newState = { ...state, processingUpdate: false };
return newState;
},
- [actions.toggleProtectionRequest]: state => ({ ...state, processingProtection: true }),
- [actions.toggleProtectionFailure]: state => ({ ...state, processingProtection: false }),
+ [actions.toggleProtectionRequest]: (state) => ({ ...state, processingProtection: true }),
+ [actions.toggleProtectionFailure]: (state) => ({ ...state, processingProtection: false }),
[actions.toggleProtectionSuccess]: (state) => {
const newState = {
...state,
@@ -128,8 +129,8 @@ const dashboard = handleActions(
return newState;
},
- [actions.getClientsRequest]: state => ({ ...state, processingClients: true }),
- [actions.getClientsFailure]: state => ({ ...state, processingClients: false }),
+ [actions.getClientsRequest]: (state) => ({ ...state, processingClients: true }),
+ [actions.getClientsFailure]: (state) => ({ ...state, processingClients: false }),
[actions.getClientsSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -139,8 +140,8 @@ const dashboard = handleActions(
return newState;
},
- [actions.getProfileRequest]: state => ({ ...state, processingProfile: true }),
- [actions.getProfileFailure]: state => ({ ...state, processingProfile: false }),
+ [actions.getProfileRequest]: (state) => ({ ...state, processingProfile: true }),
+ [actions.getProfileFailure]: (state) => ({ ...state, processingProfile: false }),
[actions.getProfileSuccess]: (state, { payload }) => ({
...state,
name: payload.name,
@@ -169,8 +170,8 @@ const dashboard = handleActions(
const dhcp = handleActions(
{
- [actions.getDhcpStatusRequest]: state => ({ ...state, processing: true }),
- [actions.getDhcpStatusFailure]: state => ({ ...state, processing: false }),
+ [actions.getDhcpStatusRequest]: (state) => ({ ...state, processing: true }),
+ [actions.getDhcpStatusFailure]: (state) => ({ ...state, processing: false }),
[actions.getDhcpStatusSuccess]: (state, { payload }) => {
const { static_leases: staticLeases, ...values } = payload;
@@ -184,8 +185,8 @@ const dhcp = handleActions(
return newState;
},
- [actions.getDhcpInterfacesRequest]: state => ({ ...state, processingInterfaces: true }),
- [actions.getDhcpInterfacesFailure]: state => ({ ...state, processingInterfaces: false }),
+ [actions.getDhcpInterfacesRequest]: (state) => ({ ...state, processingInterfaces: true }),
+ [actions.getDhcpInterfacesFailure]: (state) => ({ ...state, processingInterfaces: false }),
[actions.getDhcpInterfacesSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -195,8 +196,8 @@ const dhcp = handleActions(
return newState;
},
- [actions.findActiveDhcpRequest]: state => ({ ...state, processingStatus: true }),
- [actions.findActiveDhcpFailure]: state => ({ ...state, processingStatus: false }),
+ [actions.findActiveDhcpRequest]: (state) => ({ ...state, processingStatus: true }),
+ [actions.findActiveDhcpFailure]: (state) => ({ ...state, processingStatus: false }),
[actions.findActiveDhcpSuccess]: (state, { payload }) => {
const { other_server: otherServer, static_ip: staticIP } = payload;
@@ -211,8 +212,8 @@ const dhcp = handleActions(
return newState;
},
- [actions.toggleDhcpRequest]: state => ({ ...state, processingDhcp: true }),
- [actions.toggleDhcpFailure]: state => ({ ...state, processingDhcp: false }),
+ [actions.toggleDhcpRequest]: (state) => ({ ...state, processingDhcp: true }),
+ [actions.toggleDhcpFailure]: (state) => ({ ...state, processingDhcp: false }),
[actions.toggleDhcpSuccess]: (state) => {
const { config } = state;
const newConfig = { ...config, enabled: !config.enabled };
@@ -225,8 +226,8 @@ const dhcp = handleActions(
return newState;
},
- [actions.setDhcpConfigRequest]: state => ({ ...state, processingConfig: true }),
- [actions.setDhcpConfigFailure]: state => ({ ...state, processingConfig: false }),
+ [actions.setDhcpConfigRequest]: (state) => ({ ...state, processingConfig: true }),
+ [actions.setDhcpConfigFailure]: (state) => ({ ...state, processingConfig: false }),
[actions.setDhcpConfigSuccess]: (state, { payload }) => {
const { config } = state;
const newConfig = { ...config, ...payload };
@@ -234,9 +235,9 @@ const dhcp = handleActions(
return newState;
},
- [actions.resetDhcpRequest]: state => ({ ...state, processingReset: true }),
- [actions.resetDhcpFailure]: state => ({ ...state, processingReset: false }),
- [actions.resetDhcpSuccess]: state => ({
+ [actions.resetDhcpRequest]: (state) => ({ ...state, processingReset: true }),
+ [actions.resetDhcpFailure]: (state) => ({ ...state, processingReset: false }),
+ [actions.resetDhcpSuccess]: (state) => ({
...state,
processingReset: false,
config: {
@@ -252,8 +253,8 @@ const dhcp = handleActions(
return newState;
},
- [actions.addStaticLeaseRequest]: state => ({ ...state, processingAdding: true }),
- [actions.addStaticLeaseFailure]: state => ({ ...state, processingAdding: false }),
+ [actions.addStaticLeaseRequest]: (state) => ({ ...state, processingAdding: true }),
+ [actions.addStaticLeaseFailure]: (state) => ({ ...state, processingAdding: false }),
[actions.addStaticLeaseSuccess]: (state, { payload }) => {
const { ip, mac, hostname } = payload;
const newLease = {
@@ -270,11 +271,11 @@ const dhcp = handleActions(
return newState;
},
- [actions.removeStaticLeaseRequest]: state => ({ ...state, processingDeleting: true }),
- [actions.removeStaticLeaseFailure]: state => ({ ...state, processingDeleting: false }),
+ [actions.removeStaticLeaseRequest]: (state) => ({ ...state, processingDeleting: true }),
+ [actions.removeStaticLeaseFailure]: (state) => ({ ...state, processingDeleting: false }),
[actions.removeStaticLeaseSuccess]: (state, { payload }) => {
const leaseToRemove = payload.ip;
- const leases = state.staticLeases.filter(item => item.ip !== leaseToRemove);
+ const leases = state.staticLeases.filter((item) => item.ip !== leaseToRemove);
const newState = {
...state,
staticLeases: leases,
diff --git a/client/src/reducers/install.js b/client/src/reducers/install.js
index b3f95dfb..5ffee899 100644
--- a/client/src/reducers/install.js
+++ b/client/src/reducers/install.js
@@ -7,8 +7,8 @@ import toasts from './toasts';
import { INSTALL_FIRST_STEP } from '../helpers/constants';
const install = handleActions({
- [actions.getDefaultAddressesRequest]: state => ({ ...state, processingDefault: true }),
- [actions.getDefaultAddressesFailure]: state => ({ ...state, processingDefault: false }),
+ [actions.getDefaultAddressesRequest]: (state) => ({ ...state, processingDefault: true }),
+ [actions.getDefaultAddressesFailure]: (state) => ({ ...state, processingDefault: false }),
[actions.getDefaultAddressesSuccess]: (state, { payload }) => {
const { interfaces } = payload;
const web = { ...state.web, port: payload.web_port };
@@ -20,15 +20,15 @@ const install = handleActions({
return newState;
},
- [actions.nextStep]: state => ({ ...state, step: state.step + 1 }),
- [actions.prevStep]: state => ({ ...state, step: state.step - 1 }),
+ [actions.nextStep]: (state) => ({ ...state, step: state.step + 1 }),
+ [actions.prevStep]: (state) => ({ ...state, step: state.step - 1 }),
- [actions.setAllSettingsRequest]: state => ({ ...state, processingSubmit: true }),
- [actions.setAllSettingsFailure]: state => ({ ...state, processingSubmit: false }),
- [actions.setAllSettingsSuccess]: state => ({ ...state, processingSubmit: false }),
+ [actions.setAllSettingsRequest]: (state) => ({ ...state, processingSubmit: true }),
+ [actions.setAllSettingsFailure]: (state) => ({ ...state, processingSubmit: false }),
+ [actions.setAllSettingsSuccess]: (state) => ({ ...state, processingSubmit: false }),
- [actions.checkConfigRequest]: state => ({ ...state, processingCheck: true }),
- [actions.checkConfigFailure]: state => ({ ...state, processingCheck: false }),
+ [actions.checkConfigRequest]: (state) => ({ ...state, processingCheck: true }),
+ [actions.checkConfigFailure]: (state) => ({ ...state, processingCheck: false }),
[actions.checkConfigSuccess]: (state, { payload }) => {
const web = { ...state.web, ...payload.web };
const dns = { ...state.dns, ...payload.dns };
diff --git a/client/src/reducers/login.js b/client/src/reducers/login.js
index e4c860a9..4eb1de98 100644
--- a/client/src/reducers/login.js
+++ b/client/src/reducers/login.js
@@ -6,8 +6,8 @@ import * as actions from '../actions/login';
import toasts from './toasts';
const login = handleActions({
- [actions.processLoginRequest]: state => ({ ...state, processingLogin: true }),
- [actions.processLoginFailure]: state => ({ ...state, processingLogin: false }),
+ [actions.processLoginRequest]: (state) => ({ ...state, processingLogin: true }),
+ [actions.processLoginFailure]: (state) => ({ ...state, processingLogin: false }),
[actions.processLoginSuccess]: (state, { payload }) => ({
...state, ...payload, processingLogin: false,
}),
diff --git a/client/src/reducers/queryLogs.js b/client/src/reducers/queryLogs.js
index de384461..1145bd3f 100644
--- a/client/src/reducers/queryLogs.js
+++ b/client/src/reducers/queryLogs.js
@@ -25,8 +25,8 @@ const queryLogs = handleActions(
page: payload,
}),
- [actions.setLogsFilterRequest]: state => ({ ...state, processingGetLogs: true }),
- [actions.setLogsFilterFailure]: state => ({ ...state, processingGetLogs: false }),
+ [actions.setLogsFilterRequest]: (state) => ({ ...state, processingGetLogs: true }),
+ [actions.setLogsFilterFailure]: (state) => ({ ...state, processingGetLogs: false }),
[actions.setLogsFilterSuccess]: (state, { payload }) => {
const { logs, oldest, filter } = payload;
const pageSize = 100;
@@ -37,7 +37,7 @@ const queryLogs = handleActions(
const rowsStart = pageSize * page;
const rowsEnd = (pageSize * page) + pageSize;
const logsSlice = logs.slice(rowsStart, rowsEnd);
- const isFiltered = Object.keys(filter).some(key => filter[key]);
+ const isFiltered = Object.keys(filter).some((key) => filter[key]);
return {
...state,
@@ -52,8 +52,8 @@ const queryLogs = handleActions(
};
},
- [actions.getLogsRequest]: state => ({ ...state, processingGetLogs: true }),
- [actions.getLogsFailure]: state => ({ ...state, processingGetLogs: false }),
+ [actions.getLogsRequest]: (state) => ({ ...state, processingGetLogs: true }),
+ [actions.getLogsFailure]: (state) => ({ ...state, processingGetLogs: false }),
[actions.getLogsSuccess]: (state, { payload }) => {
const {
logs, oldest, older_than, page, pageSize, initial,
@@ -84,37 +84,37 @@ const queryLogs = handleActions(
};
},
- [actions.clearLogsRequest]: state => ({ ...state, processingClear: true }),
- [actions.clearLogsFailure]: state => ({ ...state, processingClear: false }),
- [actions.clearLogsSuccess]: state => ({
+ [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.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.setLogsConfigRequest]: (state) => ({ ...state, processingSetConfig: true }),
+ [actions.setLogsConfigFailure]: (state) => ({ ...state, processingSetConfig: false }),
[actions.setLogsConfigSuccess]: (state, { payload }) => ({
...state,
...payload,
processingSetConfig: false,
}),
- [actions.getAdditionalLogsRequest]: state => ({
+ [actions.getAdditionalLogsRequest]: (state) => ({
...state, processingAdditionalLogs: true, processingGetLogs: true,
}),
- [actions.getAdditionalLogsFailure]: state => ({
+ [actions.getAdditionalLogsFailure]: (state) => ({
...state, processingAdditionalLogs: false, processingGetLogs: false,
}),
- [actions.getAdditionalLogsSuccess]: state => ({
+ [actions.getAdditionalLogsSuccess]: (state) => ({
...state, processingAdditionalLogs: false, processingGetLogs: false,
}),
},
diff --git a/client/src/reducers/rewrites.js b/client/src/reducers/rewrites.js
index d680b830..dad1efd5 100644
--- a/client/src/reducers/rewrites.js
+++ b/client/src/reducers/rewrites.js
@@ -4,8 +4,8 @@ import * as actions from '../actions/rewrites';
const rewrites = handleActions(
{
- [actions.getRewritesListRequest]: state => ({ ...state, processing: true }),
- [actions.getRewritesListFailure]: state => ({ ...state, processing: false }),
+ [actions.getRewritesListRequest]: (state) => ({ ...state, processing: true }),
+ [actions.getRewritesListFailure]: (state) => ({ ...state, processing: false }),
[actions.getRewritesListSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -15,8 +15,8 @@ const rewrites = handleActions(
return newState;
},
- [actions.addRewriteRequest]: state => ({ ...state, processingAdd: true }),
- [actions.addRewriteFailure]: state => ({ ...state, processingAdd: false }),
+ [actions.addRewriteRequest]: (state) => ({ ...state, processingAdd: true }),
+ [actions.addRewriteFailure]: (state) => ({ ...state, processingAdd: false }),
[actions.addRewriteSuccess]: (state, { payload }) => {
const newState = {
...state,
@@ -26,9 +26,9 @@ const rewrites = handleActions(
return newState;
},
- [actions.deleteRewriteRequest]: state => ({ ...state, processingDelete: true }),
- [actions.deleteRewriteFailure]: state => ({ ...state, processingDelete: false }),
- [actions.deleteRewriteSuccess]: state => ({ ...state, processingDelete: false }),
+ [actions.deleteRewriteRequest]: (state) => ({ ...state, processingDelete: true }),
+ [actions.deleteRewriteFailure]: (state) => ({ ...state, processingDelete: false }),
+ [actions.deleteRewriteSuccess]: (state) => ({ ...state, processingDelete: false }),
[actions.toggleRewritesModal]: (state) => {
const newState = {
diff --git a/client/src/reducers/services.js b/client/src/reducers/services.js
index d91cadf5..7c478366 100644
--- a/client/src/reducers/services.js
+++ b/client/src/reducers/services.js
@@ -4,17 +4,17 @@ import * as actions from '../actions/services';
const services = handleActions(
{
- [actions.getBlockedServicesRequest]: state => ({ ...state, processing: true }),
- [actions.getBlockedServicesFailure]: state => ({ ...state, processing: false }),
+ [actions.getBlockedServicesRequest]: (state) => ({ ...state, processing: true }),
+ [actions.getBlockedServicesFailure]: (state) => ({ ...state, processing: false }),
[actions.getBlockedServicesSuccess]: (state, { payload }) => ({
...state,
list: payload,
processing: false,
}),
- [actions.setBlockedServicesRequest]: state => ({ ...state, processingSet: true }),
- [actions.setBlockedServicesFailure]: state => ({ ...state, processingSet: false }),
- [actions.setBlockedServicesSuccess]: state => ({
+ [actions.setBlockedServicesRequest]: (state) => ({ ...state, processingSet: true }),
+ [actions.setBlockedServicesFailure]: (state) => ({ ...state, processingSet: false }),
+ [actions.setBlockedServicesSuccess]: (state) => ({
...state,
processingSet: false,
}),
diff --git a/client/src/reducers/stats.js b/client/src/reducers/stats.js
index 9a74c1b1..9c986eac 100644
--- a/client/src/reducers/stats.js
+++ b/client/src/reducers/stats.js
@@ -21,24 +21,24 @@ const defaultStats = {
const stats = handleActions(
{
- [actions.getStatsConfigRequest]: state => ({ ...state, processingGetConfig: true }),
- [actions.getStatsConfigFailure]: state => ({ ...state, processingGetConfig: false }),
+ [actions.getStatsConfigRequest]: (state) => ({ ...state, processingGetConfig: true }),
+ [actions.getStatsConfigFailure]: (state) => ({ ...state, processingGetConfig: false }),
[actions.getStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingGetConfig: false,
}),
- [actions.setStatsConfigRequest]: state => ({ ...state, processingSetConfig: true }),
- [actions.setStatsConfigFailure]: state => ({ ...state, processingSetConfig: false }),
+ [actions.setStatsConfigRequest]: (state) => ({ ...state, processingSetConfig: true }),
+ [actions.setStatsConfigFailure]: (state) => ({ ...state, processingSetConfig: false }),
[actions.setStatsConfigSuccess]: (state, { payload }) => ({
...state,
interval: payload.interval,
processingSetConfig: false,
}),
- [actions.getStatsRequest]: state => ({ ...state, processingStats: true }),
- [actions.getStatsFailure]: state => ({ ...state, processingStats: false }),
+ [actions.getStatsRequest]: (state) => ({ ...state, processingStats: true }),
+ [actions.getStatsFailure]: (state) => ({ ...state, processingStats: false }),
[actions.getStatsSuccess]: (state, { payload }) => {
const {
dns_queries: dnsQueries,
@@ -78,9 +78,9 @@ const stats = handleActions(
return newState;
},
- [actions.resetStatsRequest]: state => ({ ...state, processingReset: true }),
- [actions.resetStatsFailure]: state => ({ ...state, processingReset: false }),
- [actions.resetStatsSuccess]: state => ({
+ [actions.resetStatsRequest]: (state) => ({ ...state, processingReset: true }),
+ [actions.resetStatsFailure]: (state) => ({ ...state, processingReset: false }),
+ [actions.resetStatsSuccess]: (state) => ({
...state,
...defaultStats,
processingReset: false,
diff --git a/client/src/reducers/toasts.js b/client/src/reducers/toasts.js
index 34698480..8da15547 100644
--- a/client/src/reducers/toasts.js
+++ b/client/src/reducers/toasts.js
@@ -1,7 +1,10 @@
import { handleActions } from 'redux-actions';
-import nanoid from 'nanoid';
+import { nanoid } from 'nanoid';
-import { addErrorToast, addSuccessToast, addNoticeToast, removeToast } from '../actions';
+import {
+ addErrorToast, addNoticeToast, addSuccessToast,
+} from '../actions/toasts';
+import { removeToast } from '../actions';
const toasts = handleActions({
[addErrorToast]: (state, { payload }) => {
@@ -35,7 +38,7 @@ const toasts = handleActions({
return newState;
},
[removeToast]: (state, { payload }) => {
- const filtered = state.notices.filter(notice => notice.id !== payload);
+ const filtered = state.notices.filter((notice) => notice.id !== payload);
const newState = { ...state, notices: filtered };
return newState;
},
diff --git a/client/webpack.common.js b/client/webpack.common.js
index f4f0bae4..173dd7ab 100644
--- a/client/webpack.common.js
+++ b/client/webpack.common.js
@@ -1,11 +1,10 @@
const path = require('path');
const autoprefixer = require('autoprefixer');
const HtmlWebpackPlugin = require('html-webpack-plugin');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-const webpack = require('webpack');
const flexBugsFixes = require('postcss-flexbugs-fixes');
-const CleanWebpackPlugin = require('clean-webpack-plugin');
+const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const RESOURCES_PATH = path.resolve(__dirname);
const ENTRY_REACT = path.resolve(RESOURCES_PATH, 'src/index.js');
@@ -19,7 +18,15 @@ const ASSETS_PATH = path.resolve(RESOURCES_PATH, 'public/assets');
const PUBLIC_PATH = path.resolve(__dirname, '../build/static');
const PUBLIC_ASSETS_PATH = path.resolve(PUBLIC_PATH, 'assets');
+const BUILD_ENVS = {
+ dev: 'development',
+ prod: 'production',
+};
+
+const BUILD_ENV = BUILD_ENVS[process.env.BUILD_ENV];
+
const config = {
+ mode: BUILD_ENV,
target: 'web',
context: RESOURCES_PATH,
entry: {
@@ -41,10 +48,11 @@ const config = {
module: {
rules: [
{
- test: /\.css$/,
- use: ExtractTextPlugin.extract({
- fallback: 'style-loader',
- use: [{
+ test: /\.css$/i,
+ use: [
+ 'style-loader',
+ MiniCssExtractPlugin.loader,
+ {
loader: 'css-loader',
options: {
importLoaders: 1,
@@ -57,19 +65,12 @@ const config = {
plugins: () => [
flexBugsFixes,
autoprefixer({
- browsers: [
- '>1%',
- 'last 4 versions',
- 'Firefox ESR',
- 'not ie < 9',
- ],
flexbox: 'no-2009',
}),
],
},
},
- ],
- }),
+ ],
},
{
test: /\.js$/,
@@ -78,14 +79,6 @@ const config = {
loader: 'babel-loader',
options: {
cacheDirectory: true,
- presets: [
- ['env', {
- modules: false,
- }],
- 'react',
- 'stage-2',
- ],
- plugins: ['transform-runtime', 'transform-object-rest-spread'],
},
},
},
@@ -103,10 +96,7 @@ const config = {
],
},
plugins: [
- new webpack.DefinePlugin({
- 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
- }),
- new CleanWebpackPlugin(['**/*.*'], {
+ new CleanWebpackPlugin({
root: PUBLIC_PATH,
verbose: false,
dry: false,
@@ -131,12 +121,17 @@ const config = {
filename: 'login.html',
template: HTML_LOGIN_PATH,
}),
- new ExtractTextPlugin({
+ new MiniCssExtractPlugin({
filename: '[name].[contenthash].css',
}),
- new CopyPlugin([
- { from: ASSETS_PATH, to: PUBLIC_ASSETS_PATH },
- ]),
+ new CopyPlugin({
+ patterns: [
+ {
+ from: ASSETS_PATH,
+ to: PUBLIC_ASSETS_PATH,
+ },
+ ],
+ }),
],
};
diff --git a/client/webpack.prod.js b/client/webpack.prod.js
index 1e85f453..d10970b9 100644
--- a/client/webpack.prod.js
+++ b/client/webpack.prod.js
@@ -1,5 +1,4 @@
const StyleLintPlugin = require('stylelint-webpack-plugin');
-const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const merge = require('webpack-merge');
const common = require('./webpack.common.js');
@@ -20,6 +19,5 @@ module.exports = merge(common, {
new StyleLintPlugin({
files: '**/*.css',
}),
- new UglifyJsPlugin(),
],
});