add scan immediately.

This commit is contained in:
Simba
2021-01-04 22:06:27 +08:00
parent 91ffc11b90
commit b7f4d87236
4 changed files with 42 additions and 8 deletions
+2 -1
View File
@@ -222,7 +222,8 @@ let LangEn = {
scanPerHour: "Scan every hour",
scanCustom: "Scan custom",
chooseUsers: "Fuzzy search users",
chooseUsersValidate: "choose one more user"
chooseUsersValidate: "choose one more user",
scanLoading: "waiting..."
},
share: {
shareDetail: "Share Detail",
+2 -1
View File
@@ -222,7 +222,8 @@ let LangZh = {
scanPerHour: "每小时",
scanCustom: "自定义",
chooseUsers: "模糊搜索用户",
chooseUsersValidate: "请选择至少一个用户"
chooseUsersValidate: "请选择至少一个用户",
scanLoading: "扫描中,请稍后..."
},
share: {
shareDetail: "分享详情",
@@ -12,6 +12,7 @@ export default class Preference extends BaseEntity {
static URL_API_SYSTEM_CLEANUP = '/api/preference/system/cleanup'
static URL_API_PREFERENCE_EDIT_PREVIEW_CONFIG = '/api/preference/edit/preview/config'
static URL_API_PREFERENCE_EDIT_SCAN = '/api/preference/edit/scan/config'
static URL_API_PREFERENCE_SCAN_ONCE = '/api/preference/scan/once'
//网站名称
@@ -141,6 +142,12 @@ export default class Preference extends BaseEntity {
}
httpScanOnce(successCallback?: any, errorCallback?: any, finalCallback?: any) {
this.httpGet(Preference.URL_API_PREFERENCE_SCAN_ONCE, {}, function (response: any) {
SafeUtil.safeCallback(successCallback)(response);
}, errorCallback, finalCallback)
}
}
+31 -6
View File
@@ -5,8 +5,12 @@ import TankComponent from "../../common/component/TankComponent";
import User from "../../common/model/user/User";
import Moon from "../../common/model/global/Moon";
import TankTitle from "../widget/TankTitle";
import { Button, Divider, Empty, Tag, Tooltip } from "antd";
import { EditOutlined, ThunderboltOutlined } from "@ant-design/icons";
import { Button, Divider, Empty, Tag, Tooltip, message } from "antd";
import {
EditOutlined,
ThunderboltOutlined,
ScanOutlined,
} from "@ant-design/icons";
import InfoCell from "../widget/InfoCell";
import Preference from "../../common/model/preference/Preference";
import TankContentCard from "../widget/TankContentCard";
@@ -65,6 +69,17 @@ export default class Index extends TankComponent<IProps, IState> {
);
}
immediateScan() {
const hide = message.loading(Lang.t("preference.scanLoading"), 0);
this.preference.httpSaveScan(
() => {
message.success(Lang.t("operationSuccess"));
},
null,
hide
);
}
render() {
const {
previewConfig: { previewEngines },
@@ -198,11 +213,21 @@ export default class Index extends TankComponent<IProps, IState> {
<div className="scan-info">
<header>
<p className="title">{Lang.t("preference.scan")}</p>
<Link to={"/preference/scan/edit"}>
<Button type={"primary"} icon={<EditOutlined />}>
{Lang.t("edit")}
<div>
<Button
type="primary"
className="mr10"
icon={<ScanOutlined />}
onClick={() => this.immediateScan()}
>
</Button>
</Link>
<Link to={"/preference/scan/edit"}>
<Button type={"primary"} icon={<EditOutlined />}>
{Lang.t("edit")}
</Button>
</Link>
</div>
</header>
<div className="content">
{scanConfig.enable ? (