Skip to content

Commit 659e5da

Browse files
authored
前端修复节点label精准搜索及集群topo扩缩容 || Front-end repair node label accurate search and cluster topop size expansion (#788)
1 parent a9aabbe commit 659e5da

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

ui/src/components/TopoComponent/helper.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,16 @@ export const getServerNumber = (
199199
zoneName: string,
200200
): number => {
201201
const zones = topoData.children || [];
202-
for (const zone of zones) {
202+
const newZones = zones?.map((item) => {
203+
if (item.label.includes(':')) {
204+
return {
205+
...item,
206+
label: item.label.split(':')[0],
207+
};
208+
}
209+
return item;
210+
});
211+
for (const zone of newZones) {
203212
if (zone.label === zoneName) {
204213
return zone.children?.length || 0;
205214
}

ui/src/components/customModal/AddZoneModal.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,6 @@ export default function AddZoneModal({
102102
defaultMessage: 'K8s 集群',
103103
})}
104104
name={'k8sCluster'}
105-
rules={[
106-
{
107-
required: true,
108-
message: intl.formatMessage({
109-
id: 'src.components.customModal.401CB296',
110-
defaultMessage: '请选择 K8s 集群',
111-
}),
112-
},
113-
]}
114105
>
115106
<Select
116107
showSearch

ui/src/pages/Tenant/ZoneItem/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ export default function ZoneItem({
5858
: []),
5959
];
6060

61+
const replica = REPLICA_TYPE_LIST?.find((item) =>
62+
item.value?.toLowerCase().includes(obZoneResource['type']?.toLowerCase()),
63+
);
6164
return (
6265
<div
6366
style={{
@@ -107,7 +110,7 @@ export default function ZoneItem({
107110
id: 'src.pages.Tenant.ZoneItem.93E193BC',
108111
defaultMessage: '副本类型',
109112
})}
110-
initialValue={'Full'}
113+
initialValue={isEdit ? replica?.value : 'Full'}
111114
>
112115
<Select options={REPLICA_TYPE_LIST} />
113116
</Form.Item>

ui/src/pages/Tenant/helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,7 @@ export const getOriginResourceUsages = (
312312
current.logDiskSize;
313313
originResourceUsages.obZoneResourceMap[key].availableMemory +=
314314
current.memorySize;
315+
originResourceUsages.obZoneResourceMap[key].type = current.type;
315316
}
316317
});
317318
return originResourceUsages;

ui/src/utils/component.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,21 @@ export const getColumnSearchProps = ({
7676
<SearchOutlined style={{ color: filtered ? '#1677ff' : undefined }} />
7777
),
7878
onFilter: (value, record) => {
79-
const safeValue = value ? value.split(symbol)[0] : '';
80-
const realValue = trim(safeValue.toLowerCase());
79+
const allvalue1 = trim(
80+
(value ? value.split(symbol)[0] : '')?.toLowerCase(),
81+
);
82+
const allvalue2 = trim(
83+
(value ? value.split(symbol)[1] : '')?.toLowerCase(),
84+
);
8185

8286
return arraySearch
8387
? record[dataIndex] &&
84-
record[dataIndex].some(
88+
record[dataIndex]?.some(
8589
(item) =>
86-
(item.key && item.key.toLowerCase().includes(realValue)) ||
87-
(item.value && item.value.toLowerCase().includes(realValue)),
90+
item.key &&
91+
item.key.toLowerCase().includes(allvalue1) &&
92+
item.value &&
93+
item.value.toLowerCase().includes(allvalue2),
8894
)
8995
: record[dataIndex] &&
9096
record[dataIndex]

0 commit comments

Comments
 (0)