Skip to content

Commit 99f6aaf

Browse files
authored
fix: 修复批量编辑node key 参数传递错误 || fix: Fix error in batch editing node key parameter passing error (#783)
1 parent 673bcd1 commit 99f6aaf

File tree

5 files changed

+50
-24
lines changed

5 files changed

+50
-24
lines changed

ui/src/pages/Cluster/Detail/Parameters/index.tsx

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,8 @@ export default function Parameters() {
8181
})}
8282
</Tag>
8383
),
84-
8584
value: 'notMatched',
8685
},
87-
{
88-
label: '/',
89-
value: '',
90-
},
9186
];
9287

9388
const columns = [
@@ -196,13 +191,31 @@ export default function Parameters() {
196191
text: label,
197192
value,
198193
})),
199-
onFilter: (value: any, record) => {
200-
return record?.status === value;
194+
onFilter: (value, record) => {
195+
return value === 'matched'
196+
? record.status === value
197+
: record.status !== 'matched';
201198
},
199+
202200
render: (text) => {
203-
const content = statusList?.find((item) => item.value === text)?.label;
201+
const content =
202+
text === 'matched' ? (
203+
<Tag color={'green'}>
204+
{intl.formatMessage({
205+
id: 'src.pages.Cluster.Detail.Overview.D5CCD27D',
206+
defaultMessage: '已匹配',
207+
})}
208+
</Tag>
209+
) : (
210+
<Tag color={'gold'}>
211+
{intl.formatMessage({
212+
id: 'src.pages.Cluster.Detail.Overview.DF83C06D',
213+
defaultMessage: '不匹配',
214+
})}
215+
</Tag>
216+
);
204217

205-
return !text ? '/' : <span>{content}</span>;
218+
return <span>{content}</span>;
206219
},
207220
},
208221
{

ui/src/pages/K8sCluster/K8sClusterList.tsx

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ import { K8sClusterApi } from '@/api';
55
import showDeleteConfirm from '@/components/customModal/showDeleteConfirm';
66
import { getK8sObclusterListReq } from '@/services';
77
import { formatTime, isNullValue } from '@oceanbase/util';
8-
import { Link, useAccess } from '@umijs/max';
8+
import { Link, useModel } from '@umijs/max';
99
import { useRequest } from 'ahooks';
1010
import { ColumnsType } from 'antd/es/table';
1111
import { useState } from 'react';
1212
import Createk8sClusterModal from './Createk8sClusterModal';
1313

1414
const { Text } = Typography;
1515
export default function K8sClusterList() {
16-
const access = useAccess();
16+
const { initialState } = useModel('@@initialState');
1717
const [visible, setVisible] = useState<boolean>(false);
1818
const [editData, setEditData] = useState<string>({});
1919
const { data, refresh, loading } = useRequest(getK8sObclusterListReq);
@@ -38,6 +38,16 @@ export default function K8sClusterList() {
3838
},
3939
);
4040

41+
const allPolicies = initialState?.policies?.filter(
42+
(policy) => policy.domain === 'k8s-cluster',
43+
);
44+
const k8sClusterAccess = allPolicies?.map(
45+
(item) => `k8sCluster${item.action}`,
46+
);
47+
48+
const k8sClusterwrite = k8sClusterAccess?.includes('k8sClusterwrite');
49+
const k8sClusterread = k8sClusterAccess?.includes('k8sClusterread');
50+
4151
const columns: ColumnsType<API.TenantDetail> = [
4252
{
4353
title: intl.formatMessage({
@@ -47,7 +57,7 @@ export default function K8sClusterList() {
4757
dataIndex: 'name',
4858
render: (text) => (
4959
<Text ellipsis={{ tooltip: text }}>
50-
<Link to={`${text}`}>{text}</Link>
60+
{k8sClusterread ? <Link to={`${text}`}>{text}</Link> : text}
5161
</Text>
5262
),
5363
},
@@ -78,7 +88,7 @@ export default function K8sClusterList() {
7888
dataIndex: 'operation',
7989

8090
render: (_, record) => {
81-
return (
91+
return k8sClusterwrite ? (
8292
<Space>
8393
<a
8494
onClick={() => {
@@ -109,7 +119,7 @@ export default function K8sClusterList() {
109119
})}
110120
</Button>
111121
</Space>
112-
);
122+
) : null;
113123
},
114124
},
115125
];
@@ -128,7 +138,7 @@ export default function K8sClusterList() {
128138
</div>
129139
}
130140
extra={
131-
access.obclusterwrite ? (
141+
k8sClusterwrite ? (
132142
<Button
133143
type="primary"
134144
onClick={() => {

ui/src/pages/Overview/BatchEditNodeDrawer.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,13 @@ const BatchEditNodeDrawer: React.FC<BatchEditNodeDrawerProps> = ({
316316
onClick={() => {
317317
validateFields().then((values) => {
318318
const { labels, taints } = values;
319-
const labelOperations = labels;
319+
const labelOperations = labels?.map((item) => ({
320+
key: item.key.join(),
321+
value: item.value,
322+
operation: item.operation,
323+
}));
320324
const taintOperations = taints?.map((item) => ({
321-
key: item.key,
325+
key: item.key.join(),
322326
value: item.operator === 'Equal' ? item.value : undefined,
323327
effect: item.effect,
324328
operation: item.operation,

ui/src/pages/Tenant/Detail/Overview/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,9 @@ export default function TenantOverview() {
140140
{
141141
label: intl.formatMessage({
142142
id: 'src.pages.Tenant.Detail.Overview.98BA8E85',
143-
defaultMessage: '创建租户恢复策略',
143+
defaultMessage: '恢复租户',
144144
}),
145+
145146
key: 'createBackupPolicy',
146147
},
147148
]

ui/src/utils/component.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ export const getColumnSearchProps = ({
4242
item.value.toLowerCase().includes(realValue),
4343
)
4444
: record[dataIndex] &&
45-
trim(
46-
record[dataIndex]
47-
.toString()
48-
.toLowerCase()
49-
.includes(value && value.toLowerCase()),
50-
);
45+
record[dataIndex]
46+
.toString()
47+
.toLowerCase()
48+
.includes(trim(value && value.toLowerCase()));
5149
},
5250
}
5351
: {}),

0 commit comments

Comments
 (0)