diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/MongoDB.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/MongoDB.vue index ef84e450d3..53fda19ca4 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/MongoDB.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/MongoDB.vue @@ -73,7 +73,7 @@ import { UserPersonalSettings } from '@common/const'; - import toolboxMenuConfig from '@views/mongodb-manage/toolbox-menu'; + import toolboxMenuConfig from '@views/db-manage/mongodb/toolbox-menu'; import { makeMap } from '@utils'; diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Mysql.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Mysql.vue index 7a78f6abdc..7e79a17045 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Mysql.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Mysql.vue @@ -135,7 +135,7 @@ import { UserPersonalSettings } from '@common/const'; - import toolboxMenuConfig from '@views/mysql/toolbox-menu'; + import toolboxMenuConfig from '@views/db-manage/mysql/toolbox-menu'; import { makeMap } from '@utils'; diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Redis.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Redis.vue index eddb38debb..7882786de0 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Redis.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/Redis.vue @@ -88,7 +88,7 @@ import { UserPersonalSettings } from '@common/const'; - import toolboxMenuConfig from '@views/redis/toolbox-menu'; + import toolboxMenuConfig from '@views/db-manage/redis/toolbox-menu'; import { makeMap } from '@utils'; diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/SqlServer.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/SqlServer.vue index b5c22c9638..6482b4ff65 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/SqlServer.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/SqlServer.vue @@ -79,7 +79,7 @@ import { UserPersonalSettings } from '@common/const'; - import toolboxMenuConfig from '@views/sqlserver-manage/toolbox-menu'; + import toolboxMenuConfig from '@views/db-manage/sqlserver/toolbox-menu'; import { makeMap } from '@utils'; diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/TendbCluster.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/TendbCluster.vue index a756c677a6..b48fc6eae7 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/TendbCluster.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/TendbCluster.vue @@ -95,7 +95,7 @@ import { UserPersonalSettings } from '@common/const'; - import toolboxMenuConfig from '@views/spider-manage/toolbox-menu'; + import toolboxMenuConfig from '@views/db-manage/tendb-cluster/toolbox-menu'; import { makeMap } from '@utils'; diff --git a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/components/ToolboxMenu.vue b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/components/ToolboxMenu.vue index 9e0687b66c..af861bb807 100644 --- a/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/components/ToolboxMenu.vue +++ b/dbm-ui/frontend/src/layout/components/database-manage/components/module-group/components/ToolboxMenu.vue @@ -25,7 +25,7 @@ import _ from 'lodash'; import { ref, watch } from 'vue'; - import mysqlToolboxMenuConfig from '@views/mysql/toolbox-menu'; + import mysqlToolboxMenuConfig from '@views/db-manage/mysql/toolbox-menu'; interface Props { id: string; diff --git a/dbm-ui/frontend/src/router/index.ts b/dbm-ui/frontend/src/router/index.ts index bc332fe9db..dd65192ad4 100644 --- a/dbm-ui/frontend/src/router/index.ts +++ b/dbm-ui/frontend/src/router/index.ts @@ -13,35 +13,22 @@ import _ from 'lodash'; import { createRouter, createWebHistory, type Router, type RouteRecordRaw } from 'vue-router'; -import type { BigdataFunctions, MongoFunctions } from '@services/model/function-controller/functionController'; - -import { useFunController, useGlobalBizs } from '@stores'; +import { useGlobalBizs } from '@stores'; import BizPermission from '@views/BizPermission.vue'; import getDbConfRoutes from '@views/db-configure/routes'; -// import getDbManageRoutes from '@views/db-manage/routes'; +import getDbManageRoutes from '@views/db-manage/routes'; import getDbhaSwitchEventsRouters from '@views/dbha-switch-events/routes'; import getDutyRuleManageRoutes from '@views/duty-rule-manage/routes'; -import getESRoutes from '@views/es-manage/routes'; -import getHDFSRoutes from '@views/hdfs-manage/routes'; -import getInfluxDBRoutes from '@views/influxdb-manage/routes'; import getInspectionRoutes from '@views/inspection-manage/routes'; -import getKafkaRoutes from '@views/kafka-manage/routes'; -import getMongoRoutes from '@views/mongodb-manage/routes'; import getDBMonitorAlarmRoutes from '@views/monitor-alarm-db/routes'; import getPlatMonitorAlarmRoutes from '@views/monitor-alarm-plat/routes'; -import getMysqlRoutes from '@views/mysql/routes'; import getNotificationSettingRoutes from '@views/notification-setting/routes'; import getPasswordManageRoutes from '@views/password-manage/routes'; import getPlatformDbConfigureRoutes from '@views/platform-db-configure/routes'; -import getPulsarRoutes from '@views/pulsar-manage/routes'; import getQuickSearchRoutes from '@views/quick-search/routes'; -import getRedisRoutes from '@views/redis/routes'; import getResourceManageRoutes from '@views/resource-manage/routes'; -import getRiakManage from '@views/riak-manage/routes'; import getServiceApplyRoutes from '@views/service-apply/routes'; -import getSpiderManageRoutes from '@views/spider-manage/routes'; -import getSqlServerRouters from '@views/sqlserver-manage/routes'; import getStaffManageRoutes from '@views/staff-manage/routes'; import getTaskHistoryRoutes from '@views/task-history/routes'; import getTemporaryPasswordModify from '@views/temporary-paassword-modify/routes'; @@ -101,12 +88,7 @@ export default () => { bizPermission = true; } - const { funControllerData } = useFunController(); - const bigdataController = funControllerData.getFlatData('bigdata'); - const mongdbController = funControllerData.getFlatData('mongodb'); - - // getDbManageRoutes(); - + console.log('getDbManageRoutes = ', getDbManageRoutes()); const routes = [ { path: rootPath, @@ -128,30 +110,20 @@ export default () => { { path: `${rootPath}${currentBiz}`, children: [ + ...getDbManageRoutes(), ...getDbConfRoutes(), - ...getESRoutes(bigdataController), ...getDbhaSwitchEventsRouters(), - ...getHDFSRoutes(bigdataController), - ...getInfluxDBRoutes(bigdataController), ...getInspectionRoutes(), - ...getKafkaRoutes(bigdataController), ...getDBMonitorAlarmRoutes(), ...getPlatMonitorAlarmRoutes(), - ...getMysqlRoutes(funControllerData), ...getNotificationSettingRoutes(), - ...getPulsarRoutes(bigdataController), - ...getRedisRoutes(funControllerData), - ...getSpiderManageRoutes(funControllerData), ...getStaffManageRoutes(), ...getTaskHistoryRoutes(), ...getWhitelistRoutes(), ...getTicketManageRoutes(), ...getTemporaryPasswordModify(), - ...getRiakManage(bigdataController), ...getTicketFlowSettingBizRoutes(), ...getTicketFlowSettingGlobalRoutes(), - ...getMongoRoutes(mongdbController), - ...getSqlServerRouters(funControllerData), ], }, { diff --git a/dbm-ui/frontend/src/views/db-configure/routes.ts b/dbm-ui/frontend/src/views/db-configure/routes.ts index d437e16527..aff658b2bc 100644 --- a/dbm-ui/frontend/src/views/db-configure/routes.ts +++ b/dbm-ui/frontend/src/views/db-configure/routes.ts @@ -78,7 +78,7 @@ const routes: RouteRecordRaw[] = [ meta: { navName: t('新建模块'), }, - component: () => import('@views/spider-manage/apply/CreateModule.vue'), + component: () => import('@views/db-manage/tendb-cluster/apply/CreateModule.vue'), }, ], }, diff --git a/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/RenderBackupSource.vue b/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/RenderBackupSource.vue index 0f51b3ce24..a45f9b9b23 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/RenderBackupSource.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/RenderBackupSource.vue @@ -24,7 +24,7 @@ import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; - import TableEditSelect from '@views/mysql/common/edit/Select.vue'; + import TableEditSelect from '@views/db-manage/mysql/common/edit/Select.vue'; interface Props { modelValue: string; diff --git a/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/Row.vue b/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/Row.vue index 4ded730019..abad6aa68f 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/sql-execute/backup/RenderData/Row.vue @@ -60,8 +60,8 @@ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page1/components/RenderTargetCapacity.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page1/components/RenderTargetCapacity.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page1/components/RenderTargetCapacity.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page1/components/RenderTargetCapacity.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page1/components/Row.vue similarity index 97% rename from dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page1/components/Row.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page1/components/Row.vue index cb227b03fa..2b2031553a 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page1/components/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page1/components/Row.vue @@ -43,7 +43,7 @@ import OperateColumn from '@components/render-table/columns/operate-column/index.vue'; - import RenderTargetCluster from '@views/mongodb-manage/components/edit-field/ClusterName.vue'; + import RenderTargetCluster from '@views/db-manage/mongodb/components/edit-field/ClusterName.vue'; import { random } from '@utils'; diff --git a/dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page2/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page2/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/capacity-change/pages/page2/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/capacity-change/pages/page2/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/MongoConfigSpec.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/components/MongoConfigSpec.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/MongoConfigSpec.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/RelatedClusters.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/RelatedClusters.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/components/RelatedClusters.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/RelatedClusters.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/ClusterName.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/ClusterName.vue similarity index 77% rename from dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/ClusterName.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/ClusterName.vue index e7a65b221a..aaf2a18b15 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/ClusterName.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/ClusterName.vue @@ -43,15 +43,15 @@ interface Props { data?: string; - isShowBlur?: boolean, + isShowBlur?: boolean; } interface Emits { - (e: 'inputFinish', value: string): void + (e: 'inputFinish', value: string): void; } interface Exposes { - getValue: () => Promise + getValue: () => Promise; } const props = withDefaults(defineProps(), { @@ -76,19 +76,20 @@ message: t('目标集群不能为空'), }, { - validator: (value: string) => domainRegex.test(value), + validator: (value: string) => domainRegex.test(value), message: t('目标集群输入格式有误'), }, { - validator: (value: string) => getMongoList({ - exact_domain: value, - }).then((data) => { - if (data.results.length > 0) { - localClusterId.value = data.results[0].id; - return true; - } - return false; - }), + validator: (value: string) => + getMongoList({ + exact_domain: value, + }).then((data) => { + if (data.results.length > 0) { + localClusterId.value = data.results[0].id; + return true; + } + return false; + }), message: t('目标集群不存在'), }, { @@ -97,10 +98,13 @@ const otherClusterMemoMap = { ...clusterIdMemo }; delete otherClusterMemoMap[instanceKey]; - const otherClusterIdMap = Object.values(otherClusterMemoMap).reduce((result, item) => ({ - ...result, - ...item, - }), {} as Record); + const otherClusterIdMap = Object.values(otherClusterMemoMap).reduce( + (result, item) => ({ + ...result, + ...item, + }), + {} as Record, + ); const currentSelectClusterIdList = Object.keys(currentClusterSelectMap); for (let i = 0; i < currentSelectClusterIdList.length; i++) { if (otherClusterIdMap[currentSelectClusterIdList[i]]) { @@ -114,14 +118,18 @@ ]; // 获取关联集群 - watch(localClusterId, () => { - if (!localClusterId.value) { - return; - } - clusterIdMemo[instanceKey][localClusterId.value] = true; - }, { - immediate: true, - }); + watch( + localClusterId, + () => { + if (!localClusterId.value) { + return; + } + clusterIdMemo[instanceKey][localClusterId.value] = true; + }, + { + immediate: true, + }, + ); const handleInputFinish = (value: string) => { const realValue = _.trim(value); @@ -131,13 +139,11 @@ onBeforeUnmount(() => { clusterIdMemo[instanceKey] = {}; - }) + }); defineExpose({ getValue() { - return editRef.value - .getValue() - .then(() => (localClusterId.value)); + return editRef.value.getValue().then(() => localClusterId.value); }, }); diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/DbName.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/DbName.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/DbName.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/DbName.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/HostName.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/HostName.vue similarity index 96% rename from dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/HostName.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/HostName.vue index bc13d34929..74b6797f14 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/HostName.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/HostName.vue @@ -85,10 +85,13 @@ const otheHostMemoMap = { ...hostsMemo }; delete otheHostMemoMap[instanceKey]; - const otherHostMap = Object.values(otheHostMemoMap).reduce((result, item) => ({ - ...result, - ...item, - }), {} as Record); + const otherHostMap = Object.values(otheHostMemoMap).reduce( + (result, item) => ({ + ...result, + ...item, + }), + {} as Record, + ); const currentSelectHostList = Object.keys(currentHostSelectMap); for (let i = 0; i < currentSelectHostList.length; i++) { if (otherHostMap[currentSelectHostList[i]]) { @@ -121,7 +124,7 @@ onBeforeUnmount(() => { hostsMemo[instanceKey] = {}; - }) + }); defineExpose({ getValue() { diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/TableName.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/TableName.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/TableName.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/TableName.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/clusters-with-selector/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/clusters-with-selector/Index.vue similarity index 63% rename from dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/clusters-with-selector/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/clusters-with-selector/Index.vue index 7b7f55e3b3..a4305552c9 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/components/edit-field/clusters-with-selector/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/components/edit-field/clusters-with-selector/Index.vue @@ -36,28 +36,26 @@ import { ClusterTypes } from '@common/const'; import { domainRegex } from '@common/regex'; - import ClusterSelector, { - type TabItem, - } from '@components/cluster-selector/Index.vue'; + import ClusterSelector, { type TabItem } from '@components/cluster-selector/Index.vue'; import TableEditInput from './Input.vue'; interface Props { - clusterType: ClusterTypes, + clusterType: ClusterTypes; data?: string; } interface Emits { - (e: 'change', value: MongoDBModel[]): void + (e: 'change', value: MongoDBModel[]): void; } interface Exposes { - getValue: () => Promise + getValue: () => Promise; } const props = withDefaults(defineProps(), { data: '', - inputed: () => ([]), + inputed: () => [], }); const emits = defineEmits(); @@ -69,78 +67,85 @@ const editRef = ref(); const localClusterIds = ref([]); - const selectedClusters = shallowRef<{[key: string]: Array}>({ + const selectedClusters = shallowRef<{ [key: string]: Array }>({ [ClusterTypes.MONGO_REPLICA_SET]: [], [ClusterTypes.MONGO_SHARED_CLUSTER]: [], }); - const tabListConfig = computed(() => (props.clusterType === ClusterTypes.MONGO_REPLICA_SET ? { - [ClusterTypes.MONGO_REPLICA_SET]: { - name: t('副本集集群'), - multiple: true, - }, - } : { - [ClusterTypes.MONGO_SHARED_CLUSTER]: { - name: t('分片集群'), - multiple: false, - }, - }) as unknown as Record); + const tabListConfig = computed( + () => + (props.clusterType === ClusterTypes.MONGO_REPLICA_SET + ? { + [ClusterTypes.MONGO_REPLICA_SET]: { + name: t('副本集集群'), + multiple: true, + }, + } + : { + [ClusterTypes.MONGO_SHARED_CLUSTER]: { + name: t('分片集群'), + multiple: false, + }, + }) as unknown as Record, + ); const rules = [ { - validator: (value: string) => value.split(',').every(domain => Boolean(domain)), + validator: (value: string) => value.split(',').every((domain) => Boolean(domain)), message: t('目标集群不能为空'), }, { - validator: (value: string) => value.split(',').every(domain => domainRegex.test(domain)), + validator: (value: string) => value.split(',').every((domain) => domainRegex.test(domain)), message: t('目标集群输入格式有误'), }, { - validator: (value: string) => getMongoList({ - domains: value, - }).then((data) => { - if (data.results.length === value.split(',').length) { - localClusterIds.value = data.results.map(item => item.id); - return true; - } - return false; - }), + validator: (value: string) => + getMongoList({ + domains: value, + }).then((data) => { + if (data.results.length === value.split(',').length) { + localClusterIds.value = data.results.map((item) => item.id); + return true; + } + return false; + }), message: t('目标集群不存在'), }, ]; - watch(() => props.data, (data) => { - localValue.value = data; - }, { - immediate: true, - }); + watch( + () => props.data, + (data) => { + localValue.value = data; + }, + { + immediate: true, + }, + ); const handleOpenSeletor = () => { isShowSelector.value = true; }; // 批量选择 - const handelClusterChange = (selected: {[key: string]: MongoDBModel[] }) => { + const handelClusterChange = (selected: { [key: string]: MongoDBModel[] }) => { selectedClusters.value = selected; const list = selected[props.clusterType]; - localValue.value = list.map(item => item.master_domain).join(','); + localValue.value = list.map((item) => item.master_domain).join(','); emits('change', list); window.changeConfirm = true; }; defineExpose({ getValue() { - return editRef.value - .getValue() - .then(() => (localClusterIds.value)); + return editRef.value.getValue().then(() => localClusterIds.value); }, }); - diff --git a/dbm-ui/frontend/src/views/mongodb-manage/db-structure/pages/page1/components/RenderTargetSpec.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/db-structure/pages/page1/components/RenderTargetSpec.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/RenderTargetSpec.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/db-structure/pages/page1/components/render-db-table/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/render-db-table/Index.vue similarity index 93% rename from dbm-ui/frontend/src/views/mongodb-manage/db-structure/pages/page1/components/render-db-table/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/render-db-table/Index.vue index 93f9153d0b..c8a0fd569a 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/db-structure/pages/page1/components/render-db-table/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/db-structure/pages/page1/components/render-db-table/Index.vue @@ -59,13 +59,10 @@ import RenderTableHeadColumn from '@components/render-table/HeadColumn.vue'; import RenderTable from '@components/render-table/Index.vue'; - import RenderDataRow, { - createRowData, - type IDataRow, - } from './Row.vue'; + import RenderDataRow, { createRowData, type IDataRow } from './Row.vue'; interface Exposes { - getValue: () => any + getValue: () => any; } const { t } = useI18n(); @@ -76,12 +73,10 @@ defineExpose({ async getValue() { - const infos = await Promise.all(rowRefs.value.map((item: { - getValue: () => Promise - }) => item.getValue())); + const infos = await Promise.all(rowRefs.value.map((item: { getValue: () => Promise }) => item.getValue())); return infos[0]; - } }); - + }, + }); diff --git a/dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/detail/index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/detail/index.vue similarity index 70% rename from dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/detail/index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/detail/index.vue index b3f094a79a..8eaeeb1480 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/detail/index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/detail/index.vue @@ -35,9 +35,9 @@ interface Props { instanceData: { - instanceAddress: string, - clusterId: number, - }, + instanceAddress: string; + clusterId: number; + }; } const props = defineProps(); @@ -54,31 +54,35 @@ manual: true, }); - watch(() => props.instanceData, () => { - fetchInstDetails({ - instance_address: props.instanceData.instanceAddress, - cluster_id: props.instanceData.clusterId, - }); - }, { - immediate: true, - }); + watch( + () => props.instanceData, + () => { + fetchInstDetails({ + instance_address: props.instanceData.instanceAddress, + cluster_id: props.instanceData.clusterId, + }); + }, + { + immediate: true, + }, + ); diff --git a/dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/index.vue similarity index 75% rename from dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/index.vue index 87f5610c9a..7c02d46f93 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/index.vue @@ -3,8 +3,7 @@ :min-left-width="368" name="instanceViewList"> - - + diff --git a/dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/list/index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/list/index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/mongodb-instance/list/index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/mongodb-instance/list/index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/common/consts.ts b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/common/consts.ts similarity index 78% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/common/consts.ts rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/common/consts.ts index 339f21a04b..641f843985 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/permission/common/consts.ts +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/common/consts.ts @@ -9,18 +9,13 @@ * 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. -*/ + */ /** * 操作类型 */ export const dbOperations = { - mongo_user: [ - 'Read', - 'readWrite', - 'readAnyDatabase', - 'readWriteAnyDatabase', - ], + mongo_user: ['Read', 'readWrite', 'readAnyDatabase', 'readWriteAnyDatabase'], mongo_manager: [ 'dbAdmin', 'backup', @@ -36,11 +31,31 @@ export const dbOperations = { 'root', ], dml: ['select', 'insert', 'update', 'delete', 'show view'], - ddl: ['create', 'alter', 'drop', 'index', 'create view', 'execute', 'trigger', 'event', 'create routine', 'alter routine', 'references', 'create temporary tables'], + ddl: [ + 'create', + 'alter', + 'drop', + 'index', + 'create view', + 'execute', + 'trigger', + 'event', + 'create routine', + 'alter routine', + 'references', + 'create temporary tables', + ], glob: ['file', 'reload', 'show databases', 'process', 'replication slave', 'replication client'], }; -export const ddlSensitiveWords = ['trigger', 'event', 'create routine', 'alter routine', 'references', 'create temporary tables']; +export const ddlSensitiveWords = [ + 'trigger', + 'event', + 'create routine', + 'alter routine', + 'references', + 'create temporary tables', +]; /** * 密码策略 diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/components/AccountInfoDialog.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/AccountInfoDialog.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/components/AccountInfoDialog.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/AccountInfoDialog.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/components/CreateAccountDialog.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/CreateAccountDialog.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/components/CreateAccountDialog.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/CreateAccountDialog.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/components/CreateRule.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/CreateRule.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/components/CreateRule.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/components/CreateRule.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/permission/hooks/useDeleteAccount.ts b/dbm-ui/frontend/src/views/db-manage/mongodb/permission/hooks/useDeleteAccount.ts similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/permission/hooks/useDeleteAccount.ts rename to dbm-ui/frontend/src/views/db-manage/mongodb/permission/hooks/useDeleteAccount.ts diff --git a/dbm-ui/frontend/src/views/redis/cluster-type-update/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/redis/cluster-type-update/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/RenderIpSelect.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/RenderIpSelect.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/RenderIpSelect.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/RenderIpSelect.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/RenderTargetNumber.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/RenderTargetNumber.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/RenderTargetNumber.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/RenderTargetNumber.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/Row.vue similarity index 97% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/Row.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/Row.vue index 26f6654542..079945ccb9 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page1/components/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page1/components/Row.vue @@ -57,7 +57,7 @@ import type { SpecInfo } from '@components/render-table/columns/spec-display/Panel.vue'; import RenderText from '@components/render-table/columns/text-plain/index.vue'; - import RenderTargetCluster from '@views/mongodb-manage/components/edit-field/ClusterName.vue'; + import RenderTargetCluster from '@views/db-manage/mongodb/components/edit-field/ClusterName.vue'; import { random } from '@utils'; diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page2/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page2/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-down/pages/page2/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-down/pages/page2/Index.vue diff --git a/dbm-ui/frontend/src/views/redis/db-create-slave/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/redis/db-create-slave/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue similarity index 84% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue index 3d4759ce1e..d67b39dcf9 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/Index.vue @@ -80,14 +80,10 @@ import ClusterSelector from '@components/cluster-selector/Index.vue'; - import type { IListItem } from '@views/mongodb-manage/components/edit-field/spec-select/components/Select.vue'; + import type { IListItem } from '@views/db-manage/mongodb/components/edit-field/spec-select/components/Select.vue'; import RenderData from './components/Index.vue'; - import RenderDataRow, { - createRowData, - type IDataRow, - type InfoItem, - } from './components/Row.vue'; + import RenderDataRow, { createRowData, type IDataRow, type InfoItem } from './components/Row.vue'; const { currentBizId } = useGlobalBizs(); const { t } = useI18n(); @@ -95,17 +91,17 @@ const rowRefs = ref(); const isShowMasterInstanceSelector = ref(false); - const isSubmitting = ref(false); + const isSubmitting = ref(false); const tableData = ref([createRowData()]); const specList = ref([]); const bkCloudId = ref(); - const selectedClusters = shallowRef<{[key: string]: Array}>({ + const selectedClusters = shallowRef<{ [key: string]: Array }>({ [ClusterTypes.MONGO_SHARED_CLUSTER]: [], }); - const totalNum = computed(() => tableData.value.filter(item => Boolean(item.clusterName)).length); - const inputedClusters = computed(() => tableData.value.map(item => item.clusterName)); + const totalNum = computed(() => tableData.value.filter((item) => Boolean(item.clusterName)).length); + const inputedClusters = computed(() => tableData.value.map((item) => item.clusterName)); const { run: fetchSpecResourceCount } = useRequest(getSpecResourceCount, { manual: true, @@ -119,14 +115,16 @@ }); useRequest(getResourceSpecList, { - defaultParams: [{ - spec_cluster_type: 'MongoShardedCluster', - spec_machine_type: 'mongos', - limit: -1, - offset: 0, - }], + defaultParams: [ + { + spec_cluster_type: 'MongoShardedCluster', + spec_machine_type: 'mongos', + limit: -1, + offset: 0, + }, + ], onSuccess(data) { - specList.value = data.results.map(item => ({ + specList.value = data.results.map((item) => ({ value: item.spec_id, label: item.spec_name, specData: { @@ -142,14 +140,14 @@ }); // 集群域名是否已存在表格的映射表 - let domainMemo:Record = {}; + let domainMemo: Record = {}; watch(bkCloudId, () => { if (bkCloudId.value !== undefined) { fetchSpecResourceCount({ bk_biz_id: currentBizId, bk_cloud_id: bkCloudId.value, - spec_ids: specList.value.map(item => item.specData.id), + spec_ids: specList.value.map((item) => item.specData.id), }); } }); @@ -184,7 +182,7 @@ }); // 批量选择 - const handelClusterChange = (selected: {[key: string]: Array}) => { + const handelClusterChange = (selected: { [key: string]: Array }) => { selectedClusters.value = selected; const list = selected[ClusterTypes.MONGO_SHARED_CLUSTER]; if (bkCloudId.value === undefined) { @@ -240,14 +238,16 @@ tableData.value.splice(index, 1); delete domainMemo[clusterName]; const clustersArr = selectedClusters.value[ClusterTypes.MONGO_SHARED_CLUSTER]; - selectedClusters.value[ClusterTypes.MONGO_SHARED_CLUSTER] = clustersArr.filter(item => item.master_domain !== clusterName); + selectedClusters.value[ClusterTypes.MONGO_SHARED_CLUSTER] = clustersArr.filter( + (item) => item.master_domain !== clusterName, + ); }; // 点击提交按钮 const handleSubmit = async () => { - const infos = await Promise.all(rowRefs.value.map((item: { - getValue: () => Promise - }) => item.getValue())); + const infos = await Promise.all( + rowRefs.value.map((item: { getValue: () => Promise }) => item.getValue()), + ); const params = { bk_biz_id: currentBizId, @@ -262,22 +262,24 @@ width: 400, onConfirm: () => { isSubmitting.value = true; - createTicket(params).then((data) => { - window.changeConfirm = false; - router.push({ - name: 'MongoProxyScaleUp', - params: { - page: 'success', - }, - query: { - ticketId: data.id, - }, - }); - }) + createTicket(params) + .then((data) => { + window.changeConfirm = false; + router.push({ + name: 'MongoProxyScaleUp', + params: { + page: 'success', + }, + query: { + ticketId: data.id, + }, + }); + }) .finally(() => { isSubmitting.value = false; }); - } }); + }, + }); }; const handleReset = () => { diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/RenderTargetNumber.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/RenderTargetNumber.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/RenderTargetNumber.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/RenderTargetNumber.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/Row.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/Row.vue similarity index 89% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/Row.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/Row.vue index a2fa22609a..6f017c93ed 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page1/components/Row.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page1/components/Row.vue @@ -47,10 +47,10 @@ import OperateColumn from '@components/render-table/columns/operate-column/index.vue'; import RenderText from '@components/render-table/columns/text-plain/index.vue'; - import RenderTargetCluster from '@views/mongodb-manage/components/edit-field/ClusterName.vue'; - import type { SpecInfo } from '@views/mongodb-manage/components/edit-field/spec-select/components/Panel.vue'; - import type { IListItem } from '@views/mongodb-manage/components/edit-field/spec-select/components/Select.vue'; - import RenderTargetSpec from '@views/mongodb-manage/components/edit-field/spec-select/Index.vue'; + import RenderTargetCluster from '@views/db-manage/mongodb/components/edit-field/ClusterName.vue'; + import type { SpecInfo } from '@views/db-manage/mongodb/components/edit-field/spec-select/components/Panel.vue'; + import type { IListItem } from '@views/db-manage/mongodb/components/edit-field/spec-select/components/Select.vue'; + import RenderTargetSpec from '@views/db-manage/mongodb/components/edit-field/spec-select/Index.vue'; import { random } from '@utils'; diff --git a/dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page2/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page2/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/proxy-scale-up/pages/page2/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/proxy-scale-up/pages/page2/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterIdBatchEdit.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterIdBatchEdit.vue similarity index 73% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterIdBatchEdit.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterIdBatchEdit.vue index 0dc8d1a92f..c4536f5f76 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterIdBatchEdit.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterIdBatchEdit.vue @@ -23,7 +23,7 @@ class="ml-4" text theme="primary" - @click="() => popoverShow = true"> + @click="() => (popoverShow = true)"> @@ -73,7 +73,7 @@ import { nameRegx } from '@common/regex'; interface Emits { - (e: 'change', value: string[]): void + (e: 'change', value: string[]): void; } const emits = defineEmits(); @@ -108,21 +108,24 @@ } }); - watch(() => clusterId.value, (value) => { - value && handleValidate(); - }); + watch( + () => clusterId.value, + (value) => { + value && handleValidate(); + }, + ); const handleValidate = () => { const newClusterIds = clusterId.value.split('\n'); // 校验最大长度 - const maxlengthRes = newClusterIds.every(key => key.length <= 63); + const maxlengthRes = newClusterIds.every((key) => key.length <= 63); if (maxlengthRes === false) { errorText.value = errorTextMap.maxlength; errorShow.value = true; return false; } // 校验格式 - const validate = newClusterIds.every(key => nameRegx.test(key)); + const validate = newClusterIds.every((key) => nameRegx.test(key)); if (!validate) { errorText.value = errorTextMap.rule; errorShow.value = !validate; @@ -152,73 +155,72 @@ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterNameBatchEdit.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterNameBatchEdit.vue similarity index 72% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterNameBatchEdit.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterNameBatchEdit.vue index 31cbe7fb68..e0148c7589 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/ClusterNameBatchEdit.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/ClusterNameBatchEdit.vue @@ -23,7 +23,7 @@ class="ml-4" text theme="primary" - @click="() => popoverShow = true"> + @click="() => (popoverShow = true)"> @@ -71,7 +71,7 @@ import { useI18n } from 'vue-i18n'; interface Emits { - (e: 'change', value: string[]): void + (e: 'change', value: string[]): void; } const emits = defineEmits(); @@ -105,14 +105,17 @@ } }); - watch(() => value.value, (value) => { - value && handleValidate(); - }); + watch( + () => value.value, + (value) => { + value && handleValidate(); + }, + ); const handleValidate = () => { const newClusterNames = value.value.split('\n'); // 最大长度 - const maxlengthRes = newClusterNames.every(key => key.length <= 63); + const maxlengthRes = newClusterNames.every((key) => key.length <= 63); if (maxlengthRes === false) { errorText.value = errorTextMap.maxlength; errorShow.value = true; @@ -142,72 +145,72 @@ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/DomainTable.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/DomainTable.vue similarity index 94% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/DomainTable.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/DomainTable.vue index 091d29b04b..c919f1e78b 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-apply/components/DomainTable.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-apply/components/DomainTable.vue @@ -249,33 +249,33 @@ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/Index.vue similarity index 99% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/Index.vue index 0cf97d0145..29e3fb9fff 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/Index.vue @@ -36,4 +36,3 @@ const clusterId = ref(0); - diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/BaseInfo.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/BaseInfo.vue similarity index 90% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/BaseInfo.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/BaseInfo.vue index 1acb754f77..e641bf3437 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/BaseInfo.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/BaseInfo.vue @@ -23,12 +23,10 @@ import MongodbDetailModel from '@services/model/mongodb/mongodb-detail'; - import EditInfo, { - type InfoColumn, - } from '@components/editable-info/index.vue'; + import EditInfo, { type InfoColumn } from '@components/editable-info/index.vue'; interface Props { - data: MongodbDetailModel + data: MongodbDetailModel; } const props = defineProps(); @@ -66,7 +64,7 @@ { label: t('节点'), key: 'node', - render: () => props.data.mongodb.map(item => item.instance).join(','), + render: () => props.data.mongodb.map((item) => item.instance).join(','), }, { label: t('创建人'), diff --git a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/Index.vue similarity index 80% rename from dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/Index.vue index bca60ee9d2..76e0393239 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/replica-set-list/components/detail/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/replica-set-list/components/detail/Index.vue @@ -29,10 +29,9 @@ @click="handleCopyMasterDomainDisplayName"> {{ t('复制访问地址') }} - + @@ -53,7 +52,7 @@
([]); + const monitorPanelList = ref< + { + label: string; + name: string; + link: string; + }[] + >([]); - const activePanel = computed(() => monitorPanelList.value.find(item => item.name === activePanelKey.value)); + const activePanel = computed(() => monitorPanelList.value.find((item) => item.name === activePanelKey.value)); const { data, @@ -154,7 +149,7 @@ manual: true, onSuccess(res) { if (res.urls.length > 0) { - monitorPanelList.value = res.urls.map(item => ({ + monitorPanelList.value = res.urls.map((item) => ({ label: item.view, name: item.view, link: item.url, @@ -163,21 +158,25 @@ }, }); - watch(() => props.clusterId, () => { - if (!props.clusterId) { - return; - } - fetchResourceDetails({ - cluster_id: props.clusterId, - }); - runGetMonitorUrls({ - bk_biz_id: currentBizId, - cluster_type: ClusterTypes.MONGO_REPLICA_SET, - cluster_id: props.clusterId, - }); - }, { - immediate: true, - }); + watch( + () => props.clusterId, + () => { + if (!props.clusterId) { + return; + } + fetchResourceDetails({ + cluster_id: props.clusterId, + }); + runGetMonitorUrls({ + bk_biz_id: currentBizId, + cluster_type: ClusterTypes.MONGO_REPLICA_SET, + cluster_id: props.clusterId, + }); + }, + { + immediate: true, + }, + ); const handleCopyMasterDomainDisplayName = () => { copy(data.value!.masterDomainDisplayName); @@ -189,29 +188,29 @@ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/shared-cluster-list/components/list/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-list/components/list/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/shared-cluster-list/components/list/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-list/components/list/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/shared-cluster-list/hooks/useDisableCluster.tsx b/dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-list/hooks/useDisableCluster.tsx similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/shared-cluster-list/hooks/useDisableCluster.tsx rename to dbm-ui/frontend/src/views/db-manage/mongodb/shared-cluster-list/hooks/useDisableCluster.tsx diff --git a/dbm-ui/frontend/src/views/mongodb-manage/structure-instance/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/structure-instance/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mongodb-manage/structure-instance/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/structure-instance/Index.vue diff --git a/dbm-ui/frontend/src/views/mongodb-manage/toolbox-menu.ts b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts similarity index 98% rename from dbm-ui/frontend/src/views/mongodb-manage/toolbox-menu.ts rename to dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts index a80042ddac..f99af49ae0 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/toolbox-menu.ts +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox-menu.ts @@ -9,13 +9,13 @@ * 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 interface MenuChild { - name: string, - id: string, - parentId: string + name: string; + id: string; + parentId: string; } export default [ diff --git a/dbm-ui/frontend/src/views/mongodb-manage/toolbox/Index.vue b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox/Index.vue similarity index 70% rename from dbm-ui/frontend/src/views/mongodb-manage/toolbox/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mongodb/toolbox/Index.vue index 198c55c201..7afdde0f87 100644 --- a/dbm-ui/frontend/src/views/mongodb-manage/toolbox/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mongodb/toolbox/Index.vue @@ -24,7 +24,7 @@ diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderNewSlave.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderNewSlave.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderNewSlave.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderNewSlave.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderOldSlave.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderOldSlave.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderOldSlave.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/RenderOldSlave.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/Row.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/Row.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/Row.vue diff --git a/dbm-ui/frontend/src/views/spider-manage/add-mnt/pages/page1/components/RenderData/useValidtor.ts b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/useValidtor.ts similarity index 57% rename from dbm-ui/frontend/src/views/spider-manage/add-mnt/pages/page1/components/RenderData/useValidtor.ts rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/useValidtor.ts index 009fabe999..f48fb40d63 100644 --- a/dbm-ui/frontend/src/views/spider-manage/add-mnt/pages/page1/components/RenderData/useValidtor.ts +++ b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/new-host/components/RenderData/useValidtor.ts @@ -9,17 +9,14 @@ * 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 { - reactive, - toRefs, -} from 'vue'; +import { reactive, toRefs } from 'vue'; export type Rules = Array<{ - validator: (value: any) => boolean | Promise, - message: string | (() => string) -}> + validator: (value: any) => boolean | Promise; + message: string | (() => string); +}>; const getRuleMessage = (rule: Rules[0]) => { if (typeof rule.message === 'function') { @@ -28,7 +25,7 @@ const getRuleMessage = (rule: Rules[0]) => { return rule.message; }; -export default function (rules: Rules|undefined) { +export default function (rules: Rules | undefined) { const state = reactive({ loading: false, error: false, @@ -36,8 +33,7 @@ export default function (rules: Rules|undefined) { }); const validator = (targetValue: any) => { - state.error = false, - state.message = ''; + (state.error = false), (state.message = ''); if (!rules) { return Promise.resolve(true); } @@ -49,34 +45,37 @@ export default function (rules: Rules|undefined) { return Promise.resolve(true); } const rule = rules[stepIndex]; - return Promise.resolve() - .then(() => { - const result = rule.validator(targetValue); - // 异步验证 - if (typeof result !== 'boolean' - && typeof result.then === 'function') { - return result.then((data: boolean) => { - // 异步验证结果为 false + return Promise.resolve().then(() => { + const result = rule.validator(targetValue); + // 异步验证 + if (typeof result !== 'boolean' && typeof result.then === 'function') { + return result + .then((data: boolean) => { + // 异步验证结果为 false if (data === false) { return Promise.reject(getRuleMessage(rule)); } - }).then(() => run(), () => { - state.error = true; - const message = getRuleMessage(rule); - state.message = message; - return Promise.reject(message); - }); - } - // 验证失败 - if (!result) { - state.error = true; - const message = getRuleMessage(rule); - state.message = message; - return Promise.reject(message); - } - // 下一步 - return run(); - }); + }) + .then( + () => run(), + () => { + state.error = true; + const message = getRuleMessage(rule); + state.message = message; + return Promise.reject(message); + }, + ); + } + // 验证失败 + if (!result) { + state.error = true; + const message = getRuleMessage(rule); + state.message = message; + return Promise.reject(message); + } + // 下一步 + return run(); + }); }; })(); diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/Index.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Index.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Index.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue similarity index 96% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue index bfe07d291d..fb2453b90b 100644 --- a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderCluster.vue @@ -29,7 +29,7 @@ import { useGlobalBizs } from '@stores'; - import TableEditInput from '@views/spider-manage/common/edit/Input.vue'; + import TableEditInput from '@views/db-manage/tendb-cluster/common/edit/Input.vue'; import type { IDataRow } from './Row.vue'; diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderSlave.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderSlave.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderSlave.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/RenderSlave.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Row.vue similarity index 100% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Row.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page1/components/original-host/components/RenderData/Row.vue diff --git a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page2/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page2/Index.vue similarity index 90% rename from dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page2/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page2/Index.vue index 0d0fec93ea..69b88ce81a 100644 --- a/dbm-ui/frontend/src/views/mysql/slave-rebuild/pages/page2/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/slave-rebuild/pages/page2/Index.vue @@ -14,7 +14,7 @@