badguardhome/client/src/components/Settings/Encryption/index.js
2019-02-15 16:28:27 +03:00

48 lines
1.3 KiB
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { withNamespaces } from 'react-i18next';
import Form from './Form';
import Card from '../../ui/Card';
class Encryption extends Component {
handleFormSubmit = (values) => {
this.props.setTlsConfig(values);
};
render() {
const { encryption, t } = this.props;
const {
processing,
processingConfig,
...values
} = encryption;
return (
<div className="encryption">
{encryption && !encryption.processing &&
<Card
title={t('encryption_title')}
subtitle={t('encryption_desc')}
bodyType="card-body box-body--settings"
>
<Form
initialValues={{ ...values }}
processing={encryption.processingConfig}
onSubmit={this.handleFormSubmit}
/>
</Card>
}
</div>
);
}
}
Encryption.propTypes = {
setTlsConfig: PropTypes.func.isRequired,
encryption: PropTypes.object.isRequired,
t: PropTypes.func.isRequired,
};
export default withNamespaces()(Encryption);