forked from TencentBlueKing/blueking-dbm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend): mongodb实例视图 TencentBlueKing#2920
- Loading branch information
1 parent
40dda8f
commit e2ee6d5
Showing
21 changed files
with
1,130 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
dbm-ui/frontend/src/layout/components/database-manage/components/module-group/MongoDB.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<template> | ||
<FunController module-id="mongodb"> | ||
<BkMenuGroup name="mongodb"> | ||
<BkSubmenu | ||
:title="t('集群管理')"> | ||
<template #icon> | ||
<DbIcon type="cluster" /> | ||
</template> | ||
<BkMenuItem key="mongodbInstance"> | ||
<span | ||
v-overflow-tips.right | ||
class="text-overflow"> | ||
{{ t('实例视图') }} | ||
</span> | ||
</BkMenuItem> | ||
</BkSubmenu> | ||
</BkMenuGroup> | ||
</FunController> | ||
</template> | ||
<script setup lang="ts"> | ||
import { useI18n } from 'vue-i18n'; | ||
const { t } = useI18n(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,4 +81,4 @@ | |
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
dbm-ui/frontend/src/services/model/mongodb/mongodb-instance-detail.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
export default class mongodbInstanceDetail { | ||
bk_agent_id: string; | ||
bk_cloud_id: number; | ||
bk_cloud_name: string; | ||
bk_cpu: number; | ||
bk_disk: number; | ||
bk_host_id: number; | ||
bk_host_innerip: string; | ||
bk_idc_id: string; | ||
bk_idc_name: string; | ||
bk_mem: number; | ||
bk_os_name: string; | ||
cluster_id: number; | ||
cluster_name: string; | ||
cluster_type: string; | ||
create_at: string; | ||
db_module_id: number; | ||
db_version: null; | ||
id: number; | ||
instance_address: string; | ||
ip: string; | ||
machine_type: string; | ||
master_domain: string; | ||
port: number; | ||
role: string; | ||
shard: string; | ||
slave_domain: string; | ||
spec_config: string; | ||
status: string; | ||
version: string; | ||
|
||
constructor(payload: mongodbInstanceDetail) { | ||
this.bk_agent_id = payload.bk_agent_id; | ||
this.bk_cloud_id = payload.bk_cloud_id; | ||
this.bk_cloud_name = payload.bk_cloud_name; | ||
this.bk_cpu = payload.bk_cpu; | ||
this.bk_disk = payload.bk_disk; | ||
this.bk_host_id = payload.bk_host_id; | ||
this.bk_host_innerip = payload.bk_host_innerip; | ||
this.bk_idc_id = payload.bk_idc_id; | ||
this.bk_idc_name = payload.bk_idc_name; | ||
this.bk_mem = payload.bk_mem; | ||
this.bk_os_name = payload.bk_os_name; | ||
this.cluster_id = payload.cluster_id; | ||
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; | ||
this.db_version = payload.db_version; | ||
this.id = payload.id; | ||
this.instance_address = payload.instance_address; | ||
this.ip = payload.ip; | ||
this.machine_type = payload.machine_type; | ||
this.master_domain = payload.master_domain; | ||
this.port = payload.port; | ||
this.role = payload.role; | ||
this.shard = payload.shard; | ||
this.slave_domain = payload.slave_domain; | ||
this.spec_config = payload.spec_config; | ||
this.status = payload.status; | ||
this.version = payload.version; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
dbm-ui/frontend/src/services/model/mongodb/mongodb-instance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import dayjs from 'dayjs'; | ||
|
||
import { t } from '@locales'; | ||
|
||
export default class mongodbInstance { | ||
static themes: Record<string, string> = { | ||
running: 'success', | ||
}; | ||
static statusMap: Record<string, string> = { | ||
running: t('正常'), | ||
unavailable: t('异常'), | ||
}; | ||
|
||
bk_cloud_id: number; | ||
bk_cloud_name: string; | ||
bk_host_id: number; | ||
cluster_id: number; | ||
cluster_name: string; | ||
cluster_type: string; | ||
create_at: string; | ||
db_module_id: string; | ||
id: number; | ||
instance_address: string; | ||
ip: number; | ||
machine_type: string; | ||
master_domain: string; | ||
operations: Array<{ | ||
flow_id: string; | ||
instance_id: number; | ||
operator: number; | ||
status: string; | ||
ticket_id: number; | ||
ticket_type: string; | ||
title: string; | ||
}>; | ||
port: number; | ||
role: string; | ||
shard: string; | ||
slave_domain: string; | ||
spec_config: string; | ||
status: string; | ||
version: string; | ||
|
||
constructor(payload = {} as 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.cluster_id = payload.cluster_id; | ||
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; | ||
this.id = payload.id; | ||
this.instance_address = payload.instance_address; | ||
this.ip = payload.ip; | ||
this.machine_type = payload.machine_type; | ||
this.master_domain = payload.master_domain; | ||
this.operations = payload.operations || []; | ||
this.port = payload.port; | ||
this.role = payload.role; | ||
this.shard = payload.shard; | ||
this.slave_domain = payload.slave_domain; | ||
this.spec_config = payload.spec_config; | ||
this.status = payload.status; | ||
this.version = payload.version; | ||
} | ||
|
||
get isNew() { | ||
return dayjs().isBefore(dayjs(this.create_at).add(24, 'hour')); | ||
} | ||
|
||
get dbStatusConfigureObj() { | ||
const text = mongodbInstance.statusMap[this.status] || '--'; | ||
const theme = mongodbInstance.themes[this.status] || 'danger'; | ||
return { text, theme }; | ||
} | ||
|
||
get clusterTypeText() { | ||
return this.cluster_type === 'MongoReplicaSet' ? t('副本集') : t('分片集群'); | ||
} | ||
} |
Oops, something went wrong.