Skip to content

Commit

Permalink
feat(frontend): 集群、实例补充字段 TencentBlueKing#7813
Browse files Browse the repository at this point in the history
  • Loading branch information
royalpioneer authored and hLinx committed Nov 12, 2024
1 parent 6960025 commit 691e05d
Show file tree
Hide file tree
Showing 50 changed files with 624 additions and 112 deletions.
10 changes: 10 additions & 0 deletions dbm-ui/frontend/src/common/const/clusterAffinity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { t } from '@locales/index';

export const ClusterAffinityMap = {
CROS_SUBZONE: t('同城跨园区'),
SAME_SUBZONE_CROSS_SWTICH: t('同城同园区跨机架'),
CROSS_RACK: t('跨机架'),
SAME_SUBZONE: t('同城同园区'),
NONE: t('同城无园区要求'),
MAX_EACH_ZONE_EQUAL: t('尽量均匀分布'),
};
9 changes: 8 additions & 1 deletion dbm-ui/frontend/src/components/vue2/ip-selector/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@ export const ipSelector = createFactory({
label: t('磁盘_GB'),
field: 'bk_disk',
},
{
key: 'zone',
index: 7,
width: '100px',
label: t('所在园区'),
field: 'bk_sub_zone',
},
],
hostTableRenderColumnList: ['ip', 'ipv6', 'cloudArea', 'alive', 'cpu', 'memo', 'disk'],
hostTableRenderColumnList: ['ip', 'ipv6', 'cloudArea', 'alive', 'cpu', 'memo', 'disk', 'zone'],
fetchTopologyHostCount: getHostTopo,
fetchTopologyHostsNodes: getHosts,
fetchTopologyHostIdsNodes: getHostIdInfos,
Expand Down
13 changes: 12 additions & 1 deletion dbm-ui/frontend/src/services/model/doris/doris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@

import { uniq } from 'lodash';

import type { ClusterListEntry, ClusterListNode, ClusterListOperation } from '@services/types';
import type { ClusterListEntry, ClusterListNode, ClusterListOperation, ClusterListSpec } from '@services/types';

import { TicketTypes } from '@common/const';
import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { isRecentDays, utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -58,16 +59,19 @@ export default class Doris {
bk_biz_name: number;
bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
cluster_access_port: number;
cluster_alias: string;
cluster_entry: ClusterListEntry[];
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_time_zone: string;
cluster_type: string;
cluster_type_name: string;
create_at: string;
creator: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
domain: string;
doris_backend_cold: Array<ClusterListNode>;
doris_backend_hot: Array<ClusterListNode>;
Expand Down Expand Up @@ -99,16 +103,19 @@ export default class Doris {
this.bk_biz_name = payload.bk_biz_name;
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_sub_zone = payload.bk_sub_zone;
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
this.cluster_name = payload.cluster_name;
this.cluster_spec = payload.cluster_spec || {};
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.create_at = payload.create_at;
this.creator = payload.creator;
this.disaster_tolerance_level = payload.disaster_tolerance_level;
this.domain = payload.domain;
this.doris_backend_cold = payload.doris_backend_cold;
this.doris_backend_hot = payload.doris_backend_hot;
Expand Down Expand Up @@ -246,4 +253,8 @@ export default class Doris {

return payload;
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
14 changes: 13 additions & 1 deletion dbm-ui/frontend/src/services/model/es/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
import { uniq } from 'lodash';

import type { ClusterListEntry, ClusterListNode, ClusterListOperation } from '@services/types';
import type { ClusterListEntry, ClusterListNode, ClusterListOperation, ClusterListSpec } from '@services/types';

import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { isRecentDays, utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -55,10 +57,12 @@ export default class Es {
bk_biz_name: number;
bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
cluster_access_port: number;
cluster_alias: string;
cluster_entry: ClusterListEntry[];
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_time_zone: string;
cluster_type: string;
Expand All @@ -67,6 +71,7 @@ export default class Es {
creator: string;
db_module_id: number;
db_module_name: number;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
domain: string;
es_client: Array<ClusterListNode>;
es_datanode_cold: Array<ClusterListNode>;
Expand Down Expand Up @@ -101,10 +106,12 @@ export default class Es {
this.bk_biz_name = payload.bk_biz_name;
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_sub_zone = payload.bk_sub_zone;
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
this.cluster_name = payload.cluster_name;
this.cluster_spec = payload.cluster_spec || {};
this.cluster_stats = payload.cluster_stats || {};
this.cluster_type = payload.cluster_type;
this.cluster_type_name = payload.cluster_type_name;
Expand All @@ -113,6 +120,7 @@ export default class Es {
this.creator = payload.creator;
this.db_module_id = payload.db_module_id;
this.db_module_name = payload.db_module_name;
this.disaster_tolerance_level = payload.disaster_tolerance_level;
this.domain = payload.domain;
this.es_datanode_cold = payload.es_datanode_cold;
this.es_datanode_hot = payload.es_datanode_hot;
Expand Down Expand Up @@ -244,4 +252,8 @@ export default class Es {

return payload;
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
13 changes: 12 additions & 1 deletion dbm-ui/frontend/src/services/model/hdfs/hdfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
import { uniq } from 'lodash';

import type { ClusterListEntry, ClusterListNode, ClusterListOperation } from '@services/types';
import type { ClusterListEntry, ClusterListNode, ClusterListOperation, ClusterListSpec } from '@services/types';

import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { isRecentDays, utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -55,10 +57,12 @@ export default class Hdfs {
bk_biz_name: string;
bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
cluster_access_port: number;
cluster_alias: string;
cluster_entry: ClusterListEntry[];
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_time_zone: string;
cluster_type: string;
Expand All @@ -67,6 +71,7 @@ export default class Hdfs {
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
domain: string;
hdfs_datanode: Array<ClusterListNode>;
hdfs_journalnode: Array<ClusterListNode>;
Expand Down Expand Up @@ -100,10 +105,12 @@ export default class Hdfs {
this.bk_biz_name = payload.bk_biz_name;
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_sub_zone = payload.bk_sub_zone;
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
this.cluster_name = payload.cluster_name;
this.cluster_spec = payload.cluster_spec || {};
this.cluster_stats = payload.cluster_stats || {};
this.cluster_type = payload.cluster_type;
this.cluster_type_name = payload.cluster_type_name;
Expand All @@ -112,6 +119,7 @@ export default class Hdfs {
this.creator = payload.creator;
this.db_module_id = payload.db_module_id;
this.db_module_name = payload.db_module_name;
this.disaster_tolerance_level = payload.disaster_tolerance_level;
this.domain = payload.domain;
this.hdfs_datanode = payload.hdfs_datanode;
this.hdfs_journalnode = payload.hdfs_journalnode;
Expand Down Expand Up @@ -242,4 +250,7 @@ export default class Hdfs {
get isNew() {
return isRecentDays(this.create_at, 24);
}
get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
14 changes: 13 additions & 1 deletion dbm-ui/frontend/src/services/model/kafka/kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
*/
import { uniq } from 'lodash';

import type { ClusterListEntry, ClusterListNode, ClusterListOperation } from '@services/types';
import type { ClusterListEntry, ClusterListNode, ClusterListOperation, ClusterListSpec } from '@services/types';

import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { isRecentDays, utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -55,11 +57,13 @@ export default class Kafka {
bk_biz_name: number;
bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
broker: Array<ClusterListNode>;
cluster_access_port: number;
cluster_alias: string;
cluster_entry: ClusterListEntry[];
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_time_zone: string;
cluster_type: string;
Expand All @@ -68,6 +72,7 @@ export default class Kafka {
creator: string;
db_module_id: number;
db_module_name: number;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
domain: string;
id: number;
major_version: string;
Expand Down Expand Up @@ -98,19 +103,22 @@ export default class Kafka {
this.bk_biz_name = payload.bk_biz_name;
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_sub_zone = payload.bk_sub_zone;
this.broker = payload.broker;
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
this.cluster_name = payload.cluster_name;
this.cluster_time_zone = payload.cluster_time_zone;
this.cluster_spec = payload.cluster_spec || {};
this.cluster_stats = payload.cluster_stats || {};
this.cluster_type = payload.cluster_type;
this.cluster_type_name = payload.cluster_type_name;
this.create_at = payload.create_at;
this.creator = payload.creator;
this.db_module_id = payload.db_module_id;
this.db_module_name = payload.db_module_name;
this.disaster_tolerance_level = payload.disaster_tolerance_level;
this.domain = payload.domain;
this.id = payload.id;
this.major_version = payload.major_version;
Expand Down Expand Up @@ -231,4 +239,8 @@ export default class Kafka {
get isNew() {
return isRecentDays(this.create_at, 24 * 3);
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
7 changes: 7 additions & 0 deletions dbm-ui/frontend/src/services/model/mongodb/mongodb-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ClusterEntryDetailModel from '@services/model/cluster-entry/cluster-entry
import type { ClusterListEntry } from '@services/types';

import { TicketTypes } from '@common/const';
import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -85,6 +86,7 @@ export default class MongodbDetail {
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
id: number;
instances: {
bk_cloud_id: number;
Expand Down Expand Up @@ -211,6 +213,7 @@ export default class MongodbDetail {
this.creator = payload.creator;
this.db_module_id = payload.db_module_id;
this.db_module_name = payload.db_module_name;
this.disaster_tolerance_level = payload.disaster_tolerance_level;
this.id = payload.id;
this.instances = payload.instances;
this.major_version = payload.major_version;
Expand Down Expand Up @@ -358,4 +361,8 @@ export default class MongodbDetail {
}
return '';
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default class MongodbInstance {

bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
bk_host_id: number;
cluster_id: number;
cluster_name: string;
Expand All @@ -60,6 +61,7 @@ export default class MongodbInstance {
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_host_id = payload.bk_host_id;
this.bk_sub_zone = payload.bk_sub_zone;
this.cluster_id = payload.cluster_id;
this.cluster_name = payload.cluster_name;
this.cluster_type = payload.cluster_type;
Expand Down
9 changes: 8 additions & 1 deletion dbm-ui/frontend/src/services/model/mongodb/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { uniq } from 'lodash';
import type { ClusterListEntry } from '@services/types';

import { PipelineStatus, TicketTypes } from '@common/const';
import { ClusterAffinityMap } from '@common/const/clusterAffinity';

import { utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -81,6 +82,7 @@ export default class Mongodb {
bk_biz_name: string;
bk_cloud_id: number;
bk_cloud_name: string;
bk_sub_zone: string;
cluster_access_port: number;
cluster_alias: string;
cluster_entry: ClusterListEntry[];
Expand All @@ -93,7 +95,7 @@ export default class Mongodb {
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
id: number;
major_version: string;
master_domain: string;
Expand Down Expand Up @@ -135,6 +137,7 @@ export default class Mongodb {
this.bk_biz_name = payload.bk_biz_name;
this.bk_cloud_id = payload.bk_cloud_id;
this.bk_cloud_name = payload.bk_cloud_name;
this.bk_sub_zone = payload.bk_sub_zone;
this.db_module_id = payload.db_module_id;
this.db_module_name = payload.db_module_name;
this.cluster_access_port = payload.cluster_access_port;
Expand Down Expand Up @@ -366,4 +369,8 @@ export default class Mongodb {
return prevList;
}, []);
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
}
}
10 changes: 10 additions & 0 deletions dbm-ui/frontend/src/services/model/mysql/tendbha-instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import { utcDisplayTime } from '@utils';
export default class TendbhaInstance {
bk_cloud_id: number;
bk_cloud_name: string;
bk_cpu: number;
db_version: string;
bk_disk: number;
bk_host_id: number;
bk_mem: number;
bk_sub_zone: string;
cluster_id: number;
cluster_name: string;
cluster_type: string;
Expand All @@ -45,13 +50,18 @@ export default class TendbhaInstance {
constructor(payload = {} as TendbhaInstance) {
this.bk_cloud_id = payload.bk_cloud_id || 0;
this.bk_cloud_name = payload.bk_cloud_name || '';
this.bk_cpu = payload.bk_cpu || 0;
this.bk_disk = payload.bk_disk || 0;
this.bk_host_id = payload.bk_host_id || 0;
this.bk_mem = payload.bk_mem || 0;
this.bk_sub_zone = payload.bk_sub_zone || '';
this.cluster_id = payload.cluster_id || 0;
this.cluster_name = payload.cluster_name || '';
this.cluster_type = payload.cluster_type || '';
this.create_at = payload.create_at || '';
this.db_module_id = payload.db_module_id || 0;
this.db_module_name = payload.db_module_name || '';
this.db_version = payload.db_version || '';
this.host_info = payload.host_info || {};
this.id = payload.id || 0;
this.instance_address = payload.instance_address || '';
Expand Down
Loading

0 comments on commit 691e05d

Please sign in to comment.