From bac1f761d26b1020eaace4e88453dfdfb1026dd7 Mon Sep 17 00:00:00 2001
From: Austin <1344583166@qq.com>
Date: Mon, 25 Nov 2024 10:02:32 +0800
Subject: [PATCH] =?UTF-8?q?fix(frontend):=20redis=E9=9B=86=E7=BE=A4?=
 =?UTF-8?q?=E5=AE=B9=E9=87=8F=E3=80=81=E5=88=86=E7=89=87=E5=92=8C=E7=B1=BB?=
 =?UTF-8?q?=E5=9E=8B=E5=8F=98=E6=9B=B4=E5=AE=B9=E7=81=BE=E8=A6=81=E6=B1=82?=
 =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=BC=82=E5=B8=B8=E4=BF=AE=E5=A4=8D=20#8138?=
 =?UTF-8?q?=20#=20Reviewed,=20transaction=20id:=2024656?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../generateCloneData/redis/clusterShardUpdate.ts      |  1 +
 .../generateCloneData/redis/clusterTypeUpdate.ts       |  1 +
 .../generateCloneData/redis/scaleUpdown.ts             |  1 +
 .../redis/capacity-change/pages/page1/Index.vue        |  2 +-
 .../pages/page1/components/ClusterDeployPlan.vue       | 10 +++++-----
 .../pages/page1/components/RenderTargetCapacity.vue    |  2 +-
 .../capacity-change/pages/page1/components/Row.vue     |  2 ++
 .../redis/cluster-shard-update/pages/page1/Index.vue   |  1 +
 .../pages/page1/components/Row.vue                     |  6 ++++--
 .../redis/cluster-type-update/pages/page1/Index.vue    |  2 +-
 .../cluster-type-update/pages/page1/components/Row.vue |  4 +++-
 11 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterShardUpdate.ts b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterShardUpdate.ts
