Skip to content

Commit

Permalink
fix(frontend): mongodb副本集部署信息修改及实例分页问题修复 TencentBlueKing#3356
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves authored and iSecloud committed Feb 27, 2024
1 parent 60a2ab8 commit 2a92d5a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 32 deletions.
12 changes: 11 additions & 1 deletion dbm-ui/frontend/src/components/apply-items/AffinityItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
import { useSystemEnviron } from '@stores';
interface Props {
defaultValue?: string
}
const props = defineProps<Props>();
const modelValue = defineModel<string>({
default: '',
});
Expand All @@ -48,7 +53,12 @@
watch(() => affinityList, (list) => {
if (list && list.length > 0) {
modelValue.value = list[0].value;
if (props.defaultValue) {
const index = list.findIndex(affinityItem => affinityItem.value === props.defaultValue);
modelValue.value = index > -1 ? props.defaultValue : list[0].value;
} else {
modelValue.value = list[0].value;
}
}
}, {
immediate: true,
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2626,8 +2626,8 @@
"降低": "降低",
"格式为:(库名).(名称)_如 admin.linda": "格式为:(库名).(名称),如 admin.linda",
"由 1~32 位字母、数字、下划线(_)、点(.)、减号(-)字符组成以字母或数字开头": "由 1~32 位字母、数字、下划线(_)、点(.)、减号(-)字符组成以字母或数字开头",
"Mongo复制": "Mongo 复制",
"Mongo分片": "Mongo 分片",
"Mongo副本集": "Mongo 副本集",
"Mongo分片集": "Mongo 分片集",
"需要n台": "需要 {n} 台",
"Shard数量": "Shard数量",
"所需机组数": "所需机组数",
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/views/db-configure/components/TopTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@
{
moduleId: 'mongodb',
id: ClusterTypes.MONGO_REPLICA_SET,
name: t('Mongo复制'),
name: t('Mongo副本集'),
},
{
moduleId: 'mongodb',
id: ClusterTypes.MONGO_SHARED_CLUSTER,
name: t('Mongo分片'),
name: t('Mongo分片集'),
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
ref="tableRef"
:columns="columns"
:data-source="getMongoInstancesList"
:is-anomalies="isAnomalies"
:pagination="renderPagination"
:pagination-extra="{ small: false }"
:row-class="setRowClass"
selectable
:settings="settings"
Expand All @@ -65,8 +62,6 @@
import { createTicket } from '@services/source/ticket';
import {
type IPagination,
useDefaultPagination,
useStretchLayout,
useTableSettings,
useTicketMessage,
Expand Down Expand Up @@ -123,7 +118,6 @@
} = useStretchLayout();
const tableRef = ref();
const isAnomalies = ref(false);
const isInstanceDropdown = ref(false);
const roleListType = ref<{
Expand All @@ -133,7 +127,6 @@
const searchValues = ref([]);
const selected = ref<MongodbInstanceModel[]>([]);
const pagination = ref<IPagination>(useDefaultPagination());
const hasSelected = computed(() => selected.value.length > 0);
const selectedIds = computed(() => selected.value.map(item => item.bk_host_id));
Expand Down Expand Up @@ -268,21 +261,6 @@
return list;
});
const renderPagination = computed(() => {
if (pagination.value.count < 10) {
return false;
}
if (!isStretchLayoutOpen.value) {
return { ...pagination.value };
}
return {
...pagination.value,
small: true,
align: 'left',
layout: ['total', 'limit', 'list'],
};
});
const searchData = computed(() => [
{
name: '实例',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
ref="regionItemRef"
v-model="formData.details.city_code" />
<DbCard :title="t('数据库部署信息')">
<AffinityItem v-model="formData.details.disaster_tolerance_level" />
<AffinityItem
v-model="formData.details.disaster_tolerance_level"
default-value="SAME_SUBZONE_CROSS_SWTICH" />
<BkFormItem
:label="t('MongoDB版本')"
property="details.db_version"
Expand All @@ -58,7 +60,8 @@
<BkInput
v-model="formData.details.start_port"
clearable
:min="1"
:max="28999"
:min="27000"
show-clear-only-hover
style="width: 185px;"
type="number" />
Expand Down Expand Up @@ -236,7 +239,7 @@
domain: string,
name: string,
}>,
start_port: 25501,
start_port: 27001,
node_count: 3,
replica_count: 1,
node_replica_count: 1,
Expand Down
4 changes: 2 additions & 2 deletions dbm-ui/frontend/src/views/resource-manage/spec/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
},
{
moduleId: 'mongodb',
label: t('Mongo复制'),
label: t('Mongo副本集'),
name: ClusterTypes.MONGO_REPLICA_SET,
children: [
{
Expand All @@ -263,7 +263,7 @@
},
{
moduleId: 'mongodb',
label: t('Mongo分片'),
label: t('Mongo分片集'),
name: ClusterTypes.MONGO_SHARED_CLUSTER,
children: [
{
Expand Down

0 comments on commit 2a92d5a

Please sign in to comment.