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(frontend): mongodb工具箱重构_全库备份 #8498 #8556

Open
wants to merge 2 commits into
base: frontend_feature_toolbox
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/components/cluster-selector/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@
getResourceList: getTendbsingleList,
tableContent: TendbSingleTable,
resultContent: ResultPreview,
showPreviewResultTitle: true,
},
[ClusterTypes.MONGO_REPLICA_SET]: {
id: ClusterTypes.MONGO_REPLICA_SET,
Expand All @@ -333,6 +334,7 @@
getResourceList: getMongoList,
tableContent: MongoTable,
resultContent: ResultPreview,
showPreviewResultTitle: true,
},
[ClusterTypes.MONGO_SHARED_CLUSTER]: {
id: ClusterTypes.MONGO_SHARED_CLUSTER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
-->

<template>
<FixedColumn>
<EditableTableColumn label="操作">
<div class="action-box">
<div
v-if="showAdd"
Expand All @@ -37,12 +37,17 @@
<DbIcon type="copy-2" />
</div>
</div>
</FixedColumn>
</EditableTableColumn>
</template>
<script setup lang="ts">
import { useI18n } from 'vue-i18n';

import FixedColumn from '@components/render-table/columns/fixed-column/index.vue';
import {
// Block as EditBlock,
Column as EditableTableColumn,
// Row as EditableTableRow,
} from '@components/editable-table/Index.vue';
// import FixedColumn from '@components/render-table/columns/fixed-column/index.vue';

interface Props {
showAdd?: boolean;
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 @@ -36,6 +36,7 @@ export * from './useTableSettings';
export * from './useTagsOverflow';
export * from './useTaskCount';
export * from './useTicketCloneInfo';
export * from './useTicketDetail';
export * from './useTicketMessage';
export * from './useTimeZoneFormat';
export * from './useUrlSearach';
68 changes: 68 additions & 0 deletions dbm-ui/frontend/src/hooks/useTicketDetail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* 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 { useRequest } from 'vue-request';
import { useRoute } from 'vue-router';

import type { DetailBase } from '@services/model/ticket/details/common';
import TicketModel from '@services/model/ticket/ticket';
import { getTicketDetails } from '@services/source/ticket';

import { TicketTypes } from '@common/const';

export function useTicketDetail<T extends DetailBase>(
ticketType: TicketTypes,
options: {
onSuccess: (data: TicketModel<T>) => void;
},
) {
const route = useRoute();
const { ticketId } = route.query;

if (!ticketId) {
return;
}

useRequest(getTicketDetails, {
defaultParams: [{ id: Number(ticketId) }, { permission: 'catch' }],
onSuccess(ticketData) {
if (ticketType !== ticketData.ticket_type) {
return;
}
options.onSuccess(ticketData as TicketModel<T>);
},
});
}

// export function useTicketDetail(
// ticketType: TicketTypes | TicketTypes[],
// options: {
// onSuccess: (data: TicketModel<unknown>, matchingType: TicketTypes) => void;
// },
// ) {
// const route = useRoute();
// const { ticketId } = route.query;
// const { onSuccess } = options;
// if (!ticketId) {
// return;
// }
// useRequest(getTicketDetails, {
// defaultParams: [{ id: Number(ticketId) }, { permission: 'catch' }],
// onSuccess(ticketData) {
// const ticketTypeList = Array.isArray(ticketType) ? ticketType : [ticketType];
// if (!ticketTypeList.includes(ticketData.ticket_type)) {
// return;
// }
// onSuccess(ticketData, ticketData.ticket_type);
// },
// });
// }
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { DetailBase, DetailClusters } from '../common';

export interface DbBackupDetails extends DetailBase {
clusters: DetailClusters;
file_tag: string;
infos: {
cluster_id: number;
}[];
oplog: boolean;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './MONGODB_FULL_BACKUP';
1 change: 1 addition & 0 deletions dbm-ui/frontend/src/services/model/ticket/ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { t } from '@locales/index';

import type { DetailBase } from './details/common';

export type * as Mongodb from './details/mongodb';
export type * as Mysql from './details/mysql';
export type * as Redis from './details/redis';
export type * as Sqlserver from './details/sqlserver';
Expand Down
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
18 changes: 18 additions & 0 deletions dbm-ui/frontend/src/views/db-manage/common/TicketRemark.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<BkFormItem :label="t('备注')">
<BkInput
v-model="modelValue"
:maxlength="500"
:placeholder="t('请提供更多有用信息申请信息_以获得更快审批')"
style="width: 700px"
type="textarea" />
</BkFormItem>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';

const { t } = useI18n();

const modelValue = defineModel<string>();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
@click="handleAppend">
<DbIcon type="plus-fill" />
</div>
<BkButton
v-if="Boolean(createRowMethod)"
text
@click="handleAppend">
<DbIcon type="plus-fill" />
</BkButton>
<div
class="action-btn"
:class="{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!--
* 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 athttps://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.
-->

<template>
<Component :is="com" />
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';

import Page1 from './pages/page1/Index.vue';
import Page2 from './pages/page2/Index.vue';

const route = useRoute();

const comMap = {
ticket: Page1,
success: Page2,
};

const page = ref('');

const com = computed(() => {
if (comMap[page.value as keyof typeof comMap]) {
return comMap[page.value as keyof typeof comMap];
}
return Page1;
});

watch(
route,
() => {
page.value = route.params.page as string;
},
{
immediate: true,
},
);
</script>
Loading