Merge "feat: show stats of a zun container"

This commit is contained in:
Zuul 2022-08-02 11:32:19 +00:00 committed by Gerrit Code Review
commit 5ff60bbec5
5 changed files with 63 additions and 5 deletions

View File

@ -27,12 +27,10 @@ export class ZunClient extends Base {
get resources() {
return [
{
name: 'capsules',
key: 'capsules',
responseKey: 'capsule',
},
{
name: 'containers',
key: 'containers',
responseKey: 'container',
extendOperations: [
@ -69,14 +67,17 @@ export class ZunClient extends Base {
method: 'post',
},
],
subResources: [
{
key: 'stats',
},
],
},
{
name: 'hosts',
key: 'hosts',
responseKey: 'host',
},
{
name: 'quotas',
key: 'quotas',
},
];

View File

@ -191,6 +191,7 @@
"Average PGs per OSD": "Average PGs per OSD",
"Awaiting Transfer": "Awaiting Transfer",
"Azerbaijan": "Azerbaijan",
"BLOCK I/O(B)": "BLOCK I/O(B)",
"Back": "Back",
"Back End": "Back End",
"Back to Home": "Back to Home",
@ -269,6 +270,7 @@
"COE": "COE",
"COE Version": "COE Version",
"CPU": "CPU",
"CPU %": "CPU %",
"CPU (Core)": "CPU (Core)",
"CPU Arch": "CPU Arch",
"CPU Cores": "CPU Cores",
@ -1357,6 +1359,9 @@
"MAC Address": "MAC Address",
"MAC Learning State": "MAC Learning State",
"MAPRFS": "MAPRFS",
"MEM %": "MEM %",
"MEM LIMIT(MiB)": "MEM LIMIT(MiB)",
"MEM USAGE(MiB)": "MEM USAGE(MiB)",
"MTU": "MTU",
"Mac Address": "Mac Address",
"MacVTap": "MacVTap",
@ -1471,6 +1476,7 @@
"MySQL Actions": "MySQL Actions",
"Myanmar": "Myanmar",
"N/A": "N/A",
"NET I/O(B)": "NET I/O(B)",
"NFS": "NFS",
"NOOP": "NOOP",
"NUMA Node": "NUMA Node",
@ -2151,6 +2157,7 @@
"Startup Parameters": "Startup Parameters",
"State": "State",
"Static Routes": "Static Routes",
"Stats Information": "Stats Information",
"Status": "Status",
"Status Code": "Status Code",
"Status Detail": "Status Detail",

View File

@ -191,6 +191,7 @@
"Average PGs per OSD": "每个OSD平均PG数量",
"Awaiting Transfer": "等待转让",
"Azerbaijan": "阿塞拜疆",
"BLOCK I/O(B)": "块 I/O(B)",
"Back": "返回",
"Back End": "后端",
"Back to Home": "返回首页",
@ -269,6 +270,7 @@
"COE": "COE",
"COE Version": "COE版本",
"CPU": "CPU",
"CPU %": "CPU使用率(%)",
"CPU (Core)": "CPU (核)",
"CPU Arch": "CPU架构",
"CPU Cores": "CPU核数",
@ -1357,6 +1359,9 @@
"MAC Address": "MAC地址",
"MAC Learning State": "MAC学习状态",
"MAPRFS": "",
"MEM %": "内存使用率(%)",
"MEM LIMIT(MiB)": "总内存(MiB)",
"MEM USAGE(MiB)": "已用内存(MiB)",
"MTU": "",
"Mac Address": "Mac地址",
"MacVTap": "",
@ -1471,6 +1476,7 @@
"MySQL Actions": "",
"Myanmar": "缅甸",
"N/A": "",
"NET I/O(B)": "网络 I/O(B)",
"NFS": "",
"NOOP": "",
"NUMA Node": "NUMA节点",
@ -2151,6 +2157,7 @@
"Startup Parameters": "启动参数",
"State": "状态",
"Static Routes": "静态路由",
"Stats Information": "统计信息",
"Status": "状态",
"Status Code": "状态码",
"Status Detail": "状态详情",

View File

@ -20,7 +20,7 @@ import { isEmpty } from 'lodash';
export class BaseDetail extends Base {
get leftCards() {
const cards = [this.baseInfoCard, this.miscellaneousCard];
const cards = [this.baseInfoCard, this.statsCard, this.miscellaneousCard];
return cards;
}
@ -170,6 +170,43 @@ export class BaseDetail extends Base {
options,
};
}
get statsCard() {
const options = [
{
label: t('BLOCK I/O(B)'),
dataIndex: 'BLOCK I/O(B)',
},
{
label: t('NET I/O(B)'),
dataIndex: 'NET I/O(B)',
},
{
label: t('CPU %'),
dataIndex: 'CPU %',
render: (value = 0) => value.toFixed(4),
},
{
label: t('MEM LIMIT(MiB)'),
dataIndex: 'MEM LIMIT(MiB)',
},
{
label: t('MEM USAGE(MiB)'),
dataIndex: 'MEM USAGE(MiB)',
render: (value = 0) => value.toFixed(4),
},
{
label: t('MEM %'),
dataIndex: 'MEM %',
render: (value = 0) => value.toFixed(4),
},
];
return {
title: t('Stats Information'),
options,
};
}
}
export default inject('rootStore')(observer(BaseDetail));

View File

@ -75,6 +75,12 @@ export class ContainersStore extends Base {
async execute(id, data) {
return this.client.execute(id, data);
}
async detailDidFetch(item) {
const { uuid } = item;
const stats = (await this.client.stats.list(uuid)) || {};
return { ...item, ...stats };
}
}
const globalContainersStore = new ContainersStore();