Skip to content

Commit

Permalink
fix(frontend): TenDbCluster、Doris的Tab缺失 TencentBlueKing#8175
Browse files Browse the repository at this point in the history
  • Loading branch information
royalpioneer committed Nov 27, 2024
1 parent 72c4e3b commit 87cbd79
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 64 deletions.
40 changes: 20 additions & 20 deletions dbm-ui/frontend/src/common/const/clusterTypeInfos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,26 +236,26 @@ const bigdata: InfoType = {
name: t('Broker节点规格'),
},
],
[ClusterTypes.DORIS]: {
id: ClusterTypes.DORIS,
name: 'Doris',
dbType: DBTypes.DORIS,
moduleId: 'bigdata',
machineList: [
{
id: MachineTypes.DORIS_FOLLOWER,
name: t('Follower节点规格'),
},
{
id: MachineTypes.DORIS_OBSERVER,
name: t('Observer节点规格'),
},
{
id: MachineTypes.DORIS_BACKEND,
name: t('冷_热节点规格'),
},
],
},
},
[ClusterTypes.DORIS]: {
id: ClusterTypes.DORIS,
name: 'Doris',
dbType: DBTypes.DORIS,
moduleId: 'bigdata',
machineList: [
{
id: MachineTypes.DORIS_FOLLOWER,
name: t('Follower节点规格'),
},
{
id: MachineTypes.DORIS_OBSERVER,
name: t('Observer节点规格'),
},
{
id: MachineTypes.DORIS_BACKEND,
name: t('冷_热节点规格'),
},
],
},
};

Expand Down
11 changes: 4 additions & 7 deletions dbm-ui/frontend/src/common/const/clusterTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,21 @@ export enum ClusterTypes {
TENDIS_PLUS_CLUSTER = 'TendisplusCluster', // TendisplusCluster集群
DBMON = 'dbmon', // redis监控
}
// bigdata

export enum ClusterTypes {
// bigdata
ES = 'es',
KAFKA = 'kafka',
HDFS = 'hdfs',
INFLUXDB = 'influxdb',
PULSAR = 'pulsar',
RIAK = 'riak',
DORIS = 'doris',
}
// mongo
export enum ClusterTypes {
// mongo
MONGO_REPLICA_SET = 'MongoReplicaSet', // Mongo副本集群
MONGO_SHARED_CLUSTER = 'MongoShardedCluster', // Mongo分片集群
MONGODB = 'mongodb',
}
// sqlserver
export enum ClusterTypes {
// sqlserver
SQLSERVER_SINGLE = 'sqlserver_single', // SQLServer单节点版
SQLSERVER_HA = 'sqlserver_ha', // SQLServer主从版
}
Expand Down
57 changes: 26 additions & 31 deletions dbm-ui/frontend/src/common/const/machineTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,58 @@
* 机器类型
*/

