Skip to content

Commit

Permalink
feat(frontend): mysql、tendbcluster定点构造优化 TencentBlueKing#5611
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 21213
  • Loading branch information
JustaCattt committed Oct 18, 2024
1 parent aede369 commit 3506771
Show file tree
Hide file tree
Showing 42 changed files with 1,512 additions and 2,926 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@
const handleChange = (value: Required<Props>['modelValue']) => {
localValue.value = value;
console.log('handleChange', value);
validator(localValue.value).then(() => {
window.changeConfirm = true;
emits('update:modelValue', localValue.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MySQLRollbackDetails>) {
export function generateSpiderRollbackCloneData(ticketData: TicketModel<SpiderRollbackDetails>) {
const { clusters, infos, rollback_cluster_type } = ticketData.details;
const tableDataList = infos.map((item) => ({
rowKey: random(),
Expand Down
2 changes: 2 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,8 @@
"包含通配符时, 每一单元格只允许输入单个对象。% 不能独立使用, * 只能单独使用": "包含通配符时, 每一单元格只允许输入单个对象。% 不能独立使用, * 只能单独使用",
"查看域名/IP对应关系": "查看域名/IP对应关系",
"确认继续所有人工确认节点": "确认继续所有人工确认节点",
"请先选择待回档集群": "请先选择待回档集群",
"请先添加待回档集群": "请先添加待回档集群",
"任务": "任务",
"Redis版本": "Redis版本",
"当前分片数": "当前分片数",
Expand Down
23 changes: 13 additions & 10 deletions dbm-ui/frontend/src/services/model/ticket/details/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,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 定点回档
*/
Expand All @@ -469,16 +479,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;
Expand Down
39 changes: 22 additions & 17 deletions dbm-ui/frontend/src/services/model/ticket/details/spider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions dbm-ui/frontend/src/services/source/fixpointRollback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,5 @@ export function queryLatesBackupLog(params: {
rollback_time: string;
job_instance_id?: number;
}) {
return http.get<{
backup_logs: Array<any>;
job_status: string;
message: string;
}>(`${path}/query_latest_backup_log/`, params);
return http.get<BackupLogRecord>(`${path}/query_latest_backup_log/`, params);
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,18 @@
type="card"
@change="handleChange">
<BkRadioButton
v-for="(item, index) in rollbackInfos"
:key="index"
:label="item.value">
{{ item.label }}
v-for="(value, key) in rollbackTypeLabel"
:key="key"
:label="key">
{{ value }}
</BkRadioButton>
</BkRadioGroup>
<RenderData
ref="renderDataRef"
:data="tableData"
:rollback-cluster-type="rollbackClusterType" />
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n';
Expand All @@ -47,8 +48,8 @@
import TimeZonePicker from '@components/time-zone-picker/index.vue';
import { rollbackInfos } from './components/common/const';
import RenderData, { createRowData, type IDataRow } from './components/render-data/Index.vue';
import { createRowData, type IDataRow } from './components/render-row/Index.vue';
import RenderData from './components/RenderData.vue';
const { t } = useI18n();
Expand All @@ -57,14 +58,20 @@
type: TicketTypes.MYSQL_ROLLBACK_CLUSTER,
onSuccess(cloneData) {
rollbackClusterType.value = cloneData.rollback_cluster_type;
tableData.value = cloneData.tableDataList as IDataRow[];
tableData.value = cloneData.tableDataList;
window.changeConfirm = true;
},
});
const rollbackTypeLabel = {
[RollbackClusterTypes.BUILD_INTO_NEW_CLUSTER]: t('构造到新集群'),
[RollbackClusterTypes.BUILD_INTO_EXIST_CLUSTER]: t('构造到已有集群'),
[RollbackClusterTypes.BUILD_INTO_METACLUSTER]: t('构造到原集群'),
};
const renderDataRef = ref<InstanceType<typeof RenderData>>();
const rollbackClusterType = ref<RollbackClusterTypes>(RollbackClusterTypes.BUILD_INTO_NEW_CLUSTER);
const tableData = shallowRef<Array<IDataRow>>([createRowData({})]);
const tableData = shallowRef<IDataRow[]>([createRowData({})]);
const handleChange = () => {
renderDataRef.value!.reset();
Expand Down
Loading

0 comments on commit 3506771

Please sign in to comment.