diff --git a/dbm-ui/frontend/src/components/popover-copy/Index.vue b/dbm-ui/frontend/src/components/popover-copy/Index.vue new file mode 100644 index 0000000000..f5f33bbf1c --- /dev/null +++ b/dbm-ui/frontend/src/components/popover-copy/Index.vue @@ -0,0 +1,114 @@ + + + + + + + diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index deff44f091..1834efff1e 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3931,5 +3931,8 @@ "该规格已被使用,不允许修改": "该规格已被使用,不允许修改", "目标": "目标", "免审批": "免审批", + "复制域名:端口": "复制域名:端口", + "复制成功n个域名": "复制成功 {n} 个域名", + "复制成功n个域名:端口": "复制成功 {n} 个域名:端口", "这行勿动!新增翻译请在上一行添加!": "" } diff --git a/dbm-ui/frontend/src/services/model/mysql/tendbha.ts b/dbm-ui/frontend/src/services/model/mysql/tendbha.ts index 91173b5d97..56b2132c80 100644 --- a/dbm-ui/frontend/src/services/model/mysql/tendbha.ts +++ b/dbm-ui/frontend/src/services/model/mysql/tendbha.ts @@ -205,19 +205,14 @@ export default class Tendbha extends ClusterBase { return displayName; } - get slaveDomainDisplayName() { - const port = this.slaves[0]?.port; - const displayName = port ? `${this.slave_domain}:${port}` : this.slave_domain; - return this.slave_domain ? displayName : '--'; - } - get slaveEntryList() { - return this.cluster_entry.filter((item) => item.role === 'slave_entry').map((item) => item.entry); - } - - get slaveEntryDisplayList() { const port = this.slaves[0]?.port; - return this.slaveEntryList.map((item) => `${item}:${port}`); + return this.cluster_entry + .filter((item) => item.role === 'slave_entry') + .map((item) => ({ + ...item, + port, + })); } get operationTagTips() { diff --git a/dbm-ui/frontend/src/services/model/redis/redis.ts b/dbm-ui/frontend/src/services/model/redis/redis.ts index 7bb3fe9742..33d7724c1a 100644 --- a/dbm-ui/frontend/src/services/model/redis/redis.ts +++ b/dbm-ui/frontend/src/services/model/redis/redis.ts @@ -209,10 +209,14 @@ export default class Redis extends ClusterBase { return displayName; } - get slaveDomainDisplayName() { - const port = this.cluster_access_port; - const displayName = port ? `${this.slave_domain}:${port}` : this.slave_domain; - return this.slave_domain ? displayName : '--'; + get slaveEntryList() { + const port = this.redis_slave[0]?.port; + return this.cluster_entry + .filter((item) => item.role === 'slave_entry') + .map((item) => ({ + ...item, + port, + })); } get isOnlineCLB() { diff --git a/dbm-ui/frontend/src/services/model/sqlserver/sqlserver-ha.ts b/dbm-ui/frontend/src/services/model/sqlserver/sqlserver-ha.ts index 9704773ee3..e35fa7dc32 100644 --- a/dbm-ui/frontend/src/services/model/sqlserver/sqlserver-ha.ts +++ b/dbm-ui/frontend/src/services/model/sqlserver/sqlserver-ha.ts @@ -135,10 +135,14 @@ export default class SqlServerHaCluster extends ClusterBase { return displayName; } - get slaveDomainDisplayName() { + get slaveEntryList() { const port = this.slaves[0]?.port; - const displayName = port ? `${this.slave_domain}:${port}` : this.slave_domain; - return this.slave_domain ? displayName : '--'; + return this.cluster_entry + .filter((item) => item.role === 'slave_entry') + .map((item) => ({ + ...item, + port, + })); } get allInstanceList() { diff --git a/dbm-ui/frontend/src/services/model/tendbcluster/tendbcluster.ts b/dbm-ui/frontend/src/services/model/tendbcluster/tendbcluster.ts index aca9d4306c..fe7e365ab8 100644 --- a/dbm-ui/frontend/src/services/model/tendbcluster/tendbcluster.ts +++ b/dbm-ui/frontend/src/services/model/tendbcluster/tendbcluster.ts @@ -238,10 +238,14 @@ export default class TendbCluster extends ClusterBase { return displayName; } - get slaveDomainDisplayName() { + get slaveEntryList() { const port = this.spider_slave[0]?.port; - const displayName = port ? `${this.slave_domain}:${port}` : this.slave_domain; - return this.slave_domain ? displayName : '--'; + return this.cluster_entry + .filter((item) => item.role === 'slave_entry') + .map((item) => ({ + ...item, + port, + })); } get operationTagTips() { diff --git a/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/MasterDomainColumn.vue b/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/MasterDomainColumn.vue index a49f2ec828..730c832367 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/MasterDomainColumn.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/MasterDomainColumn.vue @@ -25,60 +25,56 @@ @@ -90,13 +86,15 @@ import { clusterTypeInfos, ClusterTypes, DBTypes } from '@common/const'; import DbTable from '@components/db-table/index.vue'; + import PopoverCopy from '@components/popover-copy/Index.vue'; import TextOverflowLayout from '@components/text-overflow-layout/Index.vue'; import EditEntryConfig from '@views/db-manage/common/cluster-entry-config/Index.vue'; - import RenderCellCopy from '@views/db-manage/common/render-cell-copy/Index.vue'; import RenderHeadCopy from '@views/db-manage/common/render-head-copy/Index.vue'; import RenderOperationTag from '@views/db-manage/common/RenderOperationTagNew.vue'; + import { execCopy } from '@utils'; + import useColumnCopy from './hooks/useColumnCopy'; import type { ClusterModel, ISupportClusterType } from './types'; @@ -165,12 +163,23 @@ const columnMinWidth = window.innerWidth < 1366 ? 180 : 280; + const isToolsShow = ref(false); const viewActionId = computed(() => viewActionIdMap[props.clusterType]); const accessEntryDbConsole = computed(() => dbConsoleMap[props.clusterType]); const { handleCopySelected, handleCopyAll } = useColumnCopy(props); + const handleToolsShow = () => { + setTimeout(() => { + isToolsShow.value = true; + }, 1000); + }; + + const handleCopy = (data: string) => { + execCopy(data, t('复制成功')); + }; + const handleToDetails = (id: number) => { emits('go-detail', id); }; diff --git a/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/SlaveDomainColumn.vue b/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/SlaveDomainColumn.vue index 0ee18329b9..a1474efb77 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/SlaveDomainColumn.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/cluster-table-column/SlaveDomainColumn.vue @@ -10,11 +10,11 @@