mirror of https://gitee.com/answerdev/answer.git
refactor(admin): Display version updates
This commit is contained in:
parent
f4a2b6b614
commit
dfaa926e25
|
@ -342,7 +342,10 @@ export interface AdminDashboard {
|
||||||
time_zone: string;
|
time_zone: string;
|
||||||
occupying_storage_space: string;
|
occupying_storage_space: string;
|
||||||
app_start_time: number;
|
app_start_time: number;
|
||||||
app_version: string;
|
|
||||||
https: boolean;
|
https: boolean;
|
||||||
|
version_info: {
|
||||||
|
remote_version: string;
|
||||||
|
version: string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ interface IProps {
|
||||||
|
|
||||||
const HealthStatus: FC<IProps> = ({ data }) => {
|
const HealthStatus: FC<IProps> = ({ data }) => {
|
||||||
const { t } = useTranslation('translation', { keyPrefix: 'admin.dashboard' });
|
const { t } = useTranslation('translation', { keyPrefix: 'admin.dashboard' });
|
||||||
|
const { version, remote_version } = data.version_info || {};
|
||||||
|
const isLatest = version === remote_version;
|
||||||
return (
|
return (
|
||||||
<Card className="mb-4">
|
<Card className="mb-4">
|
||||||
<Card.Body>
|
<Card.Body>
|
||||||
|
@ -19,10 +20,22 @@ const HealthStatus: FC<IProps> = ({ data }) => {
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs={6} className="mb-1 d-flex align-items-center">
|
<Col xs={6} className="mb-1 d-flex align-items-center">
|
||||||
<span className="text-secondary me-1">{t('version')}</span>
|
<span className="text-secondary me-1">{t('version')}</span>
|
||||||
<strong>90</strong>
|
<strong>{version}</strong>
|
||||||
<Badge pill bg="warning" text="dark" className="ms-1">
|
{isLatest && (
|
||||||
{t('update_to')} {data.app_version}
|
<Badge pill bg="success" className="ms-1">
|
||||||
|
{t('latest')}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
)}
|
||||||
|
{!isLatest && remote_version && (
|
||||||
|
<Badge pill bg="warning" text="dark" className="ms-1">
|
||||||
|
{t('update_to')} {remote_version}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
|
{!isLatest && !remote_version && (
|
||||||
|
<Badge pill bg="danger" className="ms-1">
|
||||||
|
{t('check_failed')}
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
<Col xs={6} className="mb-1">
|
<Col xs={6} className="mb-1">
|
||||||
<span className="text-secondary me-1">{t('https')}</span>
|
<span className="text-secondary me-1">{t('https')}</span>
|
||||||
|
|
|
@ -18,6 +18,7 @@ const Dashboard: FC = () => {
|
||||||
if (!data) {
|
if (!data) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h3 className="text-capitalize">{t('title')}</h3>
|
<h3 className="text-capitalize">{t('title')}</h3>
|
||||||
|
|
Loading…
Reference in New Issue