2018-08-30 14:25:33 +00:00
|
|
|
import React from 'react';
|
2020-08-13 08:15:45 +00:00
|
|
|
import { Trans, useTranslation } from 'react-i18next';
|
|
|
|
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
import { getVersion } from '../../actions';
|
2019-09-05 16:07:14 +00:00
|
|
|
import './Version.css';
|
|
|
|
|
|
2020-08-13 08:15:45 +00:00
|
|
|
const Version = () => {
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const { t } = useTranslation();
|
2019-06-25 14:56:50 +00:00
|
|
|
const {
|
2020-08-13 08:15:45 +00:00
|
|
|
dnsVersion,
|
|
|
|
|
processingVersion,
|
|
|
|
|
checkUpdateFlag,
|
|
|
|
|
} = useSelector((state) => state?.dashboard ?? {}, shallowEqual);
|
|
|
|
|
|
|
|
|
|
const onClick = () => {
|
|
|
|
|
dispatch(getVersion(true));
|
|
|
|
|
};
|
2019-06-25 14:56:50 +00:00
|
|
|
|
2018-08-30 14:25:33 +00:00
|
|
|
return (
|
2019-09-05 16:07:14 +00:00
|
|
|
<div className="version">
|
|
|
|
|
<div className="version__text">
|
2020-06-02 10:46:35 +00:00
|
|
|
{dnsVersion
|
|
|
|
|
&& <>
|
|
|
|
|
<Trans>version</Trans>:
|
|
|
|
|
<span className="version__value" title={dnsVersion}>{dnsVersion}</span>
|
|
|
|
|
</>}
|
2020-05-27 11:25:27 +00:00
|
|
|
{checkUpdateFlag && <button
|
2019-06-25 14:56:50 +00:00
|
|
|
type="button"
|
|
|
|
|
className="btn btn-icon btn-icon-sm btn-outline-primary btn-sm ml-2"
|
2020-08-13 08:15:45 +00:00
|
|
|
onClick={onClick}
|
2019-06-25 14:56:50 +00:00
|
|
|
disabled={processingVersion}
|
|
|
|
|
title={t('check_updates_now')}
|
|
|
|
|
>
|
|
|
|
|
<svg className="icons">
|
|
|
|
|
<use xlinkHref="#refresh" />
|
|
|
|
|
</svg>
|
2020-05-27 11:25:27 +00:00
|
|
|
</button>}
|
2018-09-21 12:20:41 +00:00
|
|
|
</div>
|
2018-08-30 14:25:33 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
2019-06-25 14:56:50 +00:00
|
|
|
};
|
2018-08-30 14:25:33 +00:00
|
|
|
|
2020-08-13 08:15:45 +00:00
|
|
|
export default Version;
|