Skip to content

Commit

Permalink
fix(frontend): sqlserver资源规格问题修复 TencentBlueKing#8959
Browse files Browse the repository at this point in the history
  • Loading branch information
jinquantianxia authored and hLinx committed Jan 10, 2025
1 parent d90b8cb commit 98465aa
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 11 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1656,5 +1656,6 @@
"sqlserver单节点版": "",
"sqlserver主从版": "",
"排除业务": "",
"该规格已被使用,不允许修改": "",
"这行勿动!新增翻译请在上一行添加!": ""
}
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3928,5 +3928,6 @@
"排除业务": "排除业务",
"1. 群聊添加群机器人: 蓝鲸监控(上云)": "1. 群聊添加群机器人: 蓝鲸监控(上云)",
"2. 手动蓝鲸监控(上云) 并输入关键字n": "2. 手动 {'@'}蓝鲸监控(上云) 并输入关键字 {n}",
"该规格已被使用,不允许修改": "该规格已被使用,不允许修改",
"这行勿动!新增翻译请在上一行添加!": ""
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@
`${DBTypes.ES}_es_client`,
`${DBTypes.PULSAR}_pulsar_broker`,
`${DBTypes.TENDBCLUSTER}_proxy`,
`${DBTypes.SQLSERVER}_sqlserver`,
];

const isRequired = !notRequiredStorageList.includes(`${props.dbType}_${props.machineType}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<template #trigger>
<div
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
class="operation-more-main">
Expand Down Expand Up @@ -54,7 +54,9 @@
v-if="currentType === 'device_class'"
ref="specDeviceRef"
v-model="deviceClassModelValue"
:is-edit="isEdit" />
:cpu="cpuModelValue"
:is-edit="isEdit"
:mem="memModelValue" />
<div
v-else
class="cpu-mem-main">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
required>
<span
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
class="inline-block">
Expand All @@ -40,7 +40,7 @@
required>
<span
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
class="inline-block">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@

interface Props {
isEdit: boolean;
cpu: {
min: number | string;
max: number | string;
};
mem: {
min: number | string;
max: number | string;
};
}

interface Exposes {
Expand Down Expand Up @@ -194,6 +202,19 @@
},
});

watch(
() => [props.cpu, props.mem],
() => {
if (typeof props.cpu.max !== 'string') {
selectedCpuMem.cpu = props.cpu as DeviceClassCpuMemType['cpu'];
selectedCpuMem.mem = props.mem as DeviceClassCpuMemType['mem'];
}
},
{
immediate: true,
},
);

watch(
() => modelValue.value,
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
required>
<span
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
class="inline-block">
Expand All @@ -41,7 +41,7 @@
required>
<span
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
class="inline-block">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<div class="spec-form-item-content">
<BkButton
v-if="tableData.length === 0"
v-bk-tooltips="{
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
:disabled="isEdit"
@click="handleAddFirstRow">
<DbIcon type="add" />
<span style="font-size: 12px">{{ t('添加') }}</span>
Expand Down Expand Up @@ -83,7 +88,7 @@
const { t } = useI18n();

const rowRefs = ref();
const tableData = ref<IDataRow[]>([createRowData()]);
const tableData = ref<IDataRow[]>([]);
const diskTypeList = ref<{ label: string; value: string }[]>([]);

const mountPointList = computed(() => tableData.value.map((item) => item.mount_point));
Expand Down Expand Up @@ -132,7 +137,7 @@
};

defineExpose<Exposes>({
getValue: () => Promise.all(rowRefs.value.map((item: any) => item.getValue())),
getValue: () => Promise.all(rowRefs.value ? rowRefs.value.map((item: any) => item.getValue()) : []),
});
</script>
<style lang="less" scoped>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ref="mountPointRef"
v-model="localValue.mount_point"
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit && !localValue.isSystemDrive,
}"
:disabled="isEdit || localValue.isSystemDrive"
Expand All @@ -30,7 +30,7 @@
ref="minCapacityRef"
v-model="localValue.size"
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !isEdit,
}"
:disabled="isEdit"
Expand All @@ -44,7 +44,7 @@
ref="diskTypeRef"
v-model="localValue.type"
v-bk-tooltips="{
content: t('不支持修改'),
content: t('该规格已被使用,不允许修改'),
disabled: !props.isEdit,
}"
:disabled="isEdit"
Expand Down

0 comments on commit 98465aa

Please sign in to comment.