Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
707eedf
feat(frontend): 工具箱支持资源池协议变更_mysql添加从库、添加proxy、迁移主从 #8076
JustaCattt Dec 10, 2024
9b72d81
feat(frontend): 工具箱支持资源池协议变更_mysql替换proxy #8076
JustaCattt Dec 19, 2024
5d465b2
feat(frontend): 工具箱支持资源池协议变更_tendbcluster添加运维节点 #8076
JustaCattt Dec 20, 2024
8ebef76
feat(frontend): 工具箱支持资源池协议变更_tendbcluster迁移主从 #8076
JustaCattt Dec 23, 2024
cec8cd0
feat(frontend): 工具箱支持资源池协议变更_tendbcluster下架运维节点 #8076
JustaCattt Dec 23, 2024
a177f5b
feat(frontend): 工具箱支持资源池协议变更_mysql/tendbcluster/sqlserver重建从库、sqlserv…
JustaCattt Dec 25, 2024
d3ed9ee
feat(frontend): 工具箱支持资源池协议变更_tendbcluster缩容接入层 #8076
JustaCattt Dec 25, 2024
eb05a4e
feat(frontend): 工具箱支持资源池协议变更_大数据缩容 #8076
JustaCattt Dec 26, 2024
1534c12
feat(frontend): 工具箱支持资源池协议变更_redis缩容接入层 #8076
JustaCattt Dec 26, 2024
c2a6e8e
feat(frontend): 工具箱支持资源池协议变更_redis集群容量变更 #8076
JustaCattt Dec 27, 2024
f2c5b18
feat(frontend): 工具箱支持资源池协议变更_默认远程备份 #8076
JustaCattt Dec 27, 2024
4923e73
feat(frontend): 工具箱支持资源池协议变更_redis整机替换 #8076
JustaCattt Dec 30, 2024
efac488
feat(frontend): 工具箱支持资源池协议变更_mysql迁移主从拆分为集群迁移、整机迁移 #8076
JustaCattt Dec 31, 2024
84922c9
feat(frontend): 工具箱支持资源池协议变更_codereview #8076
JustaCattt Jan 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion dbm-ui/frontend/src/components/editable-table/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import Input from './edit/Input.vue';
import Select from './edit/Select.vue';
import TagInput from './edit/TagInput.vue';
import Text from './edit/Text.vue';
import Textarea from './edit/Textarea.vue';
import TimePicker from './edit/TimePicker.vue';
import useResize from './hooks/use-resize';
Expand Down Expand Up @@ -112,7 +113,7 @@
} & Expose
> = Symbol.for('bk-editable-table');

export { Block, Column, DatePicker, Input, Row, Select, TagInput, Textarea, TimePicker, useColumn, useTable };
export { Block, Column, DatePicker, Input, Row, Select, TagInput, Text, Textarea, TimePicker, useColumn, useTable };
</script>
<script setup lang="ts">
const props = defineProps<Props>();
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,28 @@
}

const props = defineProps<Props>();

const emits = defineEmits<Emits>();

const modelValue = defineModel<string>();

const slots = defineSlots<{
prepend?: () => VNode;
default?: () => VNode;
append?: () => VNode;
}>();

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
27 changes: 26 additions & 1 deletion dbm-ui/frontend/src/components/editable-table/edit/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,23 @@
class="bk-editable-select"
v-bind="{ ...attrs, ...props }"
@blur="handleBlur"
@change="handleChange"
@focus="handleFocus">
<slot />
<template
v-if="slots.option"
#optionRender="{ item, index }">
<slot
:index="index"
:item="item"
name="option" />
</template>
<template
v-if="slots.trigger"
#trigger="{ selected }">
<slot
name="trigger"
:selected="selected" />
</template>
</BkSelect>
</template>
<script lang="ts">
Expand All @@ -25,12 +40,18 @@
import useColumn from '../useColumn';

const props = defineProps<Props>();

const emits = defineEmits<{
(e: 'blur'): void;
(e: 'focus'): void;
(e: 'change', value: T): void;
}>();

