+
{title}
= ({
{formData[key]?.errorMsg}
- {description}
+ {description && (
+ {description}
+ )}
);
})}
diff --git a/ui/src/pages/Admin/Answers/index.tsx b/ui/src/pages/Admin/Answers/index.tsx
index 3221f60f..c59a62b6 100644
--- a/ui/src/pages/Admin/Answers/index.tsx
+++ b/ui/src/pages/Admin/Answers/index.tsx
@@ -1,8 +1,10 @@
import { FC } from 'react';
-import { Button, Form, Table, Stack, Badge } from 'react-bootstrap';
+import { Button, Form, Table, Stack } from 'react-bootstrap';
import { useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
+import classNames from 'classnames';
+
import {
FormatTime,
Icon,
@@ -159,9 +161,13 @@ const Answers: FC = () => {
-
+
{t(ADMIN_LIST_STATUS[curFilter]?.name)}
-
+
|
{curFilter !== 'deleted' && (
diff --git a/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx b/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx
index 08bcacc1..4aca368a 100644
--- a/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx
+++ b/ui/src/pages/Admin/Dashboard/components/HealthStatus/index.tsx
@@ -1,5 +1,5 @@
import { FC } from 'react';
-import { Card, Row, Col, Badge } from 'react-bootstrap';
+import { Card, Row, Col } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
@@ -29,38 +29,31 @@ const HealthStatus: FC = ({ data }) => {
{t('version')}
{version}
{isLatest && (
-
+ href="https://github.com/answerdev/answer/releases"
+ rel="noreferrer">
{t('latest')}
-
+
)}
{!isLatest && hasNewerVersion && (
-
+ href="https://github.com/answerdev/answer/releases"
+ rel="noreferrer">
{t('update_to')} {remote_version}
-
+
)}
{!isLatest && !remote_version && (
-
+ href="https://github.com/answerdev/answer/releases"
+ rel="noreferrer">
{t('check_failed')}
-
+
)}
diff --git a/ui/src/pages/Admin/Questions/index.tsx b/ui/src/pages/Admin/Questions/index.tsx
index 4169b840..924e6dd9 100644
--- a/ui/src/pages/Admin/Questions/index.tsx
+++ b/ui/src/pages/Admin/Questions/index.tsx
@@ -1,8 +1,10 @@
import { FC } from 'react';
-import { Button, Form, Table, Stack, Badge } from 'react-bootstrap';
+import { Button, Form, Table, Stack } from 'react-bootstrap';
import { Link, useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
+import classNames from 'classnames';
+
import {
FormatTime,
Icon,
@@ -167,9 +169,13 @@ const Questions: FC = () => {
|
-
+
{t(ADMIN_LIST_STATUS[curFilter]?.name)}
-
+
|
{curFilter !== 'deleted' && (
diff --git a/ui/src/pages/Admin/Smtp/index.tsx b/ui/src/pages/Admin/Smtp/index.tsx
index 26cdd451..adfaff9b 100644
--- a/ui/src/pages/Admin/Smtp/index.tsx
+++ b/ui/src/pages/Admin/Smtp/index.tsx
@@ -37,8 +37,8 @@ const Smtp: FC = () => {
type: 'boolean',
title: t('encryption.label'),
description: t('encryption.text'),
- enum: ['SSL', ''],
- enumNames: ['SSL', ''],
+ enum: ['SSL', 'None'],
+ enumNames: ['SSL', 'None'],
},
smtp_port: {
type: 'string',
@@ -54,12 +54,10 @@ const Smtp: FC = () => {
smtp_username: {
type: 'string',
title: t('smtp_username.label'),
- description: t('smtp_username.text'),
},
smtp_password: {
type: 'string',
title: t('smtp_password.label'),
- description: t('smtp_password.text'),
},
test_email_recipient: {
type: 'string',
@@ -70,15 +68,35 @@ const Smtp: FC = () => {
};
const uiSchema: UISchema = {
encryption: {
- 'ui:widget': 'radio',
+ 'ui:widget': 'select',
+ },
+ smtp_username: {
+ 'ui:options': {
+ validator: (value: string, formData) => {
+ if (formData.smtp_authentication.value) {
+ if (!value) {
+ return t('smtp_username.msg');
+ }
+ }
+ return true;
+ },
+ },
},
smtp_password: {
'ui:options': {
type: 'password',
+ validator: (value: string, formData) => {
+ if (formData.smtp_authentication.value) {
+ if (!value) {
+ return t('smtp_password.msg');
+ }
+ }
+ return true;
+ },
},
},
smtp_authentication: {
- 'ui:widget': 'radio',
+ 'ui:widget': 'switch',
},
smtp_port: {
'ui:options': {
@@ -116,8 +134,12 @@ const Smtp: FC = () => {
encryption: formData.encryption.value,
smtp_port: Number(formData.smtp_port.value),
smtp_authentication: formData.smtp_authentication.value,
- smtp_username: formData.smtp_username.value,
- smtp_password: formData.smtp_password.value,
+ ...(formData.smtp_authentication.value
+ ? { smtp_username: formData.smtp_username.value }
+ : {}),
+ ...(formData.smtp_authentication.value
+ ? { smtp_password: formData.smtp_password.value }
+ : {}),
test_email_recipient: formData.test_email_recipient.value,
};
@@ -151,6 +173,22 @@ const Smtp: FC = () => {
setFormData(formState);
}, [setting]);
+ useEffect(() => {
+ if (formData.smtp_authentication.value) {
+ setFormData({
+ ...formData,
+ smtp_username: { ...formData.smtp_username, hidden: false },
+ smtp_password: { ...formData.smtp_password, hidden: false },
+ });
+ } else {
+ setFormData({
+ ...formData,
+ smtp_username: { ...formData.smtp_username, hidden: true },
+ smtp_password: { ...formData.smtp_password, hidden: true },
+ });
+ }
+ }, [formData.smtp_authentication]);
+
const handleOnChange = (data) => {
setFormData(data);
};
diff --git a/ui/src/pages/Admin/Users/index.tsx b/ui/src/pages/Admin/Users/index.tsx
index 58b849d1..e541e2a4 100644
--- a/ui/src/pages/Admin/Users/index.tsx
+++ b/ui/src/pages/Admin/Users/index.tsx
@@ -1,8 +1,10 @@
import { FC } from 'react';
-import { Button, Form, Table, Badge } from 'react-bootstrap';
+import { Button, Form, Table } from 'react-bootstrap';
import { useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
+import classNames from 'classnames';
+
import {
Pagination,
FormatTime,
@@ -24,10 +26,10 @@ const UserFilterKeys: Type.UserFilterBy[] = [
];
const bgMap = {
- normal: 'success',
- suspended: 'danger',
- deleted: 'danger',
- inactive: 'secondary',
+ normal: 'text-bg-success',
+ suspended: 'text-bg-danger',
+ deleted: 'text-bg-danger',
+ inactive: 'text-bg-secondary',
};
const PAGE_SIZE = 10;
@@ -132,7 +134,9 @@ const Users: FC = () => {
|
)}
- {t(user.status)}
+
+ {t(user.status)}
+
|
{curFilter !== 'deleted' ? (
diff --git a/ui/src/pages/Review/index.tsx b/ui/src/pages/Review/index.tsx
index 54e295e0..a4a20011 100644
--- a/ui/src/pages/Review/index.tsx
+++ b/ui/src/pages/Review/index.tsx
@@ -1,13 +1,5 @@
import { FC, useEffect, useState } from 'react';
-import {
- Container,
- Row,
- Col,
- Alert,
- Badge,
- Stack,
- Button,
-} from 'react-bootstrap';
+import { Container, Row, Col, Alert, Stack, Button } from 'react-bootstrap';
import { Link } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
@@ -120,9 +112,7 @@ const Index: FC = () => {
-
- {editBadge}
-
+ {editBadge}
{itemTitle}
diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsx
index ad08aa5e..fbbb67b8 100644
--- a/ui/src/pages/Search/components/SearchItem/index.tsx
+++ b/ui/src/pages/Search/components/SearchItem/index.tsx
@@ -1,5 +1,5 @@
import { memo, FC } from 'react';
-import { ListGroupItem, Badge } from 'react-bootstrap';
+import { ListGroupItem } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Icon, Tag, FormatTime, BaseUserCard } from '@/components';
@@ -21,12 +21,11 @@ const Index: FC = ({ data }) => {
return (
)}
|