[Bugfix]修复权限ACL管理中,消费组列表展示错误的问题(#991)

This commit is contained in:
SUZJ
2023-06-06 19:01:08 +08:00
committed by lucasun
parent e1e02f7c2a
commit 3f518c9e63
2 changed files with 19 additions and 1 deletions

View File

@@ -94,6 +94,7 @@ const api = {
getTopicGroupPartitionsHistory: (clusterPhyId: number, groupName: string) =>
getApi(`/clusters/${clusterPhyId}/groups/${groupName}/partitions`),
resetGroupOffset: () => getApi('/group-offsets'),
getGroupOverview: (clusterPhyId: number) => getApi(`/clusters/${clusterPhyId}/groups-overview`),
// topics列表
getTopicsList: (clusterPhyId: number) => getApi(`/clusters/${clusterPhyId}/topics-overview`),

View File

@@ -85,6 +85,7 @@ const AddDrawer = forwardRef((_, ref) => {
return;
});
const [topicMetaData, setTopicMetaData] = React.useState([]);
const [groupMetaData, setGroupMetaData] = React.useState([]);
// 获取 Topic 元信息
const getTopicMetaData = (newValue: any) => {
@@ -102,6 +103,21 @@ const AddDrawer = forwardRef((_, ref) => {
});
};
// 获取 Group 元信息
const getGroupMetaData = () => {
Utils.request(api.getGroupOverview(+clusterId), {
method: 'GET',
}).then((res: any) => {
const groups = res?.bizData.map((item: any) => {
return {
label: item.name,
value: item.name,
};
});
setGroupMetaData(groups);
});
};
// 获取 kafkaUser 列表
const getKafkaUserList = () => {
Utils.request(api.getKafkaUsers(clusterId), {
@@ -209,6 +225,7 @@ const AddDrawer = forwardRef((_, ref) => {
useEffect(() => {
getKafkaUserList();
getTopicMetaData('');
getGroupMetaData();
}, []);
return (
@@ -321,7 +338,7 @@ const AddDrawer = forwardRef((_, ref) => {
}
return false;
}}
options={topicMetaData}
options={type === 'topic' ? topicMetaData : groupMetaData}
placeholder={`请输入 ${type}Name`}
/>
</Form.Item>