Skip to content

Commit

Permalink
feat(frontend): 工具箱支持资源池协议变更_mysql添加proxy TencentBlueKing#8076
Browse files Browse the repository at this point in the history
  • Loading branch information
JustaCattt committed Dec 16, 2024
1 parent 8a0fef4 commit 244b29e
Show file tree
Hide file tree
Showing 17 changed files with 762 additions and 95 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,14 +51,14 @@
<HostAgentStatus :data="data.agent_status" />
</template>
</BkTableColumn>
<BkTableColumn
<!-- <BkTableColumn
field="bk_cpu"
:label="t('资源归属')"
:min-width="300">
<template #default="{ data }">
<ResourceHostOwner :data="data" />
</template>
</BkTableColumn>
</BkTableColumn> -->
<BkTableColumn
field="rack_id"
:label="t('机架')"
Expand Down Expand Up @@ -157,8 +157,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 All @@ -176,7 +176,7 @@
(e: 'change', value: IValue[]): void;
}
interface IValue {
export interface IValue {
bk_biz_id: number;
bk_cloud_id: number;
bk_host_id: number;
Expand Down
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.

4 changes: 4 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3739,5 +3739,9 @@
"已选 IP": "已选 IP",
"业务资源池": "业务资源池",
"冷/热节点": "冷/热节点",
"集群域名格式不正确": "集群域名格式不正确",
"xx任务提交成功": "{name}任务提交成功",
"xx执行": "{name}执行",
"含n个同机关联集群": "含 {n} 个同机关联集群",
"这行勿动!新增翻译请在上一行添加!": ""
}
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 }) {
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 @@ -53,7 +55,13 @@ export function getTickets(
/**
* 创建单据
*/
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
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/types/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ declare global {
// for type re-export
declare global {
// @ts-ignore
export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
import('vue')
}
Loading

0 comments on commit 244b29e

Please sign in to comment.