Skip to content

Commit

Permalink
fix(frontend): 修复cluster_entry_details设值问题 TencentBlueKing#8187
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves authored and jinquantianxia committed Nov 26, 2024
1 parent 5770e57 commit c64fba6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
25 changes: 25 additions & 0 deletions dbm-ui/frontend/src/services/model/pulsar/pulsar-detail.ts
Original file line number Diff line number Diff line change
@@ -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));
}
}
6 changes: 3 additions & 3 deletions dbm-ui/frontend/src/services/model/pulsar/pulsar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion dbm-ui/frontend/src/services/source/pulsar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -71,7 +72,7 @@ export function retrievePulsarInstance(params: { bk_biz_id: number }) {
* 获取集群详情
*/
export function getPulsarDetail(params: { id: number }) {
return http.get<PulsarModel>(`${path}/${params.id}/`).then((data) => new PulsarModel(data));
return http.get<PulsarDetailModel>(`${path}/${params.id}/`).then((data) => new PulsarDetailModel(data));
}

/**
Expand Down

0 comments on commit c64fba6

Please sign in to comment.