From 01179d555ad3d74de8bc5a815bfe91245af0bad9 Mon Sep 17 00:00:00 2001 From: 3octaves <873551943@qq.com> Date: Tue, 26 Nov 2024 14:51:17 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E4=BF=AE=E5=A4=8Dcluster=5Fen?= =?UTF-8?q?try=5Fdetails=E8=AE=BE=E5=80=BC=E9=97=AE=E9=A2=98=20#8187?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/model/pulsar/pulsar-detail.ts | 25 +++++++++++++++++++ .../src/services/model/pulsar/pulsar.ts | 6 ++--- dbm-ui/frontend/src/services/source/pulsar.ts | 3 ++- 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 dbm-ui/frontend/src/services/model/pulsar/pulsar-detail.ts diff --git a/dbm-ui/frontend/src/services/model/pulsar/pulsar-detail.ts b/dbm-ui/frontend/src/services/model/pulsar/pulsar-detail.ts new file mode 100644 index 0000000000..8763083b35 --- /dev/null +++ b/dbm-ui/frontend/src/services/model/pulsar/pulsar-detail.ts @@ -0,0 +1,25 @@ +/* + * TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. + * + * Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. + * + * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at https://opensource.org/licenses/MIT + * + * 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 ClusterEntryDetailModel from '@services/model/cluster-entry/cluster-entry-details'; + +import PursalModel from './pulsar'; + +export default class PursalDetail extends PursalModel { + cluster_entry_details: ClusterEntryDetailModel[]; + + constructor(payload = {} as PursalDetail) { + super(payload); + this.cluster_entry_details = payload.cluster_entry_details.map((item) => new ClusterEntryDetailModel(item)); + } +} diff --git a/dbm-ui/frontend/src/services/model/pulsar/pulsar.ts b/dbm-ui/frontend/src/services/model/pulsar/pulsar.ts index b908e3b61d..d839092eb7 100644 --- a/dbm-ui/frontend/src/services/model/pulsar/pulsar.ts +++ b/dbm-ui/frontend/src/services/model/pulsar/pulsar.ts @@ -12,7 +12,7 @@ */ import { uniq } from 'lodash'; -import ClusterEntryDetailModel from '@services/model/cluster-entry/cluster-entry-details'; +import type { ClusterListEntry } from '@services/types'; import { isRecentDays, utcDisplayTime } from '@utils'; @@ -70,12 +70,12 @@ export default class Pulsar { bk_cloud_id: number; cap_usage: number; cluster_alias: string; + cluster_entry: ClusterListEntry[]; cluster_name: string; cluster_stats: Record<'used' | 'total' | 'in_use', number>; cluster_type: string; cluster_type_name: string; cluster_time_zone: string; - cluster_entry_details: ClusterEntryDetailModel[]; create_at: string; creator: string; domain: string; @@ -117,12 +117,12 @@ export default class Pulsar { this.bk_cloud_name = payload.bk_cloud_name; this.cap_usage = payload.cap_usage; this.cluster_alias = payload.cluster_alias; + this.cluster_entry = payload.cluster_entry; this.cluster_name = payload.cluster_name; this.cluster_stats = payload.cluster_stats || {}; this.cluster_type = payload.cluster_type; this.cluster_type_name = payload.cluster_type_name; this.cluster_time_zone = payload.cluster_time_zone; - this.cluster_entry_details = payload.cluster_entry_details.map((item) => new ClusterEntryDetailModel(item)); this.create_at = payload.create_at; this.creator = payload.creator; this.domain = payload.domain; diff --git a/dbm-ui/frontend/src/services/source/pulsar.ts b/dbm-ui/frontend/src/services/source/pulsar.ts index 62a20a60b3..2b4c7a9560 100644 --- a/dbm-ui/frontend/src/services/source/pulsar.ts +++ b/dbm-ui/frontend/src/services/source/pulsar.ts @@ -12,6 +12,7 @@ */ import PulsarModel from '@services/model/pulsar/pulsar'; +import PulsarDetailModel from '@services/model/pulsar/pulsar-detail'; import PulsarInstanceModel from '@services/model/pulsar/pulsar-instance'; import PulsarMachineModel from '@services/model/pulsar/pulsar-machine'; import PulsarNodeModel from '@services/model/pulsar/pulsar-node'; @@ -71,7 +72,7 @@ export function retrievePulsarInstance(params: { bk_biz_id: number }) { * 获取集群详情 */ export function getPulsarDetail(params: { id: number }) { - return http.get(`${path}/${params.id}/`).then((data) => new PulsarModel(data)); + return http.get(`${path}/${params.id}/`).then((data) => new PulsarDetailModel(data)); } /**