// mysql
export enum MachineTypes {
// mysql
BACKEND = 'backend',
PROXY = 'proxy',
SINGLE = 'single',
}
// spider
export enum MachineTypes {

// spider
SPIDER = 'spider',
REMOTE = 'remote',
}
// redis
export enum MachineTypes {

// redis
TENDISCACHE = 'tendiscache',
TENDISSSD = 'tendisssd',
TENDISPLUS = 'tendisplus',
TWEMPROXY = 'twemproxy',
PREDIXY = 'predixy',
}
// mongodb
export enum MachineTypes {

// mongodb
MONGOS = 'mongos',
MONGODB = 'mongodb',
MONGO_CONFIG = 'mongo_config',
}
// sqlserver
export enum MachineTypes {

// sqlserver
SQLSERVER_HA = 'sqlserver_ha',
SQLSERVER_SINGLE = 'sqlserver_single',
}
// kefka
export enum MachineTypes {

// kafka
BROKER = 'broker',
ZOOKEEPER = 'zookeeper',
}
// es
export enum MachineTypes {

// es
ES_DATANODE = 'es_datanode',
ES_MASTER = 'es_master',
ES_CLIENT = 'es_client',
}
// hdfs
export enum MachineTypes {

// hdfs
HDFS_MASTER = 'hdfs_master',
HDFS_DATANODE = 'hdfs_datanode',
}
// pulsar
export enum MachineTypes {

// pulsar
PULSAR_BROKER = 'pulsar_broker',
PULSAR_BOOKKEEPER = 'pulsar_bookkeeper',
PULSAR_ZOOKEEPER = 'pulsar_zookeeper',
}
// influxdb
export enum MachineTypes {

// doris
DORIS_FOLLOWER = 'doris_follower',
DORIS_OBSERVER = 'doris_observer',
DORIS_BACKEND = 'doris_backend',

// influxdb
INFLUXDB = 'influxdb',
}
// riak
export enum MachineTypes {

// riak
RIAK = 'riak',
}
3 changes: 3 additions & 0 deletions dbm-ui/frontend/src/views/db-configure/business/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@
if (!route.query.form) {
router.push({
name: 'DbConfigureList',
params: {
clusterType: props.clusterType,
},
});
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface State {
/**
* 获取参数管理基本信息
*/
export const useBaseDetails = (immediateFetch = true) => {
export const useBaseDetails = (immediateFetch = true, confName = 'db_version') => {
const getFetchParams = (versionKey: 'version' | 'proxy_version', confType = 'dbconf') => {
if (treeNode === undefined) {
return {} as ServiceParameters<typeof getLevelConfig>;
Expand Down Expand Up @@ -115,7 +115,7 @@ export const useBaseDetails = (immediateFetch = true) => {
getLevelConfig(params)
.then((res) => {
res.conf_items.forEach((item) => {
if (item.conf_name === 'db_version') {
if (item.conf_name === confName) {
state.version = item.conf_value ?? '';
} else if (item.conf_name === 'charset') {
state.data.charset = item.conf_value ?? '';
Expand Down
50 changes: 47 additions & 3 deletions dbm-ui/frontend/src/views/db-configure/components/DetailsBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,23 @@
class="details-base__table"
:data="configItems"
:level="level"
:sticky-top="stickyTop" />
:sticky-top="stickyTop">
<template
v-if="tabs.length > 1"
#prefix>
<BkRadioGroup
v-model="clusterType"
type="capsule">
<BkRadioButton
v-for="tab of tabs"
:key="tab"
:label="tab"
style="width: 200px">
{{ tab }} {{ t('参数配置') }}
</BkRadioButton>
</BkRadioGroup>
</template>
</ReadonlyTable>
</DbCard>
<DbCard
v-for="card of extraParametersCards"
Expand Down Expand Up @@ -76,6 +92,7 @@

import EditInfo, { type EditEmitData } from '@components/editable-info/index.vue';

import { useBaseDetails } from '../business/list/components/hooks/useBaseDetails';
import type { ExtraConfListItem } from '../common/types';

import ReadonlyTable from './ReadonlyTable.vue';
Expand Down Expand Up @@ -117,11 +134,25 @@
const { t } = useI18n();
const router = useRouter();
const route = useRoute();
const { state } = useBaseDetails(true, 'spider_version');

const clusterType = ref(props.data.version);

const tabs = computed(() => {
if (!state.version) {
return [props.data.version];
}
return [props.data.version, state.data.version];
});
const cardTitle = computed(() => props.title || t('参数配置'));
// 是否为平台级别配置
const isPlat = computed(() => ConfLevels.PLAT === props.level);
const configItems = computed(() => props.data?.conf_items || []);
const configItems = computed(() => {
if (clusterType.value === props.data.version) {
return props.data.conf_items;
}
return state.data.conf_items;
});
const isShowCharset = computed(() => !!props.data.charset);
const baseInfoColumns = computed(() => {
const baseColumns = [
Expand Down Expand Up @@ -161,6 +192,14 @@
return baseColumns;
});

watch(
() => props.data.version,
() => {
clusterType.value = props.data.version;
},
{ immediate: true },
);

/**
* 基础信息编辑
*/
Expand Down Expand Up @@ -193,7 +232,12 @@
const name = isPlat.value ? 'PlatformDbConfigureEdit' : 'DbConfigureEdit';
router.push({
name,
params: { ...route.params, ...props.routeParams, ...extra },
params: {
...route.params,
...props.routeParams,
...extra,
version: clusterType.value,
},
});
};
</script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@

<template>
<div class="db-configure-readonly-parameters-table">
<div class="mb-16">
<div class="mb-16 operation-box">
<slot name="prefix" />
<BkInput
v-model="search"
class="search-input"
clearable
:placeholder="$t('请输入参数项')"
style="width: 320px" />
Expand Down Expand Up @@ -161,6 +163,14 @@
.db-configure-readonly-parameters-table {
width: 100%;

.operation-box {
display: flex;

.search-input {
margin-left: auto;
}
}

.config-name-box {
display: inline-block;
max-width: calc(100% - 18px);
Expand Down

0 comments on commit 87cbd79

Please sign in to comment.