2019-08-28 15:55:53 +00:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-22 14:06:05 +00:00
|
|
|
import { withTranslation, Trans } from 'react-i18next';
|
2019-08-28 15:55:53 +00:00
|
|
|
import format from 'date-fns/format';
|
|
|
|
|
|
|
|
import { EMPTY_DATE } from '../../../helpers/constants';
|
|
|
|
|
|
|
|
const CertificateStatus = ({
|
|
|
|
validChain,
|
|
|
|
validCert,
|
|
|
|
subject,
|
|
|
|
issuer,
|
|
|
|
notAfter,
|
|
|
|
dnsNames,
|
|
|
|
}) => (
|
|
|
|
<Fragment>
|
|
|
|
<div className="form__label form__label--bold">
|
|
|
|
<Trans>encryption_status</Trans>:
|
|
|
|
</div>
|
|
|
|
<ul className="encryption__list">
|
|
|
|
<li
|
|
|
|
className={validChain ? 'text-success' : 'text-danger'}
|
|
|
|
>
|
|
|
|
{validChain ? (
|
|
|
|
<Trans>encryption_chain_valid</Trans>
|
|
|
|
) : (
|
|
|
|
<Trans>encryption_chain_invalid</Trans>
|
|
|
|
)}
|
|
|
|
</li>
|
|
|
|
{validCert && (
|
|
|
|
<Fragment>
|
|
|
|
{subject && (
|
|
|
|
<li>
|
|
|
|
<Trans>encryption_subject</Trans>:
|
|
|
|
{subject}
|
|
|
|
</li>
|
|
|
|
)}
|
|
|
|
{issuer && (
|
|
|
|
<li>
|
|
|
|
<Trans>encryption_issuer</Trans>:
|
|
|
|
{issuer}
|
|
|
|
</li>
|
|
|
|
)}
|
|
|
|
{notAfter && notAfter !== EMPTY_DATE && (
|
|
|
|
<li>
|
|
|
|
<Trans>encryption_expire</Trans>:
|
|
|
|
{format(notAfter, 'YYYY-MM-DD HH:mm:ss')}
|
|
|
|
</li>
|
|
|
|
)}
|
|
|
|
{dnsNames && (
|
|
|
|
<li>
|
|
|
|
<Trans>encryption_hostnames</Trans>:
|
|
|
|
{dnsNames}
|
|
|
|
</li>
|
|
|
|
)}
|
|
|
|
</Fragment>
|
|
|
|
)}
|
|
|
|
</ul>
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
|
|
|
|
CertificateStatus.propTypes = {
|
|
|
|
validChain: PropTypes.bool.isRequired,
|
|
|
|
validCert: PropTypes.bool.isRequired,
|
|
|
|
subject: PropTypes.string,
|
|
|
|
issuer: PropTypes.string,
|
|
|
|
notAfter: PropTypes.string,
|
|
|
|
dnsNames: PropTypes.string,
|
|
|
|
};
|
|
|
|
|
2020-05-22 14:06:05 +00:00
|
|
|
export default withTranslation()(CertificateStatus);
|