diff --git a/dbm-ui/frontend/src/components/cluster-selector/Index.vue b/dbm-ui/frontend/src/components/cluster-selector/Index.vue index f6dbe5ca12..79446ce605 100644 --- a/dbm-ui/frontend/src/components/cluster-selector/Index.vue +++ b/dbm-ui/frontend/src/components/cluster-selector/Index.vue @@ -319,6 +319,7 @@ getResourceList: getTendbsingleList, tableContent: TendbSingleTable, resultContent: ResultPreview, + showPreviewResultTitle: true, }, [ClusterTypes.MONGO_REPLICA_SET]: { id: ClusterTypes.MONGO_REPLICA_SET, @@ -333,6 +334,7 @@ getResourceList: getMongoList, tableContent: MongoTable, resultContent: ResultPreview, + showPreviewResultTitle: true, }, [ClusterTypes.MONGO_SHARED_CLUSTER]: { id: ClusterTypes.MONGO_SHARED_CLUSTER, diff --git a/dbm-ui/frontend/src/components/render-table/columns/operate-column/index.vue b/dbm-ui/frontend/src/components/render-table/columns/operate-column/index.vue index 7b4541ac0d..b893b261e1 100644 --- a/dbm-ui/frontend/src/components/render-table/columns/operate-column/index.vue +++ b/dbm-ui/frontend/src/components/render-table/columns/operate-column/index.vue @@ -12,7 +12,7 @@ --> diff --git a/dbm-ui/frontend/src/views/db-manage/common/toolbox-field/operation-column/Index.vue b/dbm-ui/frontend/src/views/db-manage/common/toolbox-field/operation-column/Index.vue index 1f5da372e4..f4c7426cbd 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/toolbox-field/operation-column/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/toolbox-field/operation-column/Index.vue @@ -25,6 +25,12 @@ @click="handleAppend"> + + +
+ + + diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page1/Index.vue new file mode 100644 index 0000000000..4aa3ab6a16 --- /dev/null +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page1/Index.vue @@ -0,0 +1,286 @@ + + + + + + + diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page2/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page2/Index.vue new file mode 100644 index 0000000000..1fe8b7cca3 --- /dev/null +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/MONGODB_FULL_BACKUP/pages/page2/Index.vue @@ -0,0 +1,88 @@ + + + + diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/common/toolbox-field/edit-cluster/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/common/toolbox-field/edit-cluster/Index.vue index 09a5ac894a..b48e0f89c2 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/common/toolbox-field/edit-cluster/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/common/toolbox-field/edit-cluster/Index.vue @@ -1,9 +1,127 @@ - - + + interface Exposes { + setSelectedCluster: (clusterType: string, domain: string) => void; + resetSelectedCluster: () => void; + } + + const emits = defineEmits(); + + const modelValue = defineModel[number]>>({ + required: true, + }); + + const { t } = useI18n(); + + const rules = [ + { + validator: (value: string) => domainRegex.test(value), + trigger: 'change', + message: t('目标集群输入格式有误'), + }, + { + validator: () => Boolean(modelValue.value.id), + trigger: 'change', + message: t('目标集群不存在'), + }, + ]; + + const editableTableColumnRef = useTemplateRef('editableTableColumn'); + const isShowClusterSelector = ref(false); + const isLoading = ref(false); + + const selectedClusters = shallowRef<{ [key: string]: MongodbModel[] }>({ + [ClusterTypes.MONGO_REPLICA_SET]: [], + [ClusterTypes.MONGO_SHARED_CLUSTER]: [], + }); + + watch( + () => modelValue.value.master_domain, + () => { + if (!modelValue.value.id && modelValue.value.master_domain) { + isLoading.value = true; + modelValue.value.id = undefined; + filterClusters({ + bk_biz_id: window.PROJECT_CONFIG.BIZ_ID, + exact_domain: modelValue.value.master_domain, + }) + .then((data) => { + if (data.length > 0) { + [modelValue.value] = data; + } + }) + .finally(() => { + isLoading.value = false; + editableTableColumnRef.value!.validate(); + }); + } + }, + { + immediate: true, + }, + ); + + const handleShowClusterSelector = () => { + isShowClusterSelector.value = true; + }; + + const handelClusterChange = (selected: { [key: string]: MongodbModel[] }) => { + selectedClusters.value = selected; + const clusterList = Object.values(selected).flatMap((selectedList) => selectedList); + emits('batch-edit', clusterList); + }; + + defineExpose({ + setSelectedCluster(clusterType: string, domain: string) { + const clustersArr = selectedClusters.value[clusterType!]; + selectedClusters.value[clusterType!] = clustersArr.filter((item) => item.master_domain !== domain); + }, + resetSelectedCluster() { + selectedClusters.value[ClusterTypes.MONGO_SHARED_CLUSTER] = []; + selectedClusters.value[ClusterTypes.MONGO_REPLICA_SET] = []; + }, + }); + diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/routes.ts b/dbm-ui/frontend/src/views/db-manage/mongodb/routes.ts index 93d89f8e8d..0d05ed0dcd 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/routes.ts +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/routes.ts @@ -3,8 +3,26 @@ import type { RouteRecordRaw } from 'vue-router'; import type { MongoFunctions } from '@services/model/function-controller/functionController'; import FunctionControllModel from '@services/model/function-controller/functionController'; +import { TicketTypes } from '@common/const'; + import { t } from '@locales/index'; +const createRouteItem = ( + ticketType: TicketTypes, + meta: { + navName: string; + skeleton?: string; + }, +) => ({ + name: ticketType, + path: `${ticketType}/:page?`, + meta: { + fullscreen: true, + ...meta, + }, + component: () => import(`@views/db-manage/mongodb/${ticketType}/Index.vue`), +}); + export const mongoToolboxChildrenRoutes: RouteRecordRaw[] = [ { path: 'script-execute/:step?', @@ -87,14 +105,17 @@ export const mongoToolboxChildrenRoutes: RouteRecordRaw[] = [ }, component: () => import('@views/db-manage/mongodb/db-table-backup/Index.vue'), }, - { - name: 'MongoDbBackup', - path: 'db-data-copy-record/:page?', - meta: { - navName: t('全库备份'), - }, - component: () => import('@views/db-manage/mongodb/db-backup/Index.vue'), - }, + createRouteItem(TicketTypes.MONGODB_FULL_BACKUP, { + navName: t('全库备份'), + }), + // { + // name: 'MongoDbBackup', + // path: 'db-data-copy-record/:page?', + // meta: { + // navName: t('全库备份'), + // }, + // component: () => import('@views/db-manage/mongodb/db-backup/Index.vue'), + // }, { path: 'db-clear/:page?', name: 'MongoDbClear', diff --git a/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts index f99af49ae0..82b8ed6201 100644 --- a/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts @@ -10,6 +10,8 @@ * 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 { TicketTypes } from '@common/const'; + import { t } from '@locales/index'; export interface MenuChild { @@ -97,7 +99,7 @@ export default [ }, { name: t('全库备份'), - id: 'MongoDbBackup', + id: TicketTypes.MONGODB_FULL_BACKUP, parentId: 'mongo_backup', }, ], diff --git a/dbm-ui/frontend/src/views/tickets/common/components/TicketClone.vue b/dbm-ui/frontend/src/views/tickets/common/components/TicketClone.vue index f80fe8d7d1..cc88ccccb7 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/TicketClone.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/TicketClone.vue @@ -142,6 +142,7 @@ [TicketTypes.TENDBCLUSTER_MIGRATE_CLUSTER]: 'spiderMasterSlaveClone', // spider 迁移主从 [TicketTypes.TENDBCLUSTER_RESTORE_LOCAL_SLAVE]: 'spiderSlaveRebuild', // spider 重建从库-原地重建 [TicketTypes.TENDBCLUSTER_RESTORE_SLAVE]: 'spiderSlaveRebuild', // spider 重建从库-新机重建 + [TicketTypes.MONGODB_FULL_BACKUP]: TicketTypes.MONGODB_FULL_BACKUP, // mongodb 全库备份 }; const isShowTicketClone = computed(() => !!ticketTypeRouteNameMap[props.data.ticket_type]);