Merge "fix: fix the detail info of zun container"
This commit is contained in:
commit
87230c3297
@ -15,6 +15,8 @@
|
|||||||
import Base from 'containers/BaseDetail';
|
import Base from 'containers/BaseDetail';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { inject, observer } from 'mobx-react';
|
import { inject, observer } from 'mobx-react';
|
||||||
|
import { containerStatus } from 'resources/zun/container';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
|
|
||||||
export class BaseDetail extends Base {
|
export class BaseDetail extends Base {
|
||||||
get leftCards() {
|
get leftCards() {
|
||||||
@ -26,11 +28,23 @@ export class BaseDetail extends Base {
|
|||||||
return [this.specCard];
|
return [this.specCard];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get stringifyContent() {
|
||||||
|
return (value) =>
|
||||||
|
isEmpty(value) ? (
|
||||||
|
'-'
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
<pre>{JSON.stringify(value, null, 4)}</pre>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
get baseInfoCard() {
|
get baseInfoCard() {
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
label: t('Status Detail'),
|
label: t('Status Detail'),
|
||||||
dataIndex: 'status_detail',
|
dataIndex: 'status_detail',
|
||||||
|
render: (value) => containerStatus[value] || value,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Status Reason'),
|
label: t('Status Reason'),
|
||||||
@ -43,6 +57,7 @@ export class BaseDetail extends Base {
|
|||||||
{
|
{
|
||||||
label: t('Command'),
|
label: t('Command'),
|
||||||
dataIndex: 'command',
|
dataIndex: 'command',
|
||||||
|
render: this.stringifyContent,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -53,12 +68,6 @@ export class BaseDetail extends Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get miscellaneousCard() {
|
get miscellaneousCard() {
|
||||||
const content = (
|
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(this.detailData.environment, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const options = [
|
const options = [
|
||||||
{
|
{
|
||||||
label: t('Host'),
|
label: t('Host'),
|
||||||
@ -71,7 +80,7 @@ export class BaseDetail extends Base {
|
|||||||
{
|
{
|
||||||
label: t('Environment'),
|
label: t('Environment'),
|
||||||
dataIndex: 'environment',
|
dataIndex: 'environment',
|
||||||
content,
|
render: this.stringifyContent,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Interactive'),
|
label: t('Interactive'),
|
||||||
@ -81,16 +90,7 @@ export class BaseDetail extends Base {
|
|||||||
{
|
{
|
||||||
label: t('Labels'),
|
label: t('Labels'),
|
||||||
dataIndex: 'labels',
|
dataIndex: 'labels',
|
||||||
render: (value) => value['cloud-shell'] || '-',
|
render: this.stringifyContent,
|
||||||
},
|
|
||||||
{
|
|
||||||
label: t('Links'),
|
|
||||||
dataIndex: 'links',
|
|
||||||
render: (value) => (
|
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(value, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -123,25 +123,21 @@ export class BaseDetail extends Base {
|
|||||||
dataIndex: 'runtime',
|
dataIndex: 'runtime',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('CPU'),
|
label: t('CPU (Core)'),
|
||||||
dataIndex: 'cpu',
|
dataIndex: 'cpu',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Memory'),
|
label: t('Memory (MiB)'),
|
||||||
dataIndex: 'memory',
|
dataIndex: 'memory',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Disk'),
|
label: t('Disk (GiB)'),
|
||||||
dataIndex: 'disk',
|
dataIndex: 'disk',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Restart Policy'),
|
label: t('Restart Policy'),
|
||||||
dataIndex: 'restart_policy',
|
dataIndex: 'restart_policy',
|
||||||
render: (value) => (
|
render: this.stringifyContent,
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(value, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Auto Remove'),
|
label: t('Auto Remove'),
|
||||||
@ -154,29 +150,17 @@ export class BaseDetail extends Base {
|
|||||||
{
|
{
|
||||||
label: t('Addresses'),
|
label: t('Addresses'),
|
||||||
dataIndex: 'addresses',
|
dataIndex: 'addresses',
|
||||||
render: (value) => (
|
render: this.stringifyContent,
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(value, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Ports'),
|
label: t('Ports'),
|
||||||
dataIndex: 'ports',
|
dataIndex: 'ports',
|
||||||
render: (value) => (
|
render: this.stringifyContent,
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(value, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: t('Security Groups'),
|
label: t('Security Groups'),
|
||||||
dataIndex: 'security_groups',
|
dataIndex: 'security_groups',
|
||||||
render: (value) => (
|
render: this.stringifyContent,
|
||||||
<div>
|
|
||||||
<pre>{JSON.stringify(value, null, 4)}</pre>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -52,16 +52,16 @@ export class EditContainer extends ModalAction {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cpu',
|
name: 'cpu',
|
||||||
label: t('CPU'),
|
label: t('CPU (Core)'),
|
||||||
type: 'input-int',
|
type: 'input-int',
|
||||||
placeholder: t('The number of virtual cpu for this container'),
|
tip: t('The number of virtual cpu for this container'),
|
||||||
min: 1,
|
min: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'memory',
|
name: 'memory',
|
||||||
label: t('Memory (MiB)'),
|
label: t('Memory (MiB)'),
|
||||||
type: 'input-int',
|
type: 'input-int',
|
||||||
placeholder: t('The container memory size in MiB'),
|
tip: t('The container memory size in MiB'),
|
||||||
min: 4,
|
min: 4,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -58,7 +58,7 @@ export class StepSpec extends Base {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'cpu',
|
name: 'cpu',
|
||||||
label: t('CPU'),
|
label: t('CPU (Core)'),
|
||||||
type: 'input-int',
|
type: 'input-int',
|
||||||
tip: t('The number of virtual cpu for this container'),
|
tip: t('The number of virtual cpu for this container'),
|
||||||
min: 1,
|
min: 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user