mirror of https://gitee.com/answerdev/answer.git
Merge branch 'ui-v0.3' of git.backyard.segmentfault.com:opensource/answer into ui-v0.3
This commit is contained in:
commit
ccc2fae7ef
|
@ -342,7 +342,10 @@ export interface AdminDashboard {
|
|||
time_zone: string;
|
||||
occupying_storage_space: string;
|
||||
app_start_time: number;
|
||||
app_version: string;
|
||||
https: boolean;
|
||||
version_info: {
|
||||
remote_version: string;
|
||||
version: string;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -991,6 +991,7 @@
|
|||
"site_url": {
|
||||
"label": "Site URL",
|
||||
"msg": "Site url cannot be empty.",
|
||||
"validate": "Please enter a valid URL.",
|
||||
"text": "The address of your site."
|
||||
},
|
||||
"short_description": {
|
||||
|
@ -1006,6 +1007,7 @@
|
|||
"contact_email": {
|
||||
"label": "Contact Email",
|
||||
"msg": "Contact email cannot be empty.",
|
||||
"validate": "Contact email is not valid.",
|
||||
"text": "Email address of key contact responsible for this site."
|
||||
}
|
||||
},
|
||||
|
|
|
@ -11,7 +11,8 @@ interface IProps {
|
|||
|
||||
const HealthStatus: FC<IProps> = ({ data }) => {
|
||||
const { t } = useTranslation('translation', { keyPrefix: 'admin.dashboard' });
|
||||
|
||||
const { version, remote_version } = data.version_info || {};
|
||||
const isLatest = version === remote_version;
|
||||
return (
|
||||
<Card className="mb-4">
|
||||
<Card.Body>
|
||||
|
@ -19,10 +20,22 @@ const HealthStatus: FC<IProps> = ({ data }) => {
|
|||
<Row>
|
||||
<Col xs={6} className="mb-1 d-flex align-items-center">
|
||||
<span className="text-secondary me-1">{t('version')}</span>
|
||||
<strong>90</strong>
|
||||
<Badge pill bg="warning" text="dark" className="ms-1">
|
||||
{t('update_to')} {data.app_version}
|
||||
</Badge>
|
||||
<strong>{version}</strong>
|
||||
{isLatest && (
|
||||
<Badge pill bg="success" className="ms-1">
|
||||
{t('latest')}
|
||||
</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 xs={6} className="mb-1">
|
||||
<span className="text-secondary me-1">{t('https')}</span>
|
||||
|
|
|
@ -18,6 +18,7 @@ const Dashboard: FC = () => {
|
|||
if (!data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<h3 className="text-capitalize">{t('title')}</h3>
|
||||
|
@ -36,12 +37,6 @@ const Dashboard: FC = () => {
|
|||
<AnswerLinks />
|
||||
</Col>
|
||||
</Row>
|
||||
{process.env.REACT_APP_VERSION && (
|
||||
<p className="mt-4">
|
||||
{`${t('version')} `}
|
||||
{process.env.REACT_APP_VERSION}
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -62,7 +62,15 @@ const General: FC = () => {
|
|||
isInvalid: true,
|
||||
errorMsg: t('site_url.msg'),
|
||||
};
|
||||
} else if (!/^(https?):\/\/([\w.]+\/?)\S*$/.test(site_url.value)) {
|
||||
ret = false;
|
||||
formData.site_url = {
|
||||
value: formData.site_url.value,
|
||||
isInvalid: true,
|
||||
errorMsg: t('site_url.validate'),
|
||||
};
|
||||
}
|
||||
|
||||
if (!contact_email.value) {
|
||||
ret = false;
|
||||
formData.contact_email = {
|
||||
|
@ -70,6 +78,17 @@ const General: FC = () => {
|
|||
isInvalid: true,
|
||||
errorMsg: t('contact_email.msg'),
|
||||
};
|
||||
} else if (
|
||||
!/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(
|
||||
contact_email.value,
|
||||
)
|
||||
) {
|
||||
ret = false;
|
||||
formData.contact_email = {
|
||||
value: formData.contact_email.value,
|
||||
isInvalid: true,
|
||||
errorMsg: t('contact_email.validate'),
|
||||
};
|
||||
}
|
||||
setFormData({
|
||||
...formData,
|
||||
|
|
Loading…
Reference in New Issue