diff --git a/dbm-ui/frontend/src/components/render-table/columns/DateTime.vue b/dbm-ui/frontend/src/components/render-table/columns/DateTime.vue index e9b4659213..1477979e97 100644 --- a/dbm-ui/frontend/src/components/render-table/columns/DateTime.vue +++ b/dbm-ui/frontend/src/components/render-table/columns/DateTime.vue @@ -98,7 +98,6 @@ const handleChange = (value: Required['modelValue']) => { localValue.value = value; - console.log('handleChange', value); validator(localValue.value).then(() => { window.changeConfirm = true; emits('update:modelValue', localValue.value); diff --git a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/tendbcluster/rollback.ts b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/tendbcluster/rollback.ts index fd0c8510b3..b03a86ae1f 100644 --- a/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/tendbcluster/rollback.ts +++ b/dbm-ui/frontend/src/hooks/useTicketCloneInfo/generateCloneData/tendbcluster/rollback.ts @@ -10,13 +10,13 @@ * 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 type { MySQLRollbackDetails } from '@services/model/ticket/details/mysql'; +import type { SpiderRollbackDetails } from '@services/model/ticket/details/spider'; import TicketModel from '@services/model/ticket/ticket'; import { random } from '@utils'; // Spider 定点构造 -export function generateSpiderRollbackCloneData(ticketData: TicketModel) { +export function generateSpiderRollbackCloneData(ticketData: TicketModel) { const { clusters, infos, rollback_cluster_type } = ticketData.details; const tableDataList = infos.map((item) => ({ rowKey: random(), diff --git a/dbm-ui/frontend/src/locales/zh-cn.json b/dbm-ui/frontend/src/locales/zh-cn.json index 511f279a8e..82e01650b9 100644 --- a/dbm-ui/frontend/src/locales/zh-cn.json +++ b/dbm-ui/frontend/src/locales/zh-cn.json @@ -3418,6 +3418,8 @@ "包含通配符时, 每一单元格只允许输入单个对象。% 不能独立使用, * 只能单独使用": "包含通配符时, 每一单元格只允许输入单个对象。% 不能独立使用, * 只能单独使用", "查看域名/IP对应关系": "查看域名/IP对应关系", "确认继续所有人工确认节点": "确认继续所有人工确认节点", + "请先选择待回档集群": "请先选择待回档集群", + "请先添加待回档集群": "请先添加待回档集群", "任务": "任务", "Redis版本": "Redis版本", "当前分片数": "当前分片数", diff --git a/dbm-ui/frontend/src/services/model/ticket/details/mysql.ts b/dbm-ui/frontend/src/services/model/ticket/details/mysql.ts index 5ab3593414..ad84fa6139 100644 --- a/dbm-ui/frontend/src/services/model/ticket/details/mysql.ts +++ b/dbm-ui/frontend/src/services/model/ticket/details/mysql.ts @@ -458,6 +458,16 @@ export enum RollbackClusterTypes { BUILD_INTO_METACLUSTER = 'BUILD_INTO_METACLUSTER', } +/** + * MySql 定点回档主机信息 + */ +export interface RollbackHost { + bk_biz_id: number; + bk_cloud_id: number; + bk_host_id: number; + ip: string; +} + /** * MySql 定点回档 */ @@ -470,16 +480,9 @@ export interface MySQLRollbackDetails extends DetailBase { databases_ignore: string[]; tables: string[]; tables_ignore: string[]; - rollback_host: - | { - bk_biz_id: number; - bk_cloud_id: number; - bk_host_id: number; - ip: string; - } - | boolean; - target_cluster_id: number | boolean; - rollback_type?: string; + rollback_host: RollbackHost; + target_cluster_id: number; + rollback_type: string; rollback_time: string; backupinfo: { backup_id: string; diff --git a/dbm-ui/frontend/src/services/model/ticket/details/spider.ts b/dbm-ui/frontend/src/services/model/ticket/details/spider.ts index a2cdb708a3..7740983584 100644 --- a/dbm-ui/frontend/src/services/model/ticket/details/spider.ts +++ b/dbm-ui/frontend/src/services/model/ticket/details/spider.ts @@ -14,6 +14,7 @@ import ClusterSpecModel from '@services/model/resource-spec/cluster-sepc'; import type { DetailClusters, DetailSpecs, SpecInfo } from './common'; +import type { RollbackClusterTypes } from './mysql'; // spider 部署 export interface SpiderApplyDetails { @@ -245,25 +246,29 @@ export interface SpiderNodeRebalanceDetails { // spider 定点回档 export interface SpiderRollbackDetails { - cluster_id: number; clusters: DetailClusters; - rollback_type: 'REMOTE_AND_BACKUPID' | 'REMOTE_AND_TIME'; - rollback_time: string; - backupinfo: { - backup_begin_time: string; - backup_end_time: string; - backup_id: string; - backup_time: string; - bill_id: string; - bk_biz_id: number; - bk_cloud_id: number; - cluster_address: string; + infos: { cluster_id: number; - }; - databases: string[]; - tables: string[]; - databases_ignore: string[]; - tables_ignore: string[]; + target_cluster_id: number; + rollback_type: 'REMOTE_AND_BACKUPID' | 'REMOTE_AND_TIME'; + rollback_time: string; + backupinfo: { + backup_begin_time: string; + backup_end_time: string; + backup_id: string; + backup_time: string; + bill_id: string; + bk_biz_id: number; + bk_cloud_id: number; + cluster_address: string; + cluster_id: number; + }; + databases: string[]; + tables: string[]; + databases_ignore: string[]; + tables_ignore: string[]; + }[]; + rollback_cluster_type: RollbackClusterTypes; } // Spider flashback diff --git a/dbm-ui/frontend/src/services/source/fixpointRollback.ts b/dbm-ui/frontend/src/services/source/fixpointRollback.ts index 7706d8c611..a3f5e74b66 100644 --- a/dbm-ui/frontend/src/services/source/fixpointRollback.ts +++ b/dbm-ui/frontend/src/services/source/fixpointRollback.ts @@ -118,9 +118,5 @@ export function queryLatesBackupLog(params: { rollback_time: string; job_instance_id?: number; }) { - return http.get<{ - backup_logs: Array; - job_status: string; - message: string; - }>(`${path}/query_latest_backup_log/`, params); + return http.get(`${path}/query_latest_backup_log/`, params); } diff --git a/dbm-ui/frontend/src/types/auto-imports.d.ts b/dbm-ui/frontend/src/types/auto-imports.d.ts index d0c217f6f1..7021ac5101 100644 --- a/dbm-ui/frontend/src/types/auto-imports.d.ts +++ b/dbm-ui/frontend/src/types/auto-imports.d.ts @@ -71,6 +71,6 @@ declare global { // for type re-export declare global { // @ts-ignore - export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue' + export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue' import('vue') } diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/Index.vue index 6b81005b7a..a66491a07e 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/Index.vue @@ -25,10 +25,10 @@ type="card" @change="handleChange"> - {{ item.label }} + v-for="(value, key) in rollbackTypeLabel" + :key="key" + :label="key"> + {{ value }} + diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/const.ts b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/const.ts deleted file mode 100644 index a281894bf4..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/const.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { RollbackClusterTypes } from '@services/model/ticket/details/mysql'; - -import { t } from '@locales/index'; - -export enum BackupSources { - REMOTE = 'remote', - LOCAL = 'local', -} -export enum BackupTypes { - BACKUPID = 'BACKUPID', - TIME = 'TIME', -} -export const selectList = { - backupSource: [ - { - value: BackupSources.REMOTE, - label: t('远程备份'), - }, - { - value: BackupSources.LOCAL, - label: t('本地备份'), - }, - ], - mode: [ - { - value: BackupTypes.BACKUPID, - label: t('备份记录'), - }, - { - value: BackupTypes.TIME, - label: t('回档到指定时间'), - }, - ], -}; -export const rollbackInfos = { - [RollbackClusterTypes.BUILD_INTO_NEW_CLUSTER]: { - value: RollbackClusterTypes.BUILD_INTO_NEW_CLUSTER, - label: t('构造到新集群'), - }, - [RollbackClusterTypes.BUILD_INTO_EXIST_CLUSTER]: { - value: RollbackClusterTypes.BUILD_INTO_EXIST_CLUSTER, - label: t('构造到已有集群'), - }, - [RollbackClusterTypes.BUILD_INTO_METACLUSTER]: { - value: RollbackClusterTypes.BUILD_INTO_METACLUSTER, - label: t('构造到原集群'), - }, -}; diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/exist-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/exist-cluster/Row.vue deleted file mode 100644 index 75d8ced9c8..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/exist-cluster/Row.vue +++ /dev/null @@ -1,217 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/new-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/new-cluster/Row.vue deleted file mode 100644 index cb25581e9e..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/new-cluster/Row.vue +++ /dev/null @@ -1,230 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Index.vue deleted file mode 100644 index 79ceb1e355..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Index.vue +++ /dev/null @@ -1,178 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Row.vue deleted file mode 100644 index 7f7205a26a..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-data/origin-cluster/Row.vue +++ /dev/null @@ -1,133 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/Index.vue new file mode 100644 index 0000000000..f63d4335aa --- /dev/null +++ b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/Index.vue @@ -0,0 +1,385 @@ + + + + + + + + diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/RenderBackup.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/RenderBackup.vue similarity index 85% rename from dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/RenderBackup.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/RenderBackup.vue index 91a374ec00..c8b2837d24 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/RenderBackup.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/RenderBackup.vue @@ -20,13 +20,25 @@ :rules="rules" @change="(value) => handleChange(value as BackupSources)" /> - + + diff --git a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/render-mode/Index.vue b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/render-mode/Index.vue similarity index 92% rename from dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/render-mode/Index.vue rename to dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/render-mode/Index.vue index cacd432bf4..7e8e9ff522 100644 --- a/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/common/render-mode/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/mysql/rollback/pages/page1/components/render-row/components/render-mode/Index.vue @@ -17,7 +17,7 @@ @@ -47,20 +47,25 @@ - + - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/const.ts b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/const.ts deleted file mode 100644 index 9be980b8cd..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/const.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { t } from '@locales/index'; - -export enum BackupSources { - REMOTE = 'remote', -} -export enum BackupTypes { - BACKUPID = 'BACKUPID', - TIME = 'TIME', -} -export const selectList = { - backupSource: [ - { - value: BackupSources.REMOTE, - label: t('远程备份'), - }, - ], - mode: [ - { - value: BackupTypes.BACKUPID, - label: t('备份记录'), - }, - { - value: BackupTypes.TIME, - label: t('回档到指定时间'), - }, - ], -}; diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Index.vue deleted file mode 100644 index 830d178063..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Index.vue +++ /dev/null @@ -1,285 +0,0 @@ - - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Row.vue deleted file mode 100644 index b663ba25c2..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/exist-cluster/Row.vue +++ /dev/null @@ -1,226 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Index.vue deleted file mode 100644 index 1256d9a2a5..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Index.vue +++ /dev/null @@ -1,289 +0,0 @@ - - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Row.vue deleted file mode 100644 index 82d295c86f..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/new-cluster/Row.vue +++ /dev/null @@ -1,236 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Index.vue deleted file mode 100644 index 029d515780..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Index.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Row.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Row.vue deleted file mode 100644 index 50dd706e37..0000000000 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-data/origin-cluster/Row.vue +++ /dev/null @@ -1,148 +0,0 @@ - - - - diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/Index.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/Index.vue new file mode 100644 index 0000000000..1e00d1fd9f --- /dev/null +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/Index.vue @@ -0,0 +1,415 @@ + + + + + + + + diff --git a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/RenderClusterInputSelect.vue b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/components/RenderClusterInputSelect.vue similarity index 84% rename from dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/RenderClusterInputSelect.vue rename to dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/components/RenderClusterInputSelect.vue index b514c81446..aa3c8f005b 100644 --- a/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/common/RenderClusterInputSelect.vue +++ b/dbm-ui/frontend/src/views/db-manage/tendb-cluster/rollback/pages/page1/components/render-row/components/RenderClusterInputSelect.vue @@ -15,7 +15,7 @@
@@ -32,9 +32,7 @@ import TendbhaModel from '@services/model/mysql/tendbha'; import type TendbClusterModel from '@services/model/tendbcluster/tendbcluster'; import { queryClusters } from '@services/source/mysqlCluster'; - import { getTendbclusterListByBizId } from '@services/source/tendbcluster'; - - import { useGlobalBizs } from '@stores'; + import { getTendbClusterList } from '@services/source/tendbcluster'; import { ClusterTypes } from '@common/const'; import { batchSplitRegex, domainRegex } from '@common/regex'; @@ -60,20 +58,17 @@ }); const { t } = useI18n(); - const { currentBizId } = useGlobalBizs(); - - const isShowSelector = ref(false); const editRef = ref>(); - const localValue = ref(); - const localClusterIds = ref([props.targetClusterId]); + const isShowSelector = ref(false); + const localClusterDomain = ref(''); + const localClusterId = ref(props.targetClusterId); const selectedClusters = shallowRef<{ [key: string]: Array }>({ [ClusterTypes.TENDBCLUSTER]: [], }); const tabListConfig = { [ClusterTypes.TENDBCLUSTER]: { - showPreviewResultTitle: true, disabledRowConfig: [ { handler: (data: TendbhaModel) => data.id === props.sourceClusterId, @@ -100,7 +95,7 @@ cluster_filters: list.map((item) => ({ immute_domain: item, })), - bk_biz_id: currentBizId, + bk_biz_id: window.PROJECT_CONFIG.BIZ_ID, }).then((data) => { if (data.length === list.length) { return true; @@ -113,28 +108,15 @@ ]; const queryClustersById = (id: number) => { - getTendbclusterListByBizId({ + getTendbClusterList({ cluster_ids: [id], - bk_biz_id: currentBizId, }).then((data) => { if (data?.results.length > 0) { - localValue.value = data.results[0]?.master_domain; + localClusterDomain.value = data.results[0]?.master_domain; } }); }; - watch( - () => props.targetClusterId, - (id) => { - if (id) { - queryClustersById(id); - } - }, - { - immediate: true, - }, - ); - const handleOpenSeletor = () => { isShowSelector.value = true; }; @@ -142,19 +124,32 @@ // 批量选择 const handelClusterChange = (selected: { [key: string]: TendbClusterModel[] }) => { selectedClusters.value = selected; - const list = Object.keys(selected).reduce((list: TendbClusterModel[], key) => list.concat(...selected[key]), []); - localValue.value = list.map((item) => item.master_domain).join(','); - localClusterIds.value = list.map((item) => item.id); + const list = Object.values(selected).flat(); + const [firstItem] = list; + localClusterDomain.value = firstItem.master_domain; + localClusterId.value = firstItem.id; window.changeConfirm = true; setTimeout(() => { editRef.value!.getValue(); }); }; + watch( + () => props.targetClusterId, + (id) => { + if (id) { + queryClustersById(id); + } + }, + { + immediate: true, + }, + ); + defineExpose({ getValue() { return editRef.value!.getValue().then(() => ({ - target_cluster_id: localClusterIds.value[0], + target_cluster_id: localClusterId.value, })); }, }); diff --git a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/rollback/Index.vue b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/rollback/Index.vue index 69549cc4d2..8ea15eaa5b 100644 --- a/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/rollback/Index.vue +++ b/dbm-ui/frontend/src/views/tickets/common/components/demand-factory/mysql/rollback/Index.vue @@ -57,9 +57,7 @@ }, }; - const renderData = computed( - () => rollbackInfo[props.ticketDetails.details.rollback_cluster_type as RollbackClusterTypes], - ); + const renderData = computed(() => rollbackInfo[props.ticketDetails.details.rollback_cluster_type]);