const slots = defineSlots<{
trigger?: (value: { selected: any[] }) => VNode;
option?: (value: { item: Record<string, any>; index: number }) => VNode;
}>();

const attrs = useAttrs();

const columnContext = useColumn();
Expand All @@ -41,6 +62,10 @@
columnContext?.validate('change');
});

const handleChange = (value: T) => {
emits('change', value);
};

const handleBlur = () => {
columnContext?.blur();
columnContext?.validate('blur');
Expand Down
10 changes: 6 additions & 4 deletions dbm-ui/frontend/src/components/editable-table/edit/Text.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</div>
</template>
<script setup lang="ts">
import { onBeforeUpdate, ref, useTemplateRef, type VNode, watch } from 'vue';
import { ref, useTemplateRef, type VNode, watch } from 'vue';

import useColumn from '../useColumn';

Expand All @@ -57,7 +57,7 @@

const contentRef = useTemplateRef('content');

const isShowPlacehoder = ref(false);
const isShowPlacehoder = ref(true);

watch(modelValue, () => {
columnContext?.validate();
Expand All @@ -71,8 +71,10 @@
columnContext?.focus();
};

onBeforeUpdate(() => {
isShowPlacehoder.value = !contentRef.value?.innerText;
onUpdated(() => {
nextTick(() => {
isShowPlacehoder.value = !contentRef.value?.innerText;
});
});
</script>
<style lang="less">
Expand Down
16 changes: 11 additions & 5 deletions dbm-ui/frontend/src/components/instance-selector/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
import type { InjectionKey, Ref } from 'vue';

import TendbclusterMachineModel from '@services/model/tendbcluster/tendbcluster-machine';
import type { ListBase } from '@services/types';
import type { HostInfo, ListBase } from '@services/types';

import { t } from '@locales/index';

Expand All @@ -113,7 +113,7 @@
create_at: string;
db_module_id: number;
db_module_name: string;
host_info: any;
host_info: HostInfo;
id: number;
name: string;
instance_address: string;
Expand Down Expand Up @@ -999,9 +999,6 @@
isInnerChange = false;
return;
}
if (props.selected) {
Object.assign(lastValues, props.selected);
}
if (
props.clusterTypes.length > 0 &&
(!panelTabActive.value || !props.clusterTypes.includes(panelTabActive.value as Props['clusterTypes'][number]))
Expand All @@ -1015,6 +1012,15 @@
},
);

watch(
() => props.selected,
() => {
if (props.selected) {
Object.assign(lastValues, props.selected);
}
},
);

const handleChangePanel = (obj: PanelListItem) => {
activePanelObj.value = obj;
if (props.onlyOneType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
<div class="item-title">CPU:</div>
<div class="item-content">
{{
data.cpu.min === data.cpu.max
? t('n核', { n: data.cpu.min })
: t('((n-m))核', { n: data.cpu.min, m: data.cpu.max })
data.cpu?.min === data.cpu?.max
? t('n核', { n: data.cpu?.min })
: t('((n-m))核', { n: data.cpu?.min, m: data.cpu?.max })
}}
</div>
</div>
<div class="item">
<div class="item-title">{{ $t('内存') }}:</div>
<div class="item-content">
{{ data.mem.min === data.mem.max ? data.mem.min : `(${data.mem.min}~${data.mem.max})` }} G
{{ data.mem?.min === data.mem?.max ? data.mem?.min : `(${data.mem?.min}~${data.mem?.max})` }} G
</div>
</div>
<div
Expand All @@ -58,13 +58,13 @@
</div>
<div class="table-row">
<div class="row-one">
{{ data.storage_spec[0].mount_point }}
{{ data.storage_spec[0]?.mount_point || '--' }}
</div>
<div class="row-two">
{{ data.storage_spec[0].size }}
{{ data.storage_spec[0]?.size || '--' }}
</div>
<div class="row-three">
{{ data.storage_spec[0].type }}
{{ data.storage_spec[0]?.type || '--' }}
</div>
</div>
</div>
Expand All @@ -77,7 +77,7 @@
{{ $t('单机 QPS') }}
</div>
<div class="item-content">
{{ data.qps.min === data.qps.max ? `${data.qps.min}/s` : `${data.qps.min}/s~${data.qps.max}/s` }}
{{ data.qps?.min === data.qps?.max ? `${data.qps?.min}/s` : `${data.qps?.min}/s~${data.qps?.max}/s` }}
</div>
</div>
</div>
Expand Down
24 changes: 12 additions & 12 deletions dbm-ui/frontend/src/components/resource-host-selector/Index.vue
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,15 +159,22 @@

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';

export interface IValue {
bk_biz_id: number;
bk_cloud_id: number;
bk_host_id: number;
ip: string;
}

interface Props {
multiple?: boolean;
params?: {
bk_biz_id?: number;
for_biz?: number;
bk_cloud_ids?: string;
resource_type?: string;
os_type?: string;
Expand All @@ -178,13 +185,6 @@
(e: 'change', value: IValue[]): void;
}

interface IValue {
bk_biz_id: number;
bk_cloud_id: number;
bk_host_id: number;
ip: string;
}

const props = withDefaults(defineProps<Props>(), {
multiple: true,
params: () => ({}),
Expand Down Expand Up @@ -251,7 +251,7 @@
const handleSubmit = () => {
isShow.value = false;
const latestValue = Object.values(rowSelectMemo.value).map((item) => ({
bk_biz_id: item.bk_biz_id,
bk_biz_id: item.dedicated_biz,
bk_cloud_id: item.bk_cloud_id,
bk_host_id: item.bk_host_id,
ip: item.ip,
Expand Down
2 changes: 1 addition & 1 deletion dbm-ui/frontend/src/demo/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
TimePicker as EditTimePicker,
} from '@components/editable-table/Index.vue';

import OperationColumn from '@views/db-manage/common/toolbox-field/operation-column/Index.vue';
import OperationColumn from '@views/db-manage/common/toolbox-field/column/operation-column/Index.vue';

const createData = () => ({
name: 'name',
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
55 changes: 43 additions & 12 deletions dbm-ui/frontend/src/hooks/useCreateTicket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,41 @@ import InfoBox from 'bkui-vue/lib/info-box';
import { useI18n } from 'vue-i18n';
import { useRouter } from 'vue-router';

import { createTicket } from '@services/source/ticket';
import { createTicketNew } from '@services/source/ticket';

import { messageError, messageSuccess } from '@utils';
import type { TicketTypes } from '@common/const';

export const useCreateTicket = (params: Record<string, any>) => {
const { t, locale } = useI18n();
import { messageError } from '@utils';

export function useCreateTicket<T>(ticketType: TicketTypes, options?: { onSuccess?: (ticketId: number) => void }) {
const loading = ref(false);
const router = useRouter();
const { t, locale } = useI18n();

createTicket(params)
.then(() => messageSuccess(t('单据创建成功')))
.catch((e) => {
const { code, data } = e;
const run = async (formData: { details: T; remark: string; ignore_duplication?: boolean }) => {
const params = {
ticket_type: ticketType,
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID,
...formData,
};
try {
loading.value = true;
const { id: ticketId } = await createTicketNew<T>(params);
if (options?.onSuccess) {
options.onSuccess(ticketId);
} else {
router.push({
name: ticketType,
params: {
page: 'success',
},
query: {
ticketId,
},
});
}
} catch (e: any) {
const { code, data, message } = e;
const duplicateCode = 8704005;
if (code === duplicateCode) {
const id = data.duplicate_ticket_id;
Expand Down Expand Up @@ -59,7 +82,7 @@ export const useCreateTicket = (params: Record<string, any>) => {
cancelText: t('取消提单'),
onConfirm: async () => {
try {
await createTicket({
await run({
...params,
ignore_duplication: true,
});
Expand All @@ -68,8 +91,16 @@ export const useCreateTicket = (params: Record<string, any>) => {
}
},
});
} else {
messageError(message);
}
} finally {
loading.value = false;
}
};

messageError(e.message);
});
};
return {
run,
loading,
};
}
Loading
Loading