Skip to content

Commit

Permalink
chore(frontend): 移除冗余的类型定义 #7120
Browse files Browse the repository at this point in the history
  • Loading branch information
hailinxiao authored and hLinx committed Sep 24, 2024
1 parent 2e4f236 commit ffddc39
Show file tree
Hide file tree
Showing 65 changed files with 485 additions and 758 deletions.
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>;
}
26 changes: 11 additions & 15 deletions dbm-ui/frontend/src/components/db-table/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,6 @@
</BkLoading>
</div>
</template>
<script lang="tsx">
export interface IPagination {
count: number;
current: number;
limit: number;
limitList: Array<number>;
align: string;
layout: Array<string>;
}
export interface IPaginationExtra {
small?: boolean;
}
</script>
<script setup lang="tsx">
import type { Table } from 'bkui-vue';
import _ from 'lodash';
Expand Down Expand Up @@ -108,7 +95,9 @@
dataSource: (params: any, payload?: IRequestPayload)=> Promise<any>,
fixedPagination?: boolean,
clearSelection?: boolean,
paginationExtra?: IPaginationExtra,
paginationExtra?: {
small?: boolean;
},
selectable?: boolean,
disableSelectMethod?: (data: any) => boolean|string,
// data 数据的主键
Expand Down Expand Up @@ -239,7 +228,14 @@
const isAnomalies = ref(false);
const rowSelectMemo = shallowRef<Record<string|number, Record<any, any>>>({});
const isWholeChecked = ref(false);
const pagination = reactive<IPagination>({
const pagination = reactive<{
count: number;
current: number;
limit: number;
limitList: Array<number>;
align: string;
layout: Array<string>;
}>({
count: 0,
current: 1,
limit: 10,
Expand Down
26 changes: 12 additions & 14 deletions dbm-ui/frontend/src/components/host-preview/HostPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@

import DbStatus from '@components/db-status/index.vue';

import type { TableColumnRender } from '@/types/bkui-vue';

interface Props {
fetchParams: Record<string, any>,
fetchNodes: (params: any) => Promise<HostNode[]>,
Expand All @@ -96,48 +94,48 @@
}, {
label: t('每台主机节点数'),
field: 'instance_num',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.instance_num || '--',
}, {
label: 'IPv6',
field: 'bk_host_innerip_v6',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_host_innerip_v6 || '--',
}, {
label: t('管控区域'),
field: 'bk_cloud_name',
render: ({ cell }: any) => <span>{cell?.name || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_cloud_name || '--',
}, {
label: t('Agent状态'),
field: 'status',
render: ({ cell }: { cell: number }) => {
if (typeof cell !== 'number') return '--';
render: ({ data }: {data: HostNode}) => {
if (typeof data.status !== 'number') return '--';

const text = [t('异常'), t('正常')];
return <DbStatus theme={cell === 1 ? 'success' : 'danger'}>{text[cell]}</DbStatus>;
return <DbStatus theme={data.status === 1 ? 'success' : 'danger'}>{text[data.status]}</DbStatus>;
},
}, {
label: t('主机名称'),
field: 'bk_host_name',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_host_name || '--',
}, {
label: t('OS名称'),
field: 'bk_os_name',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_os_name || '--',
}, {
label: t('所属云厂商'),
field: 'bk_cloud_vendor',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_cloud_vendor || '--',
}, {
label: t('OS类型'),
field: 'bk_os_type',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_os_type || '--',
}, {
label: t('主机ID'),
field: 'bk_host_id',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_host_id || '--',
}, {
label: 'Agent ID',
field: 'bk_agent_id',
render: ({ cell }: TableColumnRender) => <span>{cell || '--'}</span>,
render: ({ data }: {data: HostNode}) => data.bk_agent_id || '--',
}];
const state = reactive({
isLoading: false,
Expand Down
Loading

0 comments on commit ffddc39

Please sign in to comment.