fix: fix the networks,ports and security groups
1. fix the ports and security groups to link 2. show the networks of the zun container Change-Id: Idc89319379b68822c67c9c036bc3b7cb8cbef15a
This commit is contained in:
parent
b2939b0021
commit
5ad07c694f
@ -156,15 +156,47 @@ export class BaseDetail extends Base {
|
|||||||
dataIndex: 'addresses',
|
dataIndex: 'addresses',
|
||||||
render: this.stringifyContent,
|
render: this.stringifyContent,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: t('Networks'),
|
||||||
|
dataIndex: 'networks',
|
||||||
|
render: (value = []) => (
|
||||||
|
<>
|
||||||
|
{value.map((it) => {
|
||||||
|
const link = this.getLinkRender('networkDetail', it, {
|
||||||
|
id: it,
|
||||||
|
});
|
||||||
|
return <div key={it}>{link}</div>;
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: t('Ports'),
|
label: t('Ports'),
|
||||||
dataIndex: 'ports',
|
dataIndex: 'ports',
|
||||||
render: this.stringifyContent,
|
render: (value = []) => (
|
||||||
|
<>
|
||||||
|
{value.map((it) => {
|
||||||
|
const link = this.getLinkRender('virtualAdapterDetail', it, {
|
||||||
|
id: it,
|
||||||
|
});
|
||||||
|
return <div key={it}>{link}</div>;
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Security Groups'),
|
label: t('Security Groups'),
|
||||||
dataIndex: 'security_groups',
|
dataIndex: 'security_groups',
|
||||||
render: this.stringifyContent,
|
render: (value = []) => (
|
||||||
|
<>
|
||||||
|
{value.map((it) => {
|
||||||
|
const link = this.getLinkRender('securityGroupDetail', it, {
|
||||||
|
id: it,
|
||||||
|
});
|
||||||
|
return <div key={it}>{link}</div>;
|
||||||
|
})}
|
||||||
|
</>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
import Base from 'stores/base';
|
import Base from 'stores/base';
|
||||||
import client from 'client';
|
import client from 'client';
|
||||||
import { action } from 'mobx';
|
import { action } from 'mobx';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
export class ContainersStore extends Base {
|
export class ContainersStore extends Base {
|
||||||
get client() {
|
get client() {
|
||||||
@ -77,12 +78,22 @@ export class ContainersStore extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async detailDidFetch(item) {
|
async detailDidFetch(item) {
|
||||||
const { uuid, status } = item;
|
const { uuid, status, addresses = {} } = item;
|
||||||
let stats = {};
|
let stats = {};
|
||||||
if (status === 'Running') {
|
if (status === 'Running') {
|
||||||
stats = (await this.client.stats.list(uuid)) || {};
|
stats = (await this.client.stats.list(uuid)) || {};
|
||||||
}
|
}
|
||||||
return { ...item, stats };
|
const networks = Object.keys(addresses);
|
||||||
|
let { ports = [] } = item;
|
||||||
|
if (isEmpty(ports)) {
|
||||||
|
ports = Object.values(addresses)
|
||||||
|
.reduce((ret, cur) => {
|
||||||
|
ret = ret.concat(cur);
|
||||||
|
return ret;
|
||||||
|
}, [])
|
||||||
|
.map((it) => it.port);
|
||||||
|
}
|
||||||
|
return { ...item, stats, networks, ports };
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchLogs(id) {
|
async fetchLogs(id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user