mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 11:52:08 +08:00
合并主分支进行测试 (#1197)
This commit is contained in:
@@ -26,7 +26,7 @@ public interface GroupManager {
|
|||||||
String searchGroupKeyword,
|
String searchGroupKeyword,
|
||||||
PaginationBaseDTO dto);
|
PaginationBaseDTO dto);
|
||||||
|
|
||||||
PaginationResult<GroupTopicOverviewVO> pagingGroupTopicMembers(Long clusterPhyId, String groupName, PaginationBaseDTO dto);
|
PaginationResult<GroupTopicOverviewVO> pagingGroupTopicMembers(Long clusterPhyId, String groupName, PaginationBaseDTO dto) throws Exception;
|
||||||
|
|
||||||
PaginationResult<GroupOverviewVO> pagingClusterGroupsOverview(Long clusterPhyId, ClusterGroupSummaryDTO dto);
|
PaginationResult<GroupOverviewVO> pagingClusterGroupsOverview(Long clusterPhyId, ClusterGroupSummaryDTO dto);
|
||||||
|
|
||||||
|
|||||||
@@ -118,10 +118,15 @@ public class GroupManagerImpl implements GroupManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PaginationResult<GroupTopicOverviewVO> pagingGroupTopicMembers(Long clusterPhyId, String groupName, PaginationBaseDTO dto) {
|
public PaginationResult<GroupTopicOverviewVO> pagingGroupTopicMembers(Long clusterPhyId, String groupName, PaginationBaseDTO dto) throws Exception {
|
||||||
long startTimeUnitMs = System.currentTimeMillis();
|
long startTimeUnitMs = System.currentTimeMillis();
|
||||||
|
|
||||||
Group group = groupService.getGroupFromDB(clusterPhyId, groupName);
|
ClusterPhy clusterPhy = clusterPhyService.getClusterByCluster(clusterPhyId);
|
||||||
|
if (clusterPhy == null) {
|
||||||
|
return PaginationResult.buildFailure(MsgConstant.getClusterPhyNotExist(clusterPhyId), dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
Group group = groupService.getGroupFromKafka(clusterPhy, groupName);
|
||||||
|
|
||||||
//没有topicMember则直接返回
|
//没有topicMember则直接返回
|
||||||
if (group == null || ValidateUtils.isEmptyList(group.getTopicMembers())) {
|
if (group == null || ValidateUtils.isEmptyList(group.getTopicMembers())) {
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ export enum ClustersPermissionMap {
|
|||||||
TOPIC_CANCEL_REPLICATOR = 'Topic-详情-取消Topic复制',
|
TOPIC_CANCEL_REPLICATOR = 'Topic-详情-取消Topic复制',
|
||||||
// Consumers
|
// Consumers
|
||||||
CONSUMERS_RESET_OFFSET = 'Consumers-重置Offset',
|
CONSUMERS_RESET_OFFSET = 'Consumers-重置Offset',
|
||||||
|
GROUP_DELETE = 'Group-删除',
|
||||||
|
GROUP_TOPIC_DELETE = 'GroupOffset-Topic纬度删除',
|
||||||
|
GROUP_PARTITION_DELETE = 'GroupOffset-Partition纬度删除',
|
||||||
// Test
|
// Test
|
||||||
TEST_CONSUMER = 'Test-Consumer',
|
TEST_CONSUMER = 'Test-Consumer',
|
||||||
TEST_PRODUCER = 'Test-Producer',
|
TEST_PRODUCER = 'Test-Producer',
|
||||||
@@ -54,6 +57,7 @@ export enum ClustersPermissionMap {
|
|||||||
SECURITY_USER_ADD = 'Security-User新增',
|
SECURITY_USER_ADD = 'Security-User新增',
|
||||||
SECURITY_USER_DELETE = 'Security-User删除',
|
SECURITY_USER_DELETE = 'Security-User删除',
|
||||||
SECURITY_USER_EDIT_PASSWORD = 'Security-User修改密码',
|
SECURITY_USER_EDIT_PASSWORD = 'Security-User修改密码',
|
||||||
|
SECURITY_USER_VIEW_PASSWORD = 'Security-User查看密码',
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PermissionNode {
|
export interface PermissionNode {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ export const defaultPagination = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getGroupColumns = (arg?: any) => {
|
export const getGroupColumns = (arg?: any) => {
|
||||||
const columns = [
|
const [global] = AppContainer.useGlobalValue();
|
||||||
|
const columns: any = [
|
||||||
{
|
{
|
||||||
title: 'ConsumerGroup',
|
title: 'ConsumerGroup',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@@ -63,7 +64,9 @@ export const getGroupColumns = (arg?: any) => {
|
|||||||
width: 200,
|
width: 200,
|
||||||
render: (t: number) => (t ? t.toLocaleString() : '-'),
|
render: (t: number) => (t ? t.toLocaleString() : '-'),
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
|
if (global.hasPermission && global.hasPermission(ClustersPermissionMap.GROUP_DELETE)) {
|
||||||
|
columns.push({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'options',
|
dataIndex: 'options',
|
||||||
key: 'options',
|
key: 'options',
|
||||||
@@ -77,8 +80,8 @@ export const getGroupColumns = (arg?: any) => {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
];
|
}
|
||||||
return columns;
|
return columns;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -114,7 +117,7 @@ export const getGtoupTopicColumns = (arg?: any) => {
|
|||||||
render: (t: number) => (t ? t.toLocaleString() : '-'),
|
render: (t: number) => (t ? t.toLocaleString() : '-'),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
if (global.hasPermission && global.hasPermission(ClustersPermissionMap.CONSUMERS_RESET_OFFSET)) {
|
if (global.hasPermission) {
|
||||||
columns.push({
|
columns.push({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'desc',
|
dataIndex: 'desc',
|
||||||
@@ -123,16 +126,24 @@ export const getGtoupTopicColumns = (arg?: any) => {
|
|||||||
render: (value: any, record: any) => {
|
render: (value: any, record: any) => {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<a onClick={() => arg.resetOffset(record)}>重置Offset</a>
|
{global.hasPermission(ClustersPermissionMap.CONSUMERS_RESET_OFFSET) ? (
|
||||||
<Popconfirm
|
<a onClick={() => arg.resetOffset(record)}>重置Offset</a>
|
||||||
placement="top"
|
) : (
|
||||||
title={`是否要删除当前Topic?`}
|
<></>
|
||||||
onConfirm={() => arg.deleteOffset(record)}
|
)}
|
||||||
okText="是"
|
{global.hasPermission(ClustersPermissionMap.GROUP_TOPIC_DELETE) ? (
|
||||||
cancelText="否"
|
<Popconfirm
|
||||||
>
|
placement="top"
|
||||||
<Button type="link">删除</Button>
|
title={`是否要删除当前Topic?`}
|
||||||
</Popconfirm>
|
onConfirm={() => arg.deleteOffset(record)}
|
||||||
|
okText="是"
|
||||||
|
cancelText="否"
|
||||||
|
>
|
||||||
|
<Button type="link">删除</Button>
|
||||||
|
</Popconfirm>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -537,7 +537,7 @@ const ConnectorForm = (props: {
|
|||||||
setSelectedTabKey(undefined);
|
setSelectedTabKey(undefined);
|
||||||
try {
|
try {
|
||||||
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
|
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
|
||||||
form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxProperties });
|
form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxPort });
|
||||||
} catch {
|
} catch {
|
||||||
form.setFieldsValue({ ...initFieldsValue });
|
form.setFieldsValue({ ...initFieldsValue });
|
||||||
}
|
}
|
||||||
@@ -546,7 +546,7 @@ const ConnectorForm = (props: {
|
|||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
try {
|
try {
|
||||||
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
|
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
|
||||||
form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxProperties });
|
form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxPort });
|
||||||
} catch {
|
} catch {
|
||||||
form.setFieldsValue({ ...initFieldsValue });
|
form.setFieldsValue({ ...initFieldsValue });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import api from '@src/api';
|
|||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { regKafkaPassword } from '@src/constants/reg';
|
import { regKafkaPassword } from '@src/constants/reg';
|
||||||
import { tableHeaderPrefix } from '@src/constants/common';
|
import { tableHeaderPrefix } from '@src/constants/common';
|
||||||
|
import { ClustersPermissionMap } from '../CommonConfig';
|
||||||
export const randomString = (len = 32, chars = 'abcdefghijklmnopqrstuvwxyz1234567890'): string => {
|
export const randomString = (len = 32, chars = 'abcdefghijklmnopqrstuvwxyz1234567890'): string => {
|
||||||
const maxPos = chars.length;
|
const maxPos = chars.length;
|
||||||
let str = '';
|
let str = '';
|
||||||
@@ -85,7 +85,7 @@ const PasswordContent = (props: { clusterId: string; name: string }) => {
|
|||||||
const { clusterId, name } = props;
|
const { clusterId, name } = props;
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [pw, setPw] = useState(initialShowPassword);
|
const [pw, setPw] = useState(initialShowPassword);
|
||||||
|
const [global] = AppContainer.useGlobalValue();
|
||||||
const switchPwStatus = () => {
|
const switchPwStatus = () => {
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
@@ -113,9 +113,13 @@ const PasswordContent = (props: { clusterId: string; name: string }) => {
|
|||||||
<Tooltip title={pw} placement="bottom">
|
<Tooltip title={pw} placement="bottom">
|
||||||
<div style={{ maxWidth: '80%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{pw}</div>
|
<div style={{ maxWidth: '80%', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{pw}</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<span style={{ marginLeft: 6 }} onClick={switchPwStatus}>
|
{global.hasPermission(ClustersPermissionMap.SECURITY_USER_VIEW_PASSWORD) ? (
|
||||||
{loading ? <LoadingOutlined /> : pw === initialShowPassword ? <EyeInvisibleOutlined /> : <EyeOutlined />}
|
<span style={{ marginLeft: 6 }} onClick={switchPwStatus}>
|
||||||
</span>
|
{loading ? <LoadingOutlined /> : pw === initialShowPassword ? <EyeInvisibleOutlined /> : <EyeOutlined />}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -323,7 +327,7 @@ const SecurityUsers = (): JSX.Element => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const columns = () => {
|
const columns = () => {
|
||||||
const baseColumns = [
|
const baseColumns: any = [
|
||||||
{
|
{
|
||||||
title: 'KafkaUser',
|
title: 'KafkaUser',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
@@ -348,30 +352,39 @@ const SecurityUsers = (): JSX.Element => {
|
|||||||
return <PasswordContent clusterId={clusterId} name={record.name} />;
|
return <PasswordContent clusterId={clusterId} name={record.name} />;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
|
if (global.hasPermission) {
|
||||||
|
baseColumns.push({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: '',
|
dataIndex: '',
|
||||||
width: 240,
|
width: 240,
|
||||||
render(record: UsersProps) {
|
render(record: UsersProps) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button
|
{global.hasPermission(ClustersPermissionMap.SECURITY_USER_EDIT_PASSWORD) ? (
|
||||||
type="link"
|
<Button
|
||||||
size="small"
|
type="link"
|
||||||
style={{ paddingLeft: 0 }}
|
size="small"
|
||||||
onClick={() => editDrawerRef.current.onOpen(true, UsersOperate.ChangePassword, getKafkaUserList, record)}
|
style={{ paddingLeft: 0 }}
|
||||||
>
|
onClick={() => editDrawerRef.current.onOpen(true, UsersOperate.ChangePassword, getKafkaUserList, record)}
|
||||||
修改密码
|
>
|
||||||
</Button>
|
修改密码
|
||||||
<Button type="link" size="small" onClick={() => onDelete(record)}>
|
</Button>
|
||||||
删除
|
) : (
|
||||||
</Button>
|
<></>
|
||||||
|
)}
|
||||||
|
{global.hasPermission(ClustersPermissionMap.SECURITY_USER_DELETE) ? (
|
||||||
|
<Button type="link" size="small" onClick={() => onDelete(record)}>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
});
|
||||||
];
|
}
|
||||||
|
|
||||||
return baseColumns;
|
return baseColumns;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -454,13 +467,17 @@ const SecurityUsers = (): JSX.Element => {
|
|||||||
setSearchKeywordsInput(e.target.value);
|
setSearchKeywordsInput(e.target.value);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Button
|
{global.hasPermission && global.hasPermission(ClustersPermissionMap.SECURITY_USER_ADD) ? (
|
||||||
type="primary"
|
<Button
|
||||||
// icon={<PlusOutlined />}
|
type="primary"
|
||||||
onClick={() => editDrawerRef.current.onOpen(true, UsersOperate.Add, getKafkaUserList)}
|
// icon={<PlusOutlined />}
|
||||||
>
|
onClick={() => editDrawerRef.current.onOpen(true, UsersOperate.Add, getKafkaUserList)}
|
||||||
新增KafkaUser
|
>
|
||||||
</Button>
|
新增KafkaUser
|
||||||
|
</Button>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class ClusterGroupsController {
|
|||||||
@GetMapping(value = "clusters/{clusterPhyId}/groups/{groupName}/topics-overview")
|
@GetMapping(value = "clusters/{clusterPhyId}/groups/{groupName}/topics-overview")
|
||||||
public PaginationResult<GroupTopicOverviewVO> getGroupTopicsOverview(@PathVariable Long clusterPhyId,
|
public PaginationResult<GroupTopicOverviewVO> getGroupTopicsOverview(@PathVariable Long clusterPhyId,
|
||||||
@PathVariable String groupName,
|
@PathVariable String groupName,
|
||||||
PaginationBaseDTO dto) {
|
PaginationBaseDTO dto) throws Exception {
|
||||||
return groupManager.pagingGroupTopicMembers(clusterPhyId, groupName, dto);
|
return groupManager.pagingGroupTopicMembers(clusterPhyId, groupName, dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user