From c9653db242b04d8d6107a492b054c6bd7d4be2a6 Mon Sep 17 00:00:00 2001 From: 3octaves <873551943@qq.com> Date: Mon, 4 Nov 2024 16:04:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20redis=E6=9C=BA=E5=99=A8?= =?UTF-8?q?=E9=83=A8=E7=BD=B2=E9=97=AE=E9=A2=98=20#7740?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/db-manage/redis/apply/ApplyRedis.vue | 7 ++++++- .../redis/apply/components/backend-spec/Index.vue | 6 +++--- .../backend-spec/components/CustomSchema.vue | 12 +++++++++++- .../redis/common/cluster-deploy-plan/Index.vue | 6 +++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/dbm-ui/frontend/src/views/db-manage/redis/apply/ApplyRedis.vue b/dbm-ui/frontend/src/views/db-manage/redis/apply/ApplyRedis.vue index 0acd4fff2d..b06f4a0dbe 100644 --- a/dbm-ui/frontend/src/views/db-manage/redis/apply/ApplyRedis.vue +++ b/dbm-ui/frontend/src/views/db-manage/redis/apply/ApplyRedis.vue @@ -629,11 +629,16 @@ }; const handleChangeClusterType = () => { + const count = [ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER, ClusterTypes.PREDIXY_REDIS_CLUSTER].includes( + state.formdata.details.cluster_type, + ) + ? 3 + : 1; state.formdata.details.db_version = ''; state.formdata.details.resource_spec.proxy.spec_id = ''; state.formdata.details.resource_spec.backend_group = { ...state.formdata.details.resource_spec.backend_group, - count: 1, + count, spec_id: '', capacity: '', future_capacity: '', diff --git a/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/Index.vue b/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/Index.vue index 294ea6294d..9877b77e58 100644 --- a/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/Index.vue @@ -110,9 +110,9 @@ const specs = shallowRef([]); const countMap = shallowRef({} as Record) - const isTendisCache = computed(() => props.clusterType === ClusterTypes.TWEMPROXY_REDIS_INSTANCE); - const targetCapacityTitle = computed(() => (isTendisCache.value ? t('集群容量需求(内存容量)') : t('集群容量需求(磁盘容量)'))); - const futureCapacityTitle = computed(() => (isTendisCache.value ? t('未来集群容量需求(内存容量)') : t('未来集群容量需求(磁盘容量)'))); + const isMemoryType = computed(() => [ClusterTypes.TWEMPROXY_REDIS_INSTANCE, ClusterTypes.PREDIXY_REDIS_CLUSTER].includes(props.clusterType as ClusterTypes)); + const targetCapacityTitle = computed(() => (isMemoryType.value ? t('集群容量需求(内存容量)') : t('集群容量需求(磁盘容量)'))); + const futureCapacityTitle = computed(() => (isMemoryType.value ? t('未来集群容量需求(内存容量)') : t('未来集群容量需求(磁盘容量)'))); const columns = [ { diff --git a/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/components/CustomSchema.vue b/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/components/CustomSchema.vue index dbf85f3450..1f5426195e 100644 --- a/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/components/CustomSchema.vue +++ b/dbm-ui/frontend/src/views/db-manage/redis/apply/components/backend-spec/components/CustomSchema.vue @@ -20,7 +20,7 @@ @@ -103,6 +103,16 @@ const specSelectorRef = ref>(); const shardNum = ref(1); + const countMin = computed(() => { + if ( + [ClusterTypes.PREDIXY_TENDISPLUS_CLUSTER, ClusterTypes.PREDIXY_REDIS_CLUSTER].includes( + props.clusterType as ClusterTypes, + ) + ) { + return 3; + } + return 1; + }); const clusterShardNum = computed(() => modelValue.value.count * shardNum.value || ''); const totalCapcity = computed(() => { diff --git a/dbm-ui/frontend/src/views/db-manage/redis/common/cluster-deploy-plan/Index.vue b/dbm-ui/frontend/src/views/db-manage/redis/common/cluster-deploy-plan/Index.vue index 2f672bb5b3..c4b0e05c91 100644 --- a/dbm-ui/frontend/src/views/db-manage/redis/common/cluster-deploy-plan/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/redis/common/cluster-deploy-plan/Index.vue @@ -307,9 +307,9 @@ } return true }); - const isTendisCache = computed(() => props.data.clusterType === ClusterTypes.TWEMPROXY_REDIS_INSTANCE); - const targetCapacityTitle = computed(() => (isTendisCache.value ? t('目标集群容量需求(内存容量)') : t('目标集群容量需求(磁盘容量)'))); - const futureCapacityTitle = computed(() => (isTendisCache.value ? t('未来集群容量需求(内存容量)') : t('未来集群容量需求(磁盘容量)'))); + const isMemoryType = computed(() => [ClusterTypes.TWEMPROXY_REDIS_INSTANCE, ClusterTypes.PREDIXY_REDIS_CLUSTER].includes(props.data.clusterType)); + const targetCapacityTitle = computed(() => (isMemoryType.value ? t('目标集群容量需求(内存容量)') : t('目标集群容量需求(磁盘容量)'))); + const futureCapacityTitle = computed(() => (isMemoryType.value ? t('未来集群容量需求(内存容量)') : t('未来集群容量需求(磁盘容量)'))); const currentSpec = computed(() => { if (props?.data) {