diff --git a/dbm-ui/frontend/.vscode/settings.json b/dbm-ui/frontend/.vscode/settings.json index 283c4db563..1f2666a091 100644 --- a/dbm-ui/frontend/.vscode/settings.json +++ b/dbm-ui/frontend/.vscode/settings.json @@ -57,4 +57,4 @@ "titleBar.inactiveForeground": "#15202b99" }, "typescript.tsdk": "node_modules/typescript/lib" -} +} \ No newline at end of file diff --git a/dbm-ui/frontend/babel.config.js b/dbm-ui/frontend/babel.config.js deleted file mode 100644 index e9cae0e843..0000000000 --- a/dbm-ui/frontend/babel.config.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. - * - * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at https://opensource.org/licenses/MIT - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for - * the specific language governing permissions and limitations under the License. -*/ - -module.exports = { - plugins: [ - [ - 'import', - { - libraryName: 'bkui-vue', - style: (name) => { - const index = name.lastIndexOf('/'); - return `${name}${name.slice(index)}.css`; - }, - }, - ], - ], -}; diff --git a/dbm-ui/frontend/bkuiVueResolver.ts b/dbm-ui/frontend/bkuiVueResolver.ts deleted file mode 100644 index 279035bc33..0000000000 --- a/dbm-ui/frontend/bkuiVueResolver.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* - * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. - * - * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at https://opensource.org/licenses/MIT - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for - * the specific language governing permissions and limitations under the License. -*/ - -// import type { ComponentResolver, SideEffectsInfo } from '../../types' -// import { kebabCase } from '../utils' -// type ComponentResolver = {}; -// type SideEffectsInfo = {}; -export function kebabCase(key: string) { - const result = key.replace(/([A-Z])/g, ' $1').trim(); - return result.split(' ').join('-') - .toLowerCase(); -} - -export interface BkuiVueResolverOptions { - /** - * import style along with components - * @default 'css' - */ - importStyle?: boolean | 'css' | 'less' - /** - * resolve `bkui-vue' icons - * @default false - */ - resolveIcons?: boolean -} - -function getSideEffects(importName: string, options: BkuiVueResolverOptions): string | undefined { - const { importStyle = 'css' } = options; - - if (!importStyle) return; - - const compName = kebabCase(importName); - let fileName = kebabCase(importName); - - if (['menu-item', 'menu-group'].includes(compName)) return; - - if (compName === 'submenu') { - fileName = 'menu'; - } - - if (importStyle === 'less') { - return `bkui-vue/lib/${fileName}/${compName}.less`; - } - - return `bkui-vue/lib/${fileName}/${compName}.css`; -} - -export function BkuiVueResolver(options: BkuiVueResolverOptions = {}) { - return { - type: 'component', - resolve: (name: string) => { - if (name.match(/^Bk/)) { - const importName = name.slice(2); - return { - name: importName, - from: 'bkui-vue/lib', - sideEffects: getSideEffects(importName, options), - }; - } - }, - }; -} diff --git a/dbm-ui/frontend/components.d.ts b/dbm-ui/frontend/components.d.ts deleted file mode 100644 index e72d317e84..0000000000 --- a/dbm-ui/frontend/components.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. - * - * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at https://opensource.org/licenses/MIT - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for - * the specific language governing permissions and limitations under the License. -*/ - -// generated by unplugin-vue-components -// We suggest you to commit this file into source control -// Read more: https://github.com/vuejs/vue-next/pull/3399 -import '@vue/runtime-core'; - -declare module '@vue/runtime-core' { - export interface GlobalComponents { - BkMenu: typeof import('bkui-vue/lib')['Menu'] - BkMenuItem: typeof import('bkui-vue/lib')['MenuItem'] - BkNavigation: typeof import('bkui-vue/lib')['Navigation'] - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - } -} - -export {}; diff --git a/dbm-ui/frontend/env.d.ts b/dbm-ui/frontend/env.d.ts index dd46ec8c18..1abc28a478 100644 --- a/dbm-ui/frontend/env.d.ts +++ b/dbm-ui/frontend/env.d.ts @@ -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; } declare module 'js-cookie'; @@ -86,3 +84,20 @@ type KeyExpand = { }; type LeftIsExtendsRightReturnValue = 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; +} diff --git a/dbm-ui/frontend/src/components/cluster-common/RenderStatus.vue b/dbm-ui/frontend/src/components/cluster-status/Index.vue similarity index 96% rename from dbm-ui/frontend/src/components/cluster-common/RenderStatus.vue rename to dbm-ui/frontend/src/components/cluster-status/Index.vue index ee05a4ec2b..323334f88e 100644 --- a/dbm-ui/frontend/src/components/cluster-common/RenderStatus.vue +++ b/dbm-ui/frontend/src/components/cluster-status/Index.vue @@ -12,7 +12,7 @@ --> - diff --git a/dbm-ui/frontend/src/components/mysql-toolbox/common/const.ts b/dbm-ui/frontend/src/components/mysql-toolbox/common/const.ts deleted file mode 100644 index d671ba5564..0000000000 --- a/dbm-ui/frontend/src/components/mysql-toolbox/common/const.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* - * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. - * - * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. - * - * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at https://opensource.org/licenses/MIT - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed - * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for - * the specific language governing permissions and limitations under the License. - */ - -import { t } from '@locales/index'; - -/** - * 备份(源)列表 - */ -export const backupList = [ - { - value: 'local', - label: t('本地备份'), - }, -]; diff --git a/dbm-ui/frontend/src/components/router-back/Index.vue b/dbm-ui/frontend/src/components/router-back/Index.vue index b1fcad080c..a5d1552b0a 100644 --- a/dbm-ui/frontend/src/components/router-back/Index.vue +++ b/dbm-ui/frontend/src/components/router-back/Index.vue @@ -9,20 +9,15 @@ - - diff --git a/dbm-ui/frontend/src/components/vue2/search-select/index.vue b/dbm-ui/frontend/src/components/vue2/search-select/index.vue index 4dce963b81..410929a50d 100644 --- a/dbm-ui/frontend/src/components/vue2/search-select/index.vue +++ b/dbm-ui/frontend/src/components/vue2/search-select/index.vue @@ -41,26 +41,25 @@ + + diff --git a/dbm-ui/frontend/src/components/cluster-common/ExcelAuthorize.vue b/dbm-ui/frontend/src/views/db-manage/common/ExcelAuthorize.vue similarity index 100% rename from dbm-ui/frontend/src/components/cluster-common/ExcelAuthorize.vue rename to dbm-ui/frontend/src/views/db-manage/common/ExcelAuthorize.vue diff --git a/dbm-ui/frontend/src/components/cluster-common/OperationBtnStatusTips.vue b/dbm-ui/frontend/src/views/db-manage/common/OperationBtnStatusTips.vue similarity index 96% rename from dbm-ui/frontend/src/components/cluster-common/OperationBtnStatusTips.vue rename to dbm-ui/frontend/src/views/db-manage/common/OperationBtnStatusTips.vue index 023c86ba5e..ec57b828b6 100644 --- a/dbm-ui/frontend/src/components/cluster-common/OperationBtnStatusTips.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/OperationBtnStatusTips.vue @@ -121,11 +121,11 @@ }); diff --git a/dbm-ui/frontend/src/components/cluster-common/RenderBaseInfo.vue b/dbm-ui/frontend/src/views/db-manage/common/RenderBaseInfo.vue similarity index 96% rename from dbm-ui/frontend/src/components/cluster-common/RenderBaseInfo.vue rename to dbm-ui/frontend/src/views/db-manage/common/RenderBaseInfo.vue index e4c58b5799..5018e374d1 100644 --- a/dbm-ui/frontend/src/components/cluster-common/RenderBaseInfo.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/RenderBaseInfo.vue @@ -53,7 +53,7 @@ + + diff --git a/dbm-ui/frontend/src/components/cluster-entry-config/RenderBindIps.vue b/dbm-ui/frontend/src/views/db-manage/common/cluster-entry-config/RenderBindIps.vue similarity index 100% rename from dbm-ui/frontend/src/components/cluster-entry-config/RenderBindIps.vue rename to dbm-ui/frontend/src/views/db-manage/common/cluster-entry-config/RenderBindIps.vue diff --git a/dbm-ui/frontend/src/components/cluster-event-change/EventChange.vue b/dbm-ui/frontend/src/views/db-manage/common/cluster-event-change/EventChange.vue similarity index 80% rename from dbm-ui/frontend/src/components/cluster-event-change/EventChange.vue rename to dbm-ui/frontend/src/views/db-manage/common/cluster-event-change/EventChange.vue index d6a9b8eea6..0248d4a5e8 100644 --- a/dbm-ui/frontend/src/components/cluster-event-change/EventChange.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/cluster-event-change/EventChange.vue @@ -15,22 +15,20 @@
- - - +
@@ -43,23 +41,16 @@ getClusterOperateRecords, getInstanceOperateRecords, } from '@services/source/ticket'; - import type { ClusterOperateRecord } from '@services/types/ticket'; import DbStatus from '@components/db-status/index.vue'; - import type { TableProps } from '@/types/bkui-vue'; - - interface State { - daterange: [string | Date, string | Date], - data: ClusterOperateRecord[], - isLoading: boolean - } - interface Props { id: number, // 集群 or 实例 id isFetchInstance?: boolean } + type IRowData = ServiceReturnType['results'][number] + const props = withDefaults(defineProps(), { isFetchInstance: false, }); @@ -67,15 +58,12 @@ const { t } = useI18n(); const tableRef = ref(); - const state = reactive({ - daterange: [subDays(new Date(), 6), new Date()], - isLoading: false, - data: [], - }); + + const daterange = ref<[string, string]|[Date, Date]>([subDays(new Date(), 6), new Date()]) const dataSource = computed(() => (props.isFetchInstance ? getInstanceOperateRecords : getClusterOperateRecords)); - const columns: TableProps['columns'] = [ + const columns = [ { label: t('时间'), field: 'create_at', @@ -85,7 +73,7 @@ }, { label: t('操作结果'), field: 'op_status', - render: ({ data }: {data: ClusterOperateRecord}) => { + render: ({ data }: {data: IRowData}) => { const errorStatus = { text: t('失败'), theme: 'danger' }; const successStatus = { text: t('成功'), theme: 'success' }; const loadingStatus = { text: t('执行中'), theme: 'loading' }; @@ -105,7 +93,7 @@ }, { label: t('单据链接'), field: 'ticket_id', - render: ({ data }: {data: ClusterOperateRecord}) => ( + render: ({ data }: {data: IRowData}) => ( { if (!props.id) return; - const [start, end] = state.daterange; + const [start, end] = daterange.value; const dateParams = start && end ? { start_time: format(new Date(Number(start)), 'yyyy-MM-dd HH:mm:ss'), end_time: format(new Date(Number(end)), 'yyyy-MM-dd HH:mm:ss'), @@ -148,10 +136,9 @@ }); function handleClearFilters() { - state.daterange = ['', '']; + daterange.value = ['', '']; fetchData(); } - diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/TargetClusterPreview.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/TargetClusterPreview.vue index 0ae1daa6b3..f1e0eda51c 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/TargetClusterPreview.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/TargetClusterPreview.vue @@ -57,7 +57,7 @@ import { useDefaultPagination } from '@hooks'; - import RenderClusterStatus from '@components/cluster-common/RenderStatus.vue'; + import RenderClusterStatus from '@components/cluster-status/Index.vue'; import { getSearchSelectorParams } from '@utils'; diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/script-execute/components/RenderFileContent.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/script-execute/components/RenderFileContent.vue index 5b50f2d0a8..9e2a4a1e11 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/script-execute/components/RenderFileContent.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mongodb/script-execute/components/RenderFileContent.vue @@ -39,24 +39,19 @@