Skip to content

Commit

Permalink
Merge branch 'master' into fix/list-obcluster
Browse files Browse the repository at this point in the history
  • Loading branch information
powerfooI committed Mar 18, 2024
2 parents b42a2ca + 15f4e7d commit 198b6ac
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 52 deletions.
14 changes: 12 additions & 2 deletions ui/src/components/EventsTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface EventsTableProps {
cardType?: 'card' | 'proCard';
collapsible?: boolean;
defaultExpand?: boolean;
name?: string;
}

const columns: ColumnsType<DataType> = [
Expand Down Expand Up @@ -133,10 +134,19 @@ export default function EventsTable({
objectType,
cardType,
collapsible = false,
defaultExpand = false
defaultExpand = false,
name
}: EventsTableProps) {
const defaultParams = {};
if(objectType){
defaultParams.objectType = objectType;
}
if(name){
defaultParams.name = name;
}

const { data } = useRequest(getEventsReq, {
defaultParams: objectType && [{ objectType }],
defaultParams: [defaultParams],
});

const CustomCard = (props) => {
Expand Down
16 changes: 12 additions & 4 deletions ui/src/pages/Cluster/Detail/Overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { intl } from '@/utils/intl';
import { PageContainer } from '@ant-design/pro-components';
import { history, useModel } from '@umijs/max';
import { history,useModel } from '@umijs/max';
import { useRequest } from 'ahooks';
import { Button, Row, message } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { Button,Row,message } from 'antd';
import { useEffect,useRef,useState } from 'react';

import EventsTable from '@/components/EventsTable';
import showDeleteConfirm from '@/components/customModal/DeleteModal';
import OperateModal from '@/components/customModal/OperateModal';
import { REFRESH_CLUSTER_TIME } from '@/constants';
import { deleteObcluster, getClusterDetailReq } from '@/services';
import { deleteObcluster,getClusterDetailReq } from '@/services';
import BasicInfo from './BasicInfo';
import ServerTable from './ServerTable';
import ZoneTable from './ZoneTable';
Expand Down Expand Up @@ -139,6 +140,13 @@ const ClusterOverview: React.FC = () => {
/>
)}

{clusterDetail && (
<EventsTable
objectType="OBCLUSTER"
name={clusterDetail?.info?.name}
/>
)}

{clusterDetail && (
<ServerTable servers={clusterDetail.servers as API.Server[]} />
)}
Expand Down
55 changes: 29 additions & 26 deletions ui/src/pages/Tenant/Detail/Backup/BackupConfiguration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,31 @@ import { BACKUP_RESULT_STATUS } from '@/constants';
import { usePublicKey } from '@/hook/usePublicKey';
import { getNSName } from '@/pages/Cluster/Detail/Overview/helper';
import {
deletePolicyOfTenant,
updateBackupPolicyOfTenant,
deletePolicyOfTenant,
updateBackupPolicyOfTenant,
} from '@/services/tenant';
import { intl } from '@/utils/intl';
import { useRequest } from 'ahooks';
import {
Button,
Card,
Col,
Descriptions,
Form,
InputNumber,
Row,
Select,
Space,
message,
Button,
Card,
Col,
Descriptions,
Form,
InputNumber,
Popconfirm,
Row,
Select,
Space,
message
} from 'antd';
import dayjs from 'dayjs';
import { useRef, useState } from 'react';
import { useRef,useState } from 'react';
import {
checkIsSame,
checkScheduleDatesHaveFull,
formatBackupForm,
formatBackupPolicyData,
checkIsSame,
checkScheduleDatesHaveFull,
formatBackupForm,
formatBackupPolicyData,
} from '../../helper';
import BakMethodsList from '../NewBackup/BakMethodsList';
import SchduleSelectFormItem from '../NewBackup/SchduleSelectFormItem';
Expand Down Expand Up @@ -245,16 +246,18 @@ export default function BackupConfiguration({
defaultMessage: '暂停',
})}
</Button>
<Button
onClick={() => deleteBackupPolicyReq({ ns, name })}
type="primary"
danger
<Popconfirm
onConfirm={() => deleteBackupPolicyReq({ ns, name })}
title="删除备份"
description="确定要删除该备份策略吗?"
>
{intl.formatMessage({
id: 'Dashboard.Detail.Backup.BackupConfiguration.Delete',
defaultMessage: '删除',
})}
</Button>
<Button type="primary" danger>
{intl.formatMessage({
id: 'Dashboard.Detail.Backup.BackupConfiguration.Delete',
defaultMessage: '删除',
})}
</Button>
</Popconfirm>
</Space>
}
>
Expand Down
1 change: 1 addition & 0 deletions ui/src/pages/Tenant/Detail/NewBackup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function NewBackup() {
defaultMessage: '请至少配置 1 个全量备份',
}),
);
return;
}
const res = await createBackupPolicyOfTenant({
ns,
Expand Down
10 changes: 5 additions & 5 deletions ui/src/pages/Tenant/Detail/Overview/Backups.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import CollapsibleCard from '@/components/CollapsibleCard';
import { intl } from '@/utils/intl';
import { Col, Descriptions, Table, Tooltip, Typography } from 'antd';
import { Col,Descriptions,Table,Tooltip,Typography } from 'antd';
import type { ColumnsType } from 'antd/es/table';

interface BackupsProps {
Expand Down Expand Up @@ -71,7 +71,7 @@ export default function Backups({ backupPolicy, backupJobs }: BackupsProps) {
);
return (
<div>
{fullArr.length && (
{fullArr.length ? (
<p>
{intl.formatMessage({
id: 'Dashboard.Detail.Overview.Backups.FullBackupTheFirstOf',
Expand All @@ -83,9 +83,9 @@ export default function Backups({ backupPolicy, backupJobs }: BackupsProps) {
defaultMessage: '天',
})}
</p>
)}
) : null}

{incrementalArr.length && (
{incrementalArr.length ? (
<p>
{intl.formatMessage({
id: 'Dashboard.Detail.Overview.Backups.IncrementalBackupTheFirstOf',
Expand All @@ -98,7 +98,7 @@ export default function Backups({ backupPolicy, backupJobs }: BackupsProps) {
defaultMessage: '天',
})}
</p>
)}
) : null}
</div>
);
},
Expand Down
32 changes: 17 additions & 15 deletions ui/src/pages/Tenant/Detail/Overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import EventsTable from '@/components/EventsTable';
import showDeleteConfirm from '@/components/customModal/DeleteModal';
import OperateModal from '@/components/customModal/OperateModal';
import { REFRESH_TENANT_TIME, RESULT_STATUS } from '@/constants';
import { REFRESH_TENANT_TIME,RESULT_STATUS } from '@/constants';
import { getNSName } from '@/pages/Cluster/Detail/Overview/helper';
import {
getEssentialParameters as getEssentialParametersReq,
getSimpleClusterList,
getEssentialParameters as getEssentialParametersReq,
getSimpleClusterList,
} from '@/services';
import {
deleteTenent,
getBackupJobs,
getBackupPolicy,
getTenant,
deleteTenent,
getBackupJobs,
getBackupPolicy,
getTenant,
} from '@/services/tenant';
import { intl } from '@/utils/intl';
import { EllipsisOutlined } from '@ant-design/icons';
import { PageContainer } from '@ant-design/pro-components';
import { history } from '@umijs/max';
import { useRequest } from 'ahooks';
import { Button, Row, Tooltip, message } from 'antd';
import { useEffect, useRef, useState } from 'react';
import { Button,Row,Tooltip,message } from 'antd';
import { useEffect,useRef,useState } from 'react';
import Backups from './Backups';
import BasicInfo from './BasicInfo';
import Replicas from './Replicas';
Expand Down Expand Up @@ -302,12 +302,14 @@ export default function TenantOverview() {
replicaList={tenantDetail.replicas}
/>
)}

<EventsTable
defaultExpand={true}
objectType="OBTENANT"
collapsible={true}
/>
{tenantDetail && (
<EventsTable
defaultExpand={true}
objectType="OBTENANT"
collapsible={true}
name={tenantDetail?.info.name}
/>
)}

<Backups backupJobs={backupJobs} backupPolicy={backupPolicy} />
</Row>
Expand Down
1 change: 1 addition & 0 deletions ui/src/services/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export async function infoReq() {
export async function getEventsReq(params: {
type?: API.EventType;
objectType?: API.EventObjectType;
name?: string;
}) {
const r = await request(`${clusterPrefix}/events`, {
method: 'GET',
Expand Down

0 comments on commit 198b6ac

Please sign in to comment.