Skip to content

Commit 7292e0f

Browse files
committed
feat(frontend): 工具箱支持资源池协议变更_mysql添加从库、添加proxy、迁移主从 #8076
1 parent 982bdd6 commit 7292e0f

File tree

22 files changed

+1370
-113
lines changed

22 files changed

+1370
-113
lines changed

dbm-ui/frontend/src/components/editable-table/edit/Block.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
5858
const contentRef = useTemplateRef('content');
5959
60-
const isShowPlacehoder = ref(false);
60+
const isShowPlacehoder = ref(true);
6161
6262
watch(modelValue, () => {
6363
columnContext?.validate('change');

dbm-ui/frontend/src/components/editable-table/edit/Input.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,19 @@
3030
3131
const props = defineProps<Props>();
3232
const emits = defineEmits<Emits>();
33+
const modelValue = defineModel<string>();
3334
3435
const attrs = useAttrs();
35-
3636
const columnContext = useColumn();
3737
38-
const modelValue = defineModel<string>();
39-
4038
watch(modelValue, () => {
4139
columnContext?.validate('change');
4240
});
4341
4442
const handleChange = (value: string) => {
4543
emits('change', value);
4644
};
45+
4746
const handleBlur = () => {
4847
columnContext?.blur();
4948
columnContext?.validate('blur');

dbm-ui/frontend/src/components/resource-host-selector/Index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<HostAgentStatus :data="data.agent_status" />
5252
</template>
5353
</BkTableColumn>
54-
<BkTableColumn
54+
<!-- <BkTableColumn
5555
field="bk_cpu"
5656
:label="t('资源归属')"
5757
:min-width="300">
@@ -60,7 +60,7 @@
6060
v-if="false"
6161
:data="data" />
6262
</template>
63-
</BkTableColumn>
63+
</BkTableColumn> -->
6464
<BkTableColumn
6565
field="rack_id"
6666
:label="t('机架')"
@@ -159,8 +159,8 @@
159159
160160
import DiskPopInfo from '@components/disk-pop-info/DiskPopInfo.vue';
161161
import HostAgentStatus from '@components/host-agent-status/Index.vue';
162-
import ResourceHostOwner from '@components/resource-host-owner/Index.vue';
163162
163+
// import ResourceHostOwner from '@components/resource-host-owner/Index.vue';
164164
import PanelTab from './components/PanelTab.vue';
165165
import useSearchSelectData from './hooks/use-search-select-data';
166166
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<template>
2+
<BkFormItem :label="t('备注')">
3+
<BkInput
4+
v-model="modelValue"
5+
:maxlength="500"
6+
:placeholder="t('请提供更多有用信息申请信息_以获得更快审批')"
7+
style="width: 700px"
8+
type="textarea" />
9+
</BkFormItem>
10+
</template>
11+
12+
<script setup lang="ts">
13+
import { useI18n } from 'vue-i18n';
14+
15+
const { t } = useI18n();
16+
17+
const modelValue = defineModel<string>();
18+
</script>

dbm-ui/frontend/src/hooks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export * from './useApplyBase';
1515
export * from './useBeforeClose';
1616
export * from './useCopy';
1717
export * from './useCopyFromSelection';
18+
export * from './useCreateTicket';
1819
export * from './useDebouncedRef';
1920
export * from './useDebouncedRef';
2021
export * from './useDefaultPagination';
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { createTicket } from '@services/source/ticket';
2+
3+
import type { TicketTypes } from '@common/const';
4+
5+
export function useCreateTicket<T>(ticketType: TicketTypes) {
6+
const loading = ref(false);
7+
const router = useRouter();
8+
9+
const run = async (details: T, remark = '') => {
10+
loading.value = true;
11+
const { id } = await createTicket<T>({
12+
ticket_type: ticketType,
13+
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
14+
details,
15+
remark,
16+
ignore_duplication: true,
17+
});
18+
loading.value = false;
19+
router.push({
20+
name: ticketType,
21+
params: {
22+
page: 'success',
23+
},
24+
query: {
25+
ticketId: id,
26+
},
27+
});
28+
};
29+
30+
return {
31+
run,
32+
loading,
33+
};
34+
}

dbm-ui/frontend/src/hooks/useCreateTicket.tsx

Lines changed: 0 additions & 75 deletions
This file was deleted.

dbm-ui/frontend/src/locales/zh-cn.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3923,6 +3923,11 @@
39233923
"所有 IP": "所有 IP",
39243924
"已选 IP": "已选 IP",
39253925
"业务资源池": "业务资源池",
3926-
"冷/热节点": "冷/热节点",
3926+
"集群域名格式不正确": "集群域名格式不正确",
3927+
"xx任务提交成功": "{name}任务提交成功",
3928+
"xx执行": "{name}执行",
3929+
"含n个同机关联集群": "含 {n} 个同机关联集群",
3930+
"新 Slave": "新 Slave",
3931+
"目标集群是集群target的关联集群_请勿重复添加": "目标集群是集群 {target} 的关联集群,请勿重复添加",
39273932
"这行勿动!新增翻译请在上一行添加!": ""
39283933
}

dbm-ui/frontend/src/services/source/dbbase.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ export function verifyDuplicatedClusterName(params: { cluster_type: string; name
3131
*/
3232
export function filterClusters<
3333
T extends {
34+
id: number;
3435
bk_biz_id: number;
3536
bk_cloud_id: number;
3637
bk_cloud_name: string;
3738
cluster_name: string;
3839
cluster_type: string;
3940
major_version: string;
41+
master_domain: string;
4042
},
4143
>(params: { bk_biz_id: number; exact_domain?: string; cluster_ids?: string; domain?: string }) {
4244
return http.get<T[]>(`${path}/filter_clusters/`, params);

dbm-ui/frontend/src/services/source/ticket.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ import type { FlowItem, FlowItemTodo } from '@services/types/ticket';
1919

2020
import { getRouter } from '@router/index';
2121

22+
import type { TicketTypes } from '@common/const';
23+
2224
import { messageError } from '@utils';
2325

2426
import { locale, t } from '@locales/index';
@@ -55,7 +57,13 @@ export function getTickets(params: {
5557
/**
5658
* 创建单据
5759
*/
58-
export function createTicket(formData: Record<string, any>) {
60+
export function createTicket<T>(formData: {
61+
bk_biz_id: number;
62+
details: T;
63+
ignore_duplication: boolean;
64+
remark: string;
65+
ticket_type: TicketTypes;
66+
}) {
5967
return http
6068
.post<{ id: number }>(`${path}/`, formData, { catchError: true })
6169
.then((res) => res)

0 commit comments

Comments
 (0)