refactor: improve code reuse rate (#1515)

This commit is contained in:
Yaodong Yu
2023-02-02 16:43:51 +08:00
committed by GitHub
parent f6a502f7ff
commit 19e7d0b0bd
9 changed files with 58 additions and 140 deletions

View File

@ -13,7 +13,7 @@
// limitations under the License.
import React from "react";
import {Button, Popconfirm, Result, Table, Upload} from "antd";
import {Button, Popconfirm, Table, Upload} from "antd";
import {UploadOutlined} from "@ant-design/icons";
import copy from "copy-to-clipboard";
import * as Setting from "./Setting";
@ -25,20 +25,13 @@ import BaseListPage from "./BaseListPage";
class ResourceListPage extends BaseListPage {
constructor(props) {
super(props);
this.state = {
classes: props,
data: [],
pagination: {
current: 1,
pageSize: 10,
},
loading: false,
searchText: "",
searchedColumn: "",
}
componentDidMount() {
this.setState({
fileList: [],
uploading: false,
isAuthorized: true,
};
});
}
deleteResource(i) {
@ -273,17 +266,6 @@ class ResourceListPage extends BaseListPage {
showTotal: () => i18next.t("general:{total} in total").replace("{total}", this.state.pagination.total),
};
if (!this.state.isAuthorized) {
return (
<Result
status="403"
title="403 Unauthorized"
subTitle={i18next.t("general:Sorry, you do not have permission to access this page or logged in status invalid.")}
extra={<a href="/"><Button type="primary">{i18next.t("general:Back Home")}</Button></a>}
/>
);
}
return (
<div>
<Table scroll={{x: "max-content"}} columns={columns} dataSource={resources} rowKey="name" size="middle" bordered pagination={paginationProps}