Skip to content

Commit

Permalink
feat(frontend): 工具箱支持资源池协议变更_mysql添加从库、添加proxy、迁移主从 #8076
Browse files Browse the repository at this point in the history
  • Loading branch information
JustaCattt committed Dec 17, 2024
1 parent 982bdd6 commit e8c0873
Show file tree
Hide file tree
Showing 22 changed files with 1,372 additions and 113 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
const contentRef = useTemplateRef('content');
const isShowPlacehoder = ref(false);
const isShowPlacehoder = ref(true);
watch(modelValue, () => {
columnContext?.validate('change');
Expand Down
5 changes: 2 additions & 3 deletions dbm-ui/frontend/src/components/editable-table/edit/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,19 @@
const props = defineProps<Props>();
const emits = defineEmits<Emits>();
const modelValue = defineModel<string>();
const attrs = useAttrs();
const columnContext = useColumn();
const modelValue = defineModel<string>();
watch(modelValue, () => {
columnContext?.validate('change');
});
const handleChange = (value: string) => {
emits('change', value);
};
const handleBlur = () => {
columnContext?.blur();
columnContext?.validate('blur');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<HostAgentStatus :data="data.agent_status" />
</template>
</BkTableColumn>
<BkTableColumn
<!-- <BkTableColumn
field="bk_cpu"
:label="t('资源归属')"
:min-width="300">
Expand All @@ -60,7 +60,7 @@
v-if="false"
:data="data" />
</template>
</BkTableColumn>
</BkTableColumn> -->
<BkTableColumn
field="rack_id"
:label="t('机架')"
Expand Down Expand Up @@ -159,8 +159,8 @@
import DiskPopInfo from '@components/disk-pop-info/DiskPopInfo.vue';
import HostAgentStatus from '@components/host-agent-status/Index.vue';
import ResourceHostOwner from '@components/resource-host-owner/Index.vue';
// import ResourceHostOwner from '@components/resource-host-owner/Index.vue';
import PanelTab from './components/PanelTab.vue';
import useSearchSelectData from './hooks/use-search-select-data';
Expand Down
18 changes: 18 additions & 0 deletions dbm-ui/frontend/src/components/ticket-remark/TicketRemark.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<BkFormItem :label="t('备注')">
<BkInput
v-model="modelValue"
:maxlength="500"
:placeholder="t('请提供更多有用信息申请信息_以获得更快审批')"
style="width: 700px"
type="textarea" />
</BkFormItem>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const modelValue = defineModel<string>();
</script>
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from './useApplyBase';
export * from './useBeforeClose';
export * from './useCopy';
export * from './useCopyFromSelection';
export * from './useCreateTicket';
export * from './useDebouncedRef';
export * from './useDebouncedRef';
export * from './useDefaultPagination';
Expand Down
34 changes: 34 additions & 0 deletions dbm-ui/frontend/src/hooks/useCreateTicket.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { createTicket } from '@services/source/ticket';

import type { TicketTypes } from '@common/const';

export function useCreateTicket<T>(ticketType: TicketTypes) {
const loading = ref(false);
const router = useRouter();

const run = async (details: T, remark = '') => {
loading.value = true;
const { id } = await createTicket<T>({
ticket_type: ticketType,
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
details,
remark,
ignore_duplication: true,
});
loading.value = false;
router.push({
name: ticketType,
params: {
page: 'success',
},
query: {
ticketId: id,
},
});
};

return {
run,
loading,
};
}
75 changes: 0 additions & 75 deletions dbm-ui/frontend/src/hooks/useCreateTicket.tsx

This file was deleted.

7 changes: 6 additions & 1 deletion dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3923,6 +3923,11 @@
"所有 IP": "所有 IP",
"已选 IP": "已选 IP",
"业务资源池": "业务资源池",
"冷/热节点": "冷/热节点",
"集群域名格式不正确": "集群域名格式不正确",
"xx任务提交成功": "{name}任务提交成功",
"xx执行": "{name}执行",
"含n个同机关联集群": "含 {n} 个同机关联集群",
"新 Slave": "新 Slave",
"目标集群是集群target的关联集群_请勿重复添加": "目标集群是集群 {target} 的关联集群,请勿重复添加",
"这行勿动!新增翻译请在上一行添加!": ""
}
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/services/source/dbbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ export function verifyDuplicatedClusterName(params: { cluster_type: string; name
*/
export function filterClusters<
T extends {
id: number;
bk_biz_id: number;
bk_cloud_id: number;
bk_cloud_name: string;
cluster_name: string;
cluster_type: string;
major_version: string;
master_domain: string;
},
>(params: { bk_biz_id: number; exact_domain?: string; cluster_ids?: string; domain?: string }) {
return http.get<T[]>(`${path}/filter_clusters/`, params);
Expand Down
10 changes: 9 additions & 1 deletion dbm-ui/frontend/src/services/source/ticket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import type { FlowItem, FlowItemTodo } from '@services/types/ticket';

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

import type { TicketTypes } from '@common/const';

import { messageError } from '@utils';

import { locale, t } from '@locales/index';
Expand Down Expand Up @@ -55,7 +57,13 @@ export function getTickets(params: {
/**
* 创建单据
*/
export function createTicket(formData: Record<string, any>) {
export function createTicket<T>(formData: {
bk_biz_id: number;
details: T;
ignore_duplication: boolean;
remark: string;
ticket_type: TicketTypes;
}) {
return http
.post<{ id: number }>(`${path}/`, formData, { catchError: true })
.then((res) => res)
Expand Down
Loading

0 comments on commit e8c0873

Please sign in to comment.