forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(frontend): 工具箱支持资源池协议变更_mysql添加proxy TencentBlueKing#8076
# Reviewed, transaction id: 26514
- Loading branch information
1 parent
8f44114
commit a09e95c
Showing
29 changed files
with
795 additions
and
98 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
111 changes: 111 additions & 0 deletions
111
dbm-ui/frontend/src/components/editable-table/edit/Operate.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,111 @@ | ||
<!-- | ||
* 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> | ||
<div class="action-box"> | ||
<div | ||
v-if="showAdd" | ||
class="action-btn" | ||
@click="handleAppend"> | ||
<DbIcon type="plus-fill" /> | ||
</div> | ||
<div | ||
v-if="showRemove" | ||
class="action-btn" | ||
:class="{ | ||
disabled: removeable, | ||
}" | ||
@click="handleRemove"> | ||
<DbIcon type="minus-fill" /> | ||
</div> | ||
<div | ||
v-if="showClone" | ||
v-bk-tooltips="t('克隆')" | ||
class="action-btn" | ||
@click="handleClone"> | ||
<DbIcon type="copy-2" /> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { useI18n } from 'vue-i18n'; | ||
|
||
interface Props { | ||
showAdd?: boolean; | ||
showRemove?: boolean; | ||
removeable?: boolean; | ||
showClone?: boolean; | ||
} | ||
|
||
interface Emits { | ||
(e: 'add'): void; | ||
(e: 'remove'): void; | ||
(e: 'clone'): void; | ||
} | ||
|
||
const props = withDefaults(defineProps<Props>(), { | ||
showAdd: true, | ||
showRemove: true, | ||
removeable: true, | ||
showClone: false, | ||
}); | ||
|
||
const emits = defineEmits<Emits>(); | ||
|
||
const { t } = useI18n(); | ||
|
||
const handleAppend = () => { | ||
emits('add'); | ||
}; | ||
|
||
const handleRemove = () => { | ||
if (props.removeable) { | ||
return; | ||
} | ||
emits('remove'); | ||
}; | ||
|
||
const handleClone = () => { | ||
emits('clone'); | ||
}; | ||
</script> | ||
<style lang="less" scoped> | ||
.action-box { | ||
display: flex; | ||
height: 42px; | ||
padding: 0 16px; | ||
align-items: center; | ||
background-color: #fff; | ||
|
||
.action-btn { | ||
display: flex; | ||
font-size: 14px; | ||
color: #c4c6cc; | ||
cursor: pointer; | ||
transition: all 0.15s; | ||
|
||
&:hover { | ||
color: #979ba5; | ||
} | ||
|
||
&.disabled { | ||
color: #dcdee5; | ||
cursor: not-allowed; | ||
} | ||
|
||
& ~ .action-btn { | ||
margin-left: 12px; | ||
} | ||
} | ||
} | ||
</style> |
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 was deleted.
Oops, something went wrong.
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,9 @@ | ||
import type { TicketTypes } from '@common/const'; | ||
|
||
export interface TicketCreate<T> { | ||
bk_biz_id: number; | ||
details: T; | ||
ignore_duplication: boolean; | ||
remark: string; | ||
ticket_type: TicketTypes; | ||
} |
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,46 @@ | ||
import { createTicket } from '@services/source/ticket'; | ||
|
||
import type * as Mongodb from './mongodb'; | ||
import type * as Mysql from './mysql'; | ||
import type * as Redis from './redis'; | ||
import type * as Sqlserver from './sqlserver'; | ||
import type * as Tendbcluster from './tendbcluster'; | ||
|
||
export type * from './common'; | ||
|
||
type TicketCreateDetails = Mysql.TicketCreateDetails & | ||
Tendbcluster.TicketCreateDetails & | ||
Redis.TicketCreateDetails & | ||
Sqlserver.TicketCreateDetails & | ||
Mongodb.TicketCreateDetails; | ||
|
||
export function useCreateTicket(ticketType: keyof TicketCreateDetails) { | ||
const loading = ref(false); | ||
const router = useRouter(); | ||
|
||
const run = async (details: TicketCreateDetails[typeof ticketType], remark = '') => { | ||
loading.value = true; | ||
const { id } = await createTicket({ | ||
ticket_type: ticketType, | ||
bk_biz_id: window.PROJECT_CONFIG.BIZ_ID, | ||
details, | ||
remark, | ||
ignore_duplication: true, | ||
}); | ||
loading.value = false; | ||
router.push({ | ||
name: ticketType, | ||
params: { | ||
page: 'success', | ||
}, | ||
query: { | ||
ticketId: id, | ||
}, | ||
}); | ||
}; | ||
|
||
return { | ||
run, | ||
loading, | ||
}; | ||
} |
15 changes: 15 additions & 0 deletions
15
dbm-ui/frontend/src/hooks/useCreateTicket/mongodb/MONGODB_TEMPORARY_DESTROY.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,15 @@ | ||
import type { TicketTypes } from '@common/const'; | ||
|
||
export interface TicketCreateDetails { | ||
[TicketTypes.MYSQL_ADD_SLAVE]: { | ||
infos: { | ||
cluster_ids: number[]; | ||
new_proxy: { | ||
bk_biz_id: number; | ||
bk_cloud_id: number; | ||
bk_host_id: number; | ||
ip: string; | ||
}; | ||
}[]; | ||
}; | ||
} |
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_TEMPORARY_DESTROY'; |
16 changes: 16 additions & 0 deletions
16
dbm-ui/frontend/src/hooks/useCreateTicket/mysql/MYSQL_ADD_SLAVE.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,16 @@ | ||
import type { TicketTypes } from '@common/const'; | ||
|
||
export interface TicketCreateDetails { | ||
[TicketTypes.MYSQL_ADD_SLAVE]: { | ||
backup_source: 'local' | 'remote'; | ||
infos: { | ||
cluster_ids: number[]; | ||
new_proxy: { | ||
bk_biz_id: number; | ||
bk_cloud_id: number; | ||
bk_host_id: number; | ||
ip: string; | ||
}; | ||
}[]; | ||
}; | ||
} |
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 './MYSQL_ADD_SLAVE'; |
Oops, something went wrong.