mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
请不要在没有先创建Issue的情况下创建Pull Request。 ## 变更的目的是什么 XXXXX ## 简短的更新日志 XX ## 验证这一变化 XXXX 请遵循此清单,以帮助我们快速轻松地整合您的贡献: * [ ] 一个 PR(Pull Request的简写)只解决一个问题,禁止一个 PR 解决多个问题; * [ ] 确保 PR 有对应的 Issue(通常在您开始处理之前创建),除非是书写错误之类的琐碎更改不需要 Issue ; * [ ] 格式化 PR 及 Commit-Log 的标题及内容,例如 #861 。PS:Commit-Log 需要在 Git Commit 代码时进行填写,在 GitHub 上修改不了; * [ ] 编写足够详细的 PR 描述,以了解 PR 的作用、方式和原因; * [ ] 编写必要的单元测试来验证您的逻辑更正。如果提交了新功能或重大更改,请记住在 test 模块中添加 integration-test; * [ ] 确保编译通过,集成测试通过;
This commit is contained in:
@@ -108,6 +108,7 @@ const api = {
|
|||||||
getTopicState: (clusterPhyId: number, topicName: string) => getApi(`/clusters/${clusterPhyId}/topics/${topicName}/state`),
|
getTopicState: (clusterPhyId: number, topicName: string) => getApi(`/clusters/${clusterPhyId}/topics/${topicName}/state`),
|
||||||
getTopicMetadata: (clusterPhyId: number, topicName: string) =>
|
getTopicMetadata: (clusterPhyId: number, topicName: string) =>
|
||||||
getApi(`/clusters/${clusterPhyId}/topics/${topicName}/metadata-combine-exist`),
|
getApi(`/clusters/${clusterPhyId}/topics/${topicName}/metadata-combine-exist`),
|
||||||
|
deleteTopicData: () => getApi(`/topics/truncate-topic`),
|
||||||
|
|
||||||
// 最新的指标值
|
// 最新的指标值
|
||||||
getMetricPointsLatest: (clusterPhyId: number) => getApi(`/physical-clusters/${clusterPhyId}/latest-metrics`),
|
getMetricPointsLatest: (clusterPhyId: number) => getApi(`/physical-clusters/${clusterPhyId}/latest-metrics`),
|
||||||
|
|||||||
@@ -1,7 +1,22 @@
|
|||||||
/* eslint-disable react/display-name */
|
/* eslint-disable react/display-name */
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
import { AppContainer, Input, ProTable, Select, Switch, Tooltip, Utils, Dropdown, Menu, Button, Divider, Tag } from 'knowdesign';
|
import {
|
||||||
|
AppContainer,
|
||||||
|
Input,
|
||||||
|
ProTable,
|
||||||
|
Select,
|
||||||
|
Switch,
|
||||||
|
Tooltip,
|
||||||
|
Utils,
|
||||||
|
Dropdown,
|
||||||
|
Menu,
|
||||||
|
Button,
|
||||||
|
Divider,
|
||||||
|
Tag,
|
||||||
|
Popconfirm,
|
||||||
|
notification,
|
||||||
|
} from 'knowdesign';
|
||||||
import { IconFont } from '@knowdesign/icons';
|
import { IconFont } from '@knowdesign/icons';
|
||||||
import Create from './Create';
|
import Create from './Create';
|
||||||
import './index.less';
|
import './index.less';
|
||||||
@@ -85,6 +100,21 @@ const AutoPage = (props: any) => {
|
|||||||
setTopicListLoading(false);
|
setTopicListLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const deleteTopicData = (record: any) => {
|
||||||
|
console.log(record, 'record');
|
||||||
|
const params = {
|
||||||
|
clusterId: Number(routeParams.clusterId),
|
||||||
|
topicName: record.topicName,
|
||||||
|
};
|
||||||
|
Utils.post(Api.deleteTopicData(), params).then((data: any) => {
|
||||||
|
if (data === null) {
|
||||||
|
notification.success({
|
||||||
|
message: '清除数据成功',
|
||||||
|
});
|
||||||
|
getTopicsList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getTopicsList();
|
getTopicsList();
|
||||||
}, [sortObj, showInternalTopics, searchKeywords, pageIndex, pageSize]);
|
}, [sortObj, showInternalTopics, searchKeywords, pageIndex, pageSize]);
|
||||||
@@ -247,7 +277,7 @@ const AutoPage = (props: any) => {
|
|||||||
dataIndex: 'desc',
|
dataIndex: 'desc',
|
||||||
key: 'desc',
|
key: 'desc',
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
width: 140,
|
width: 200,
|
||||||
render: (value: any, record: any) => {
|
render: (value: any, record: any) => {
|
||||||
return (
|
return (
|
||||||
<div className="operation-list">
|
<div className="operation-list">
|
||||||
@@ -257,6 +287,19 @@ const AutoPage = (props: any) => {
|
|||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
{global.hasPermission(ClustersPermissionMap.TOPIC_DEL) ? <Delete record={record} onConfirm={getTopicsList}></Delete> : <></>}
|
{global.hasPermission(ClustersPermissionMap.TOPIC_DEL) ? <Delete record={record} onConfirm={getTopicsList}></Delete> : <></>}
|
||||||
|
{global.hasPermission(ClustersPermissionMap.TOPIC_DEL) ? ( // TODO:替换为清除数据的权限
|
||||||
|
<Popconfirm
|
||||||
|
placement="topRight"
|
||||||
|
title={`是否要清空当前Topic的数据?`}
|
||||||
|
onConfirm={() => deleteTopicData(record)}
|
||||||
|
okText="是"
|
||||||
|
cancelText="否"
|
||||||
|
>
|
||||||
|
<Button type="link">清除数据</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user