-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(frontend): mongodb工具箱重构_全库备份 #8498
- Loading branch information
Showing
15 changed files
with
704 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// }, | ||
// }); | ||
// } |
10 changes: 10 additions & 0 deletions
10
dbm-ui/frontend/src/services/model/ticket/details/mongodb/MONGODB_FULL_BACKUP.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
1 change: 1 addition & 0 deletions
1
dbm-ui/frontend/src/services/model/ticket/details/mongodb/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './MONGODB_FULL_BACKUP'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
dbm-ui/frontend/src/views/db-manage/common/TicketRemark.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
49 changes: 49 additions & 0 deletions
49
dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/Index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.