index 1eaa450928..0cf5bcd9fb 100644
--- a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterShardUpdate.ts
+++ b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterShardUpdate.ts
@@ -57,6 +57,7 @@ export async function generateRedisClusterShardUpdateCloneData(
       groupNum: currentClusterInfo.machine_pair_cnt,
       currentSpecId: currentClusterInfo.cluster_spec.spec_id,
       dbVersion: item.db_version,
+      disasterToleranceLevel: currentClusterInfo.disaster_tolerance_level,
       specConfig: {
         cpu: currentClusterInfo.cluster_spec.cpu,
         id: currentClusterInfo.cluster_spec.spec_id,
diff --git a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterTypeUpdate.ts b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterTypeUpdate.ts
index b50d95c8a9..b1b287e808 100644
--- a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterTypeUpdate.ts
+++ b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/clusterTypeUpdate.ts
@@ -56,6 +56,7 @@ export async function generateRedisClusterTypeUpdateCloneData(ticketData: Ticket
       groupNum: currentClusterInfo.machine_pair_cnt,
       clusterTypeName: currentClusterInfo.cluster_type_name,
       currentSpecId: currentClusterInfo.cluster_spec.spec_id,
+      disasterToleranceLevel: currentClusterInfo.disaster_tolerance_level,
       dbVersion: item.db_version,
       specConfig: {
         cpu: currentClusterInfo.cluster_spec.cpu,
diff --git a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/scaleUpdown.ts b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/scaleUpdown.ts
index c1af5097f2..6e5951e5db 100644
--- a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/scaleUpdown.ts
+++ b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/redis/scaleUpdown.ts
@@ -44,6 +44,7 @@ export async function generateRedisScaleUpdownCloneData(ticketData: TicketModel<
     bkCloudId: item.bk_cloud_id,
     clusterTypeName: clusterListMap[item.cluster_id].cluster_type_name,
     clusterStats: clusterListMap[item.cluster_id].cluster_stats,
+    disasterToleranceLevel: clusterListMap[item.cluster_id].disaster_tolerance_level,
     shardNum: clusterListMap[item.cluster_id].cluster_shard_num,
     groupNum: clusterListMap[item.cluster_id].machine_pair_cnt,
     version: item.db_version,
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/Index.vue
index 9707269f15..74e3326dd3 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/Index.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/Index.vue
@@ -145,6 +145,7 @@
     bkCloudId: data.bk_cloud_id,
     clusterTypeName: data.cluster_type_name,
     clusterStats: data.cluster_stats,
+    disasterToleranceLevel: data.disaster_tolerance_level,
     shardNum: data.cluster_shard_num,
     groupNum: data.machine_pair_cnt,
     machineCount: data.redis_master.length,
@@ -223,7 +224,6 @@
           infos,
         },
       };
-
       await createTicket(params).then((data) => {
         window.changeConfirm = false;
         router.push({
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/ClusterDeployPlan.vue b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/ClusterDeployPlan.vue
index e950193eb0..2db04c84e8 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/ClusterDeployPlan.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/ClusterDeployPlan.vue
@@ -85,7 +85,7 @@
               <span
                 v-else
                 style="color: #c4c6cc">
-                {{ t('--') }}
+                --
               </span>
             </div>
           </div>
@@ -110,7 +110,7 @@
               <span
                 v-else
                 style="color: #c4c6cc">
-                {{ t('--') }}
+                --
               </span>
             </div>
           </div>
@@ -135,7 +135,7 @@
               <span
                 v-else
                 style="color: #c4c6cc">
-                {{ t('--') }}
+                --
               </span>
             </div>
           </div>
@@ -160,7 +160,7 @@
               <span
                 v-else
                 style="color: #c4c6cc">
-                {{ t('--') }}
+                --
               </span>
             </div>
           </div>
@@ -176,7 +176,7 @@
               <span
                 v-else
                 style="color: #c4c6cc">
-                {{ t('--') }}
+                --
               </span>
             </div>
           </div>
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/RenderTargetCapacity.vue b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/RenderTargetCapacity.vue
index aeb9f4ab5a..26692cc5a1 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/RenderTargetCapacity.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/RenderTargetCapacity.vue
@@ -243,7 +243,7 @@
           backend_group: {
             spec_id: localValue.spec_id,
             count: targetObj.value!.requireMachineGroupNum, // 机器实际需要申请的组数
-            affinity: AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
+            affinity: props.rowData?.disasterToleranceLevel || AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
           },
         },
       });
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/Row.vue
index 31c188be06..4f4a653e22 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/Row.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/capacity-change/pages/page1/components/Row.vue
@@ -89,6 +89,7 @@
     bkCloudId: number;
     clusterTypeName: string;
     clusterStats: RedisModel['cluster_stats'];
+    disasterToleranceLevel: string;
     shardNum?: number;
     groupNum?: number;
     currentSepc?: string;
@@ -134,6 +135,7 @@
     bkCloudId: 0,
     clusterTypeName: '',
     clusterStats: {} as IDataRow['clusterStats'],
+    disasterToleranceLevel: '',
   });
 
   interface Props {
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/Index.vue
index b157f05b46..5ea7b0ce27 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/Index.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/Index.vue
@@ -259,6 +259,7 @@
       clusterTypeName: item.cluster_type_name,
       currentSpecId: item.cluster_spec.spec_id,
       dbVersion: item.major_version,
+      disasterToleranceLevel: item.disaster_tolerance_level,
       specConfig: {
         cpu: item.cluster_spec.cpu,
         id: item.cluster_spec.spec_id,
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/components/Row.vue
index 1a590fc244..54903d4b5f 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/components/Row.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/cluster-shard-update/pages/page1/components/Row.vue
@@ -86,6 +86,7 @@
     currentSpecId: number;
     clusterTypeName: string;
     dbVersion: string;
+    disasterToleranceLevel: string;
     specConfig: {
       cpu: {
         max: number;
@@ -157,6 +158,7 @@
     groupNum: 0,
     currentSpecId: 0,
     dbVersion: '',
+    disasterToleranceLevel: '',
     specConfig: {
       cpu: {
         max: 0,
@@ -254,12 +256,12 @@
               proxy: {
                 spec_id: props.data.proxy.id,
                 count: props.data.proxy.count,
-                affinity: AffinityType.CROS_SUBZONE,
+                affinity: props.data.disasterToleranceLevel || AffinityType.CROS_SUBZONE,
               },
               backend_group: {
                 spec_id: deployData.spec_id,
                 count: deployData.count, // 机器组数
-                affinity: AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
+                affinity: props.data.disasterToleranceLevel || AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
               },
             },
           };
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/Index.vue
index ba4d440c3b..3abbbab9aa 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/Index.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/Index.vue
@@ -155,7 +155,6 @@
     type: TicketTypes.REDIS_CLUSTER_TYPE_UPDATE,
     onSuccess(cloneData) {
       const { tableList, type, frequency } = cloneData;
-
       tableData.value = tableList;
       repairAndVerifyType.value = type;
       repairAndVerifyFrequency.value = frequency;
@@ -258,6 +257,7 @@
     clusterType: item.cluster_type,
     machineType: item.cluster_spec.spec_machine_type,
     currentShardNum: item.cluster_shard_num,
+    disasterToleranceLevel: item.disaster_tolerance_level,
     groupNum: item.machine_pair_cnt,
     dbVersion: item.major_version,
     specConfig: {
diff --git a/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/components/Row.vue
index 50f50ebf50..21692b25ed 100644
--- a/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/components/Row.vue
+++ b/dbm-ui/frontend/src/views/db-manage/redis/cluster-type-update/pages/page1/components/Row.vue
@@ -106,6 +106,7 @@
     currentShardNum: number;
     groupNum: number;
     clusterTypeName: string;
+    disasterToleranceLevel: string;
     specConfig: {
       cpu: {
         max: number;
@@ -181,6 +182,7 @@
     groupNum: 0,
     clusterTypeName: '',
     currentSepc: '',
+    disasterToleranceLevel: '',
     specConfig: {
       cpu: {
         max: 0,
@@ -313,7 +315,7 @@
             backend_group: {
               spec_id: deployData.spec_id,
               count: deployData.count, // 机器组数
-              affinity: AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
+              affinity: props.data.disasterToleranceLevel || AffinityType.CROS_SUBZONE, // 暂时固定 'CROS_SUBZONE',
             },
           },
         };