Skip to content

Commit c30e9d6

Browse files
committed
feat(frontend): 集群标准化 #4654
# Reviewed, transaction id: 24478
1 parent 40ffffc commit c30e9d6

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

dbm-ui/frontend/src/views/cluster-standardize/components/cluster-selector/Index.vue

+9-7
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@
7575

7676
interface SelectedMap {
7777
[DBTypes.MYSQL]: {
78-
[ClusterTypes.TENDBHA]: ClusterInfo[];
79-
[ClusterTypes.TENDBSINGLE]: ClusterInfo[];
78+
[ClusterTypes.TENDBHA]?: ClusterInfo[];
79+
[ClusterTypes.TENDBSINGLE]?: ClusterInfo[];
8080
};
8181
[DBTypes.TENDBCLUSTER]: {
82-
[ClusterTypes.TENDBCLUSTER]: ClusterInfo[];
82+
[ClusterTypes.TENDBCLUSTER]?: ClusterInfo[];
8383
};
8484
}
8585
</script>
@@ -97,7 +97,7 @@
9797
}
9898

9999
interface Emits {
100-
(e: 'change', value: ClusterInfo[]): void;
100+
(e: 'change', value: Props['selected']): void;
101101
}
102102

103103
const props = defineProps<Props>();
@@ -111,7 +111,7 @@
111111
const { t } = useI18n();
112112

113113
const panelTabActive = ref();
114-
const lastValues = reactive<Record<string, ClusterInfo[]>>({});
114+
const lastValues = reactive<Props['selected']>({});
115115

116116
// const renderCom = computed(
117117
// () => {
@@ -145,15 +145,17 @@
145145
);
146146

147147
watch(panelTabActive, (_, oldValue) => {
148-
lastValues[oldValue] = [];
148+
Object.assign(lastValues, {
149+
[oldValue]: [],
150+
});
149151
});
150152

151153
const handleChange = (values: Record<string, ClusterInfo[]>) => {
152154
Object.assign(lastValues, values);
153155
};
154156

155157
const handleSubmit = () => {
156-
emits('change', Object.values(lastValues).flat());
158+
emits('change', lastValues);
157159
handleClose();
158160
};
159161

dbm-ui/frontend/src/views/cluster-standardize/components/mysql/Index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
};
123123

124124
// 从集群选择器选择确认后
125-
const handelClusterChange = (data: ClusterInfo[]) => {
125+
const handelClusterChange = (data: Record<string, ClusterInfo[]>) => {
126126
const newList = Object.values(data)
127127
.flat()
128128
.reduce<IDataRow[]>((result, item) => {

dbm-ui/frontend/src/views/cluster-standardize/components/tendbcluster/Index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
};
122122

123123
// 从集群选择器选择确认后
124-
const handelClusterChange = (data: ClusterInfo[]) => {
124+
const handelClusterChange = (data: Record<string, ClusterInfo[]>) => {
125125
const newList = Object.values(data)
126126
.flat()
127127
.reduce<IDataRow[]>((result, item) => {

0 commit comments

Comments
 (0)