2019-02-18 13:06:27 +00:00
|
|
|
import { handleActions } from 'redux-actions';
|
|
|
|
|
|
|
|
import * as actions from '../actions/encryption';
|
|
|
|
|
|
|
|
const encryption = handleActions({
|
2020-05-22 14:06:05 +00:00
|
|
|
[actions.getTlsStatusRequest]: (state) => ({ ...state, processing: true }),
|
|
|
|
[actions.getTlsStatusFailure]: (state) => ({ ...state, processing: false }),
|
2019-02-18 13:06:27 +00:00
|
|
|
[actions.getTlsStatusSuccess]: (state, { payload }) => {
|
|
|
|
const newState = {
|
|
|
|
...state,
|
|
|
|
...payload,
|
|
|
|
processing: false,
|
|
|
|
};
|
|
|
|
return newState;
|
|
|
|
},
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
[actions.setTlsConfigRequest]: (state) => ({ ...state, processingConfig: true }),
|
|
|
|
[actions.setTlsConfigFailure]: (state) => ({ ...state, processingConfig: false }),
|
2019-02-18 13:06:27 +00:00
|
|
|
[actions.setTlsConfigSuccess]: (state, { payload }) => {
|
|
|
|
const newState = {
|
|
|
|
...state,
|
|
|
|
...payload,
|
|
|
|
processingConfig: false,
|
|
|
|
};
|
|
|
|
return newState;
|
|
|
|
},
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
[actions.validateTlsConfigRequest]: (state) => ({ ...state, processingValidate: true }),
|
|
|
|
[actions.validateTlsConfigFailure]: (state) => ({ ...state, processingValidate: false }),
|
2019-02-18 13:06:27 +00:00
|
|
|
[actions.validateTlsConfigSuccess]: (state, { payload }) => {
|
2019-02-20 11:26:56 +00:00
|
|
|
const {
|
|
|
|
issuer = '',
|
|
|
|
key_type = '',
|
|
|
|
not_after = '',
|
|
|
|
not_before = '',
|
|
|
|
subject = '',
|
|
|
|
warning_validation = '',
|
|
|
|
dns_names = '',
|
|
|
|
...values
|
|
|
|
} = payload;
|
|
|
|
|
2019-02-18 13:06:27 +00:00
|
|
|
const newState = {
|
|
|
|
...state,
|
2019-02-20 11:26:56 +00:00
|
|
|
...values,
|
|
|
|
issuer,
|
|
|
|
key_type,
|
|
|
|
not_after,
|
|
|
|
not_before,
|
|
|
|
subject,
|
|
|
|
warning_validation,
|
|
|
|
dns_names,
|
2019-02-18 13:06:27 +00:00
|
|
|
processingValidate: false,
|
|
|
|
};
|
|
|
|
return newState;
|
|
|
|
},
|
|
|
|
}, {
|
|
|
|
processing: true,
|
|
|
|
processingConfig: false,
|
|
|
|
processingValidate: false,
|
|
|
|
enabled: false,
|
|
|
|
dns_names: null,
|
|
|
|
force_https: false,
|
|
|
|
issuer: '',
|
|
|
|
key_type: '',
|
|
|
|
not_after: '',
|
|
|
|
not_before: '',
|
2019-02-19 12:43:36 +00:00
|
|
|
port_dns_over_tls: '',
|
|
|
|
port_https: '',
|
2019-02-18 13:06:27 +00:00
|
|
|
subject: '',
|
|
|
|
valid_chain: false,
|
|
|
|
valid_key: false,
|
2019-02-19 12:43:36 +00:00
|
|
|
valid_cert: false,
|
2019-02-28 11:59:25 +00:00
|
|
|
valid_pair: false,
|
2019-02-18 13:06:27 +00:00
|
|
|
status_cert: '',
|
|
|
|
status_key: '',
|
|
|
|
certificate_chain: '',
|
|
|
|
private_key: '',
|
|
|
|
server_name: '',
|
|
|
|
warning_validation: '',
|
2019-08-28 15:55:53 +00:00
|
|
|
certificate_path: '',
|
|
|
|
private_key_path: '',
|
2019-02-18 13:06:27 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
export default encryption;
|