Skip to content

Commit

Permalink
feat(frontend): 集群部署增加园区和调整容灾要求和增加预估成本展示 TencentBlueKing#9399
Browse files Browse the repository at this point in the history
  • Loading branch information
3octaves committed Mar 4, 2025
1 parent 8eac611 commit 871aa85
Show file tree
Hide file tree
Showing 126 changed files with 2,683 additions and 2,228 deletions.
22 changes: 15 additions & 7 deletions dbm-ui/frontend/src/common/const/clusterAffinity.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import { t } from '@locales/index';

export const ClusterAffinityMap = {
CROS_SUBZONE: t('同城跨园区'),
CROSS_RACK: t('跨机架'),
MAX_EACH_ZONE_EQUAL: t('尽量均匀分布'),
NONE: t('同城无园区要求'),
SAME_SUBZONE: t('同城同园区'),
SAME_SUBZONE_CROSS_SWTICH: t('同城同园区跨机架'),
export enum Affinity {
CROS_SUBZONE = 'CROS_SUBZONE',
CROSS_RACK = 'CROSS_RACK',
MAX_EACH_ZONE_EQUAL = 'MAX_EACH_ZONE_EQUAL',
NONE = 'NONE',
SAME_SUBZONE_CROSS_SWTICH = 'SAME_SUBZONE_CROSS_SWTICH',
}

export const affinityMap = {
[Affinity.CROS_SUBZONE]: t('跨园区'),
[Affinity.CROSS_RACK]: t('不限园区'),
[Affinity.MAX_EACH_ZONE_EQUAL]: t('尽量分散'),
[Affinity.NONE]: t('无'),
[Affinity.SAME_SUBZONE_CROSS_SWTICH]: t('指定园区'),
// SAME_SUBZONE: t('同城同园区'), // 弃用
};
15 changes: 15 additions & 0 deletions dbm-ui/frontend/src/locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -4135,5 +4135,20 @@
"退回资源池": "退回资源池",
"主机回收": "主机回收",
"版本升级:主从接入层和单节点采用原地升级,存储层小版本升级采用原地升级(注意:暂不支持一主多从),大版本需提供新机迁移方式执行。同一主机所有关联集群将一并同步升级": "版本升级:主从接入层和单节点采用原地升级,存储层小版本升级采用原地升级(注意:暂不支持一主多从),大版本需提供新机迁移方式执行。同一主机所有关联集群将一并同步升级",
"随机可用区": "随机可用区",
"至少选择n个区": "至少选择 {n} 个区",
"规格不能为空": "规格不能为空",
"地域园区": "地域园区",
"集群名称:": "集群名称:",

"集群部署方案:": "集群部署方案:",
"成本预估": "成本预估",
"n元/月": "{n} 元/月",
"请先配置资源": "请先配置资源",
"跨园区": "跨园区",
"不限园区": "不限园区",
"尽量分散": "尽量分散",
"指定园区": "指定园区",
"园区不能为空": "园区不能为空",
"这行勿动!新增翻译请在上一行添加!": ""
}
10 changes: 5 additions & 5 deletions dbm-ui/frontend/src/services/model/doris/doris.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes, TicketTypes } from '@common/const';
import { Affinity, affinityMap, ClusterTypes, TicketTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -61,19 +61,19 @@ export default class Doris extends ClusterBase {
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_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
domain: string;
doris_backend_cold: Array<ClusterListNode>;
doris_backend_hot: Array<ClusterListNode>;
Expand Down Expand Up @@ -106,7 +106,7 @@ export default class Doris extends ClusterBase {
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_subzons = payload.cluster_subzons || [];
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
Expand Down Expand Up @@ -156,7 +156,7 @@ export default class Doris extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get isAbnormal() {
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/frontend/src/services/model/es/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes } from '@common/const';
import { Affinity, affinityMap, ClusterTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -63,14 +63,15 @@ export default class Es extends ClusterBase {
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
db_module_id: number;
db_module_name: number;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
domain: string;
es_client: Array<ClusterListNode>;
es_datanode_cold: Array<ClusterListNode>;
Expand Down Expand Up @@ -106,6 +107,7 @@ export default class Es extends ClusterBase {
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.cluster_subzons = payload.cluster_subzons || [];
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
Expand Down Expand Up @@ -158,7 +160,7 @@ export default class Es extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get isStarting() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export default class FunctionController {
'bizConfigManage.ticketFlowSetting': ControllerItem<string>;
'bizConfigManage.ticketNoticeSetting': ControllerItem<string>;

// 通用开关,涉及多个功能页面
'common.affinityNone': ControllerItem<string>;
'common.specCostEstimate': ControllerItem<string>;

'databaseManage.missionManage': ControllerItem<string>;
'databaseManage.temporaryPaasswordModify': ControllerItem<string>;
'databaseManage.whitelistManage': ControllerItem<string>;
Expand Down Expand Up @@ -205,6 +209,7 @@ export default class FunctionController {
addons: ControllerItem<AddonsFunctions>;
bigdata: ControllerItem<BigdataFunctions>;
bizConfigManage: ControllerItem<string>;
common: ControllerItem<string>;
databaseManage: ControllerItem<string>;
globalConfigManage: ControllerItem<string>;
mongodb: ControllerItem<MongoFunctions>;
Expand All @@ -220,6 +225,7 @@ export default class FunctionController {
constructor(payload = {} as FunctionController) {
this.addons = payload.addons;
this.mysql = payload.mysql;
this.common = payload.common;
this.redis = payload.redis;
this.mongodb = payload.mongodb;
this.bigdata = payload.bigdata;
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/frontend/src/services/model/hdfs/hdfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes } from '@common/const';
import { Affinity, affinityMap, ClusterTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -66,14 +66,15 @@ export default class Hdfs extends ClusterBase {
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
domain: string;
hdfs_datanode: Array<ClusterListNode>;
hdfs_journalnode: Array<ClusterListNode>;
Expand Down Expand Up @@ -108,6 +109,7 @@ export default class Hdfs extends ClusterBase {
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.cluster_subzons = payload.cluster_subzons || [];
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry;
Expand Down Expand Up @@ -159,7 +161,7 @@ export default class Hdfs extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get isStarting() {
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/frontend/src/services/model/kafka/kafka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes } from '@common/const';
import { affinityMap, ClusterTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -67,14 +67,15 @@ export default class Kafka extends ClusterBase {
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
db_module_id: number;
db_module_name: number;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
domain: string;
id: number;
major_version: string;
Expand Down Expand Up @@ -106,6 +107,7 @@ export default class Kafka extends ClusterBase {
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.cluster_subzons = payload.cluster_subzons || [];
this.broker = payload.broker;
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
Expand Down Expand Up @@ -157,7 +159,7 @@ export default class Kafka extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get isStarting() {
Expand Down
6 changes: 3 additions & 3 deletions dbm-ui/frontend/src/services/model/mongodb/mongodb-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import ClusterEntryDetailModel from '@services/model/cluster-entry/cluster-entry-details';
import type { ClusterListEntry, ClusterListSpec } from '@services/types';

import { ClusterAffinityMap, TicketTypes } from '@common/const';
import { Affinity, affinityMap, TicketTypes } from '@common/const';

import { utcDisplayTime } from '@utils';

Expand Down Expand Up @@ -86,7 +86,7 @@ export default class MongodbDetail {
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
id: number;
instances: {
bk_cloud_id: number;
Expand Down Expand Up @@ -238,7 +238,7 @@ export default class MongodbDetail {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get entryAccess() {
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/frontend/src/services/model/mongodb/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes, PipelineStatus, TicketTypes } from '@common/const';
import { Affinity, affinityMap, ClusterTypes, PipelineStatus, TicketTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -47,14 +47,15 @@ export default class Mongodb extends ClusterBase {
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
id: number;
machine_instance_num: number;
machine_type: string;
Expand Down Expand Up @@ -104,6 +105,7 @@ export default class Mongodb extends ClusterBase {
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.cluster_subzons = payload.cluster_subzons || [];
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry || [];
Expand Down Expand Up @@ -169,7 +171,7 @@ export default class Mongodb extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get entryAccess() {
Expand Down
8 changes: 5 additions & 3 deletions dbm-ui/frontend/src/services/model/mysql/tendbha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { uniq } from 'lodash';

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

import { ClusterAffinityMap, ClusterTypes } from '@common/const';
import { Affinity, affinityMap, ClusterTypes } from '@common/const';

import { t } from '@locales/index';

Expand Down Expand Up @@ -56,14 +56,15 @@ export default class Tendbha extends ClusterBase {
cluster_name: string;
cluster_spec: ClusterListSpec;
cluster_stats: Record<'used' | 'total' | 'in_use', number>;
cluster_subzons: string[];
cluster_time_zone: string;
cluster_type: ClusterTypes;
cluster_type_name: string;
create_at: string;
creator: string;
db_module_id: number;
db_module_name: string;
disaster_tolerance_level: keyof typeof ClusterAffinityMap;
disaster_tolerance_level: Affinity;
id: number;
immute_domain: string;
major_version: string;
Expand Down Expand Up @@ -95,6 +96,7 @@ export default class Tendbha extends ClusterBase {
this.bk_biz_name = payload.bk_biz_name || '';
this.bk_cloud_id = payload.bk_cloud_id || 0;
this.bk_cloud_name = payload.bk_cloud_name || '';
this.cluster_subzons = payload.cluster_subzons || [];
this.cluster_access_port = payload.cluster_access_port;
this.cluster_alias = payload.cluster_alias;
this.cluster_entry = payload.cluster_entry || [];
Expand Down Expand Up @@ -146,7 +148,7 @@ export default class Tendbha extends ClusterBase {
}

get disasterToleranceLevelName() {
return ClusterAffinityMap[this.disaster_tolerance_level];
return affinityMap[this.disaster_tolerance_level];
}

get isStarting() {
Expand Down
Loading

0 comments on commit 871aa85

Please sign in to comment.