diff --git a/km-console/packages/layout-clusters-fe/src/pages/MirrorMaker2/index.less b/km-console/packages/layout-clusters-fe/src/pages/MirrorMaker2/index.less
index 826649028..d73f5625a 100644
--- a/km-console/packages/layout-clusters-fe/src/pages/MirrorMaker2/index.less
+++ b/km-console/packages/layout-clusters-fe/src/pages/MirrorMaker2/index.less
@@ -185,7 +185,7 @@
.operate-connector-drawer-use-json {
.CodeMirror.cm-s-default {
- height: calc(100vh - 146px);
+ height: calc(100vh - 196px);
}
.dcloud-form-item {
margin-bottom: 0 !important;
diff --git a/km-console/packages/layout-clusters-fe/src/pages/MutliClusterPage/AccessCluster.tsx b/km-console/packages/layout-clusters-fe/src/pages/MutliClusterPage/AccessCluster.tsx
index 28992f47d..fec1a8a6b 100644
--- a/km-console/packages/layout-clusters-fe/src/pages/MutliClusterPage/AccessCluster.tsx
+++ b/km-console/packages/layout-clusters-fe/src/pages/MutliClusterPage/AccessCluster.tsx
@@ -522,28 +522,22 @@ const ConnectorForm = (props: {
const params = {
...values,
id: initFieldsValue?.id,
- jmxProperties: values.jmxProperties ? `{ "jmxProperties": "${values.jmxProperties}" }` : undefined,
+ jmxProperties: values.jmxProperties ? `{ "jmxPort": "${values.jmxProperties}" }` : undefined,
};
- Utils.put(api.batchConnectClusters, [params])
- .then((res) => {
- // setSelectedTabKey(undefined);
- getConnectClustersList();
- notification.success({
- message: '修改Connect集群成功',
- });
- })
- .catch((error) => {
- notification.success({
- message: '修改Connect集群失败',
- });
+ Utils.put(api.batchConnectClusters, [params]).then((res) => {
+ // setSelectedTabKey(undefined);
+ getConnectClustersList();
+ notification.success({
+ message: '修改Connect集群成功',
});
+ });
};
const onCancel = () => {
setSelectedTabKey(undefined);
try {
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
- form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxProperties });
+ form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxPort });
} catch {
form.setFieldsValue({ ...initFieldsValue });
}
@@ -552,7 +546,7 @@ const ConnectorForm = (props: {
useLayoutEffect(() => {
try {
const jmxPortInfo = JSON.parse(initFieldsValue.jmxProperties) || {};
- form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxProperties });
+ form.setFieldsValue({ ...initFieldsValue, jmxProperties: jmxPortInfo.jmxPort });
} catch {
form.setFieldsValue({ ...initFieldsValue });
}
diff --git a/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/EditDrawer.tsx b/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/EditDrawer.tsx
index a325a9bce..1cc3a9099 100644
--- a/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/EditDrawer.tsx
+++ b/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/EditDrawer.tsx
@@ -132,16 +132,35 @@ const AddDrawer = forwardRef((_, ref) => {
form.validateFields().then((formData) => {
const submitData = [];
const { configType, principle, kafkaUser } = formData;
-
if (configType === 'custom') {
// 1. 自定义权限
- const { resourceType, resourcePatternType, aclPermissionType, aclOperation, aclClientHost } = formData;
+ // TODO: 需要和后端联调
+ const {
+ resourceType,
+ resourcePatternType,
+ aclPermissionType,
+ aclOperation,
+ aclClientHost,
+ cluster,
+ topicName,
+ topicPatternType,
+ groupName,
+ groupPatternType,
+ transactionalId,
+ transactionalIdPatternType,
+ } = formData;
submitData.push({
clusterId,
kafkaUser: principle === 'all' ? '*' : kafkaUser,
resourceType,
- resourcePatternType,
- resourceName: '*',
+ resourcePatternType: cluster
+ ? 3
+ : topicPatternType
+ ? topicPatternType
+ : groupPatternType
+ ? groupPatternType
+ : transactionalIdPatternType,
+ resourceName: cluster ? cluster : topicName ? topicName : groupName ? groupName : transactionalId,
aclPermissionType,
aclOperation,
aclClientHost,
@@ -281,6 +300,42 @@ const AddDrawer = forwardRef((_, ref) => {
{({ getFieldValue }) => {
+ const SelectFormItems = (props: { type: string }) => {
+ const { type } = props;
+ return (
+ ({
+ validator: (rule: any, value: string) => {
+ if (!value) {
+ return Promise.reject(`${type}Name 不能为空`);
+ }
+ if (type === 'topic' && getFieldValue(`${type}PatternType`) === ACL_PATTERN_TYPE['Literal']) {
+ return Utils.request(api.getTopicMetadata(clusterId as any, value)).then((res: any) => {
+ return res?.exist ? Promise.resolve() : Promise.reject('该 Topic 不存在');
+ });
+ }
+ return Promise.resolve();
+ },
+ }),
+ ]}
+ >
+ {
+ if (option?.value.includes(value)) {
+ return true;
+ }
+ return false;
+ }}
+ options={type === 'topic' ? topicMetaData : groupMetaData}
+ placeholder={`请输入 ${type}Name`}
+ />
+
+ );
+ };
const PatternTypeFormItems = (props: { type: string }) => {
const { type } = props;
const UpperCaseType = type[0].toUpperCase() + type.slice(1);
@@ -311,37 +366,43 @@ const AddDrawer = forwardRef((_, ref) => {
{({ getFieldValue }) =>
getFieldValue(`${type}Principle`) === 'special' ? (
- ({
- validator: (rule: any, value: string) => {
- if (!value) {
- return Promise.reject(`${UpperCaseType}Name 不能为空`);
- }
- if (type === 'topic' && getFieldValue(`${type}PatternType`) === ACL_PATTERN_TYPE['Literal']) {
- return Utils.request(api.getTopicMetadata(clusterId as any, value)).then((res: any) => {
- return res?.exist ? Promise.resolve() : Promise.reject('该 Topic 不存在');
- });
+ type !== 'transactionalId' ? (
+ ({
+ validator: (rule: any, value: string) => {
+ if (!value) {
+ return Promise.reject(`${UpperCaseType}Name 不能为空`);
+ }
+ if (type === 'topic' && getFieldValue(`${type}PatternType`) === ACL_PATTERN_TYPE['Literal']) {
+ return Utils.request(api.getTopicMetadata(clusterId as any, value)).then((res: any) => {
+ return res?.exist ? Promise.resolve() : Promise.reject('该 Topic 不存在');
+ });
+ }
+ return Promise.resolve();
+ },
+ }),
+ ]}
+ >
+ {
+ if (option?.value.includes(value)) {
+ return true;
}
- return Promise.resolve();
- },
- }),
- ]}
- >
- {
- if (option?.value.includes(value)) {
- return true;
- }
- return false;
- }}
- options={type === 'topic' ? topicMetaData : groupMetaData}
- placeholder={`请输入 ${type}Name`}
- />
-
+ return false;
+ }}
+ options={type === 'topic' ? topicMetaData : groupMetaData}
+ placeholder={`请输入 ${type}Name`}
+ />
+
+ ) : (
+
+
+
+ )
) : null
}
@@ -363,7 +424,7 @@ const AddDrawer = forwardRef((_, ref) => {
Deny
-
{
Literal
Prefixed
-
+ */}
{
}))}
/>
+
+ {({ getFieldValue }) => {
+ const type = getFieldValue('resourceType');
+ if (type === ACL_RESOURCE_TYPE['Cluster']) {
+ //TODO需要和后端获取集群和事务接口联调
+ return (
+
+
+
+ );
+ } else if (type === ACL_RESOURCE_TYPE['TransactionalId']) {
+ return ;
+ } else if (type === ACL_RESOURCE_TYPE['Topic']) {
+ return ;
+ } else if (type === ACL_RESOURCE_TYPE['Group']) {
+ return ;
+ }
+ return null;
+ }}
+
{({ getFieldValue }) => {
form.resetFields(['aclOperation']);
diff --git a/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/index.tsx b/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/index.tsx
index 9919afdda..46befe501 100644
--- a/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/index.tsx
+++ b/km-console/packages/layout-clusters-fe/src/pages/SecurityACLs/index.tsx
@@ -14,6 +14,7 @@ import AddACLDrawer, {
RESOURCE_TO_OPERATIONS_MAP,
RESOURCE_MAP_KEYS,
} from './EditDrawer';
+import { ClustersPermissionMap } from '../CommonConfig';
import './index.less';
const { confirm } = Modal;
@@ -105,7 +106,7 @@ const SecurityACLs = (): JSX.Element => {
};
const columns = () => {
- const baseColumns = [
+ const baseColumns: any = [
{
title: 'Principal',
dataIndex: 'kafkaUser',
@@ -143,7 +144,9 @@ const SecurityACLs = (): JSX.Element => {
title: 'Host',
dataIndex: 'aclClientHost',
},
- {
+ ];
+ if (global.hasPermission && global.hasPermission(ClustersPermissionMap.SECURITY_ACL_DELETE)) {
+ baseColumns.push({
title: '操作',
dataIndex: '',
width: 120,
@@ -156,8 +159,8 @@ const SecurityACLs = (): JSX.Element => {
>
);
},
- },
- ];
+ });
+ }
return baseColumns;
};
@@ -238,15 +241,19 @@ const SecurityACLs = (): JSX.Element => {
-