Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf master #7123

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion dbm-ui/frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@
"titleBar.inactiveForeground": "#15202b99"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
}
27 changes: 0 additions & 27 deletions dbm-ui/frontend/babel.config.js

This file was deleted.

72 changes: 0 additions & 72 deletions dbm-ui/frontend/bkuiVueResolver.ts

This file was deleted.

29 changes: 0 additions & 29 deletions dbm-ui/frontend/components.d.ts

This file was deleted.

43 changes: 29 additions & 14 deletions dbm-ui/frontend/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@ declare module '*.css' {
export default css;
}

declare interface Window {
changeConfirm: boolean | 'popover';
clipboardData: {
getData: (params: string) => string;
};
PROJECT_ENV: {
VITE_PUBLIC_PATH: string;
VITE_AJAX_URL_PREFIX: string;
VITE_ROUTER_PERFIX: string;
};
PROJECT_CONFIG: {
BIZ_ID: number;
TICKET_DETAIL_REQUEST_CONTROLLER: AbortController;
declare module 'vite-plugin-monaco-editor' {
interface MonacoEditorOptions {
// 根据实际插件文档填写选项
language?: string;
theme?: string;
// 其他可能的选项...
}

const monacoEditorPlugin: (options: MonacoEditorOptions) => any;

export default {
default: monacoEditorPlugin,
};
BKApp: App<Element>;
}

declare module 'js-cookie';
Expand Down Expand Up @@ -86,3 +84,20 @@ type KeyExpand<T> = {
};

type LeftIsExtendsRightReturnValue<L, R, V> = L extends R ? never : V;

declare interface Window {
changeConfirm: boolean | 'popover';
clipboardData: {
getData: (params: string) => string;
};
PROJECT_ENV: {
VITE_PUBLIC_PATH: string;
VITE_AJAX_URL_PREFIX: string;
VITE_ROUTER_PERFIX: string;
};
PROJECT_CONFIG: {
BIZ_ID: number;
TICKET_DETAIL_REQUEST_CONTROLLER: AbortController;
};
BKApp: App<Element>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-->

<template>
<div class="render-cluster-status">
<div class="db-cluster-status">
<DbIcon
svg
:type="statusIcon" />
Expand Down Expand Up @@ -50,7 +50,7 @@
const statusText = computed(() => textMap[props.data.toLocaleLowerCase() as keyof typeof textMap]);
</script>
<style lang="less">
.render-cluster-status {
.db-cluster-status {
display: flex;
align-items: center;
}
Expand Down
35 changes: 20 additions & 15 deletions dbm-ui/frontend/src/components/cost-timer/CostTimer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,32 @@
import { useIntervalFn } from '@vueuse/core';

interface Props {
value: number,
isTiming: boolean,
startTime: number,
value: number;
isTiming: boolean;
startTime: number;
}

const props = defineProps<Props>();

const costTime = ref(0);
// 计时
const {
resume,
pause,
} = useIntervalFn(() => {
costTime.value = Math.floor(Date.now() / 1000) - props.startTime;
}, 1000, { immediate: false });

watch(() => props.value, (time) => {
if (!props.isTiming) {
costTime.value = time;
}
}, { immediate: true });
const { resume, pause } = useIntervalFn(
() => {
costTime.value = Math.floor(Date.now() / 1000) - props.startTime;
},
1000,
{ immediate: false },
);

watch(
() => props.value,
(time) => {
if (!props.isTiming) {
costTime.value = time;
}
},
{ immediate: true },
);

watch(
() => props.isTiming,
Expand Down
24 changes: 14 additions & 10 deletions dbm-ui/frontend/src/components/db-form/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import { debounce } from 'lodash';

interface Props {
model?: Record<string, any>,
autoLabelWidth?: boolean,
model?: Record<string, any>;
autoLabelWidth?: boolean;
}

const props = withDefaults(defineProps<Props>(), {
Expand All @@ -36,15 +36,19 @@

const dbFormRef = ref();

watch(() => props.model, () => {
if (isUserChange.value) {
window.changeConfirm = true;
}
}, { deep: true });
watch(
() => props.model,
() => {
if (isUserChange.value) {
window.changeConfirm = true;
}
},
{ deep: true },
);

/** 用户主动操作变更表单 */
const isUserChange = ref(false);
const handleUserChange = () => isUserChange.value = true;
const handleUserChange = () => (isUserChange.value = true);

const getCssStyle = (el: HTMLElement, prop: string) => window.getComputedStyle(el, null).getPropertyValue(prop);
const calcLableWidth = () => {
Expand Down Expand Up @@ -99,8 +103,8 @@
});

defineExpose({
validate: (fields?: string | Array<string>) => dbFormRef.value.validate(fields)
.catch((error: Error) => {
validate: (fields?: string | Array<string>) =>
dbFormRef.value.validate(fields).catch((error: Error) => {
const errorItemEl = dbFormRef.value.$el.querySelector('.bk-form-item.is-error');
if (errorItemEl) {
errorItemEl.scrollIntoView();
Expand Down
Loading
Loading