skyline/src/pages/container-service/containers/Capsules/Detail/BaseDetail.jsx
Reşit Demir d4ae10a03c Add Zun UI to Skyline-Console
Change-Id: I6e52db8547e8bfb1379320c8ff4d16952f3faac3
2022-05-24 16:20:59 +00:00

136 lines
2.9 KiB
JavaScript

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Base from 'containers/BaseDetail';
import React from 'react';
import { inject, observer } from 'mobx-react';
export class BaseDetail extends Base {
get leftCards() {
const cards = [this.baseInfoCard, this.containersCard];
return cards;
}
get rightCards() {
return [this.specCard];
}
get baseInfoCard() {
const options = [
{
label: t('ID'),
dataIndex: 'uuid',
},
{
label: t('Name'),
dataIndex: 'meta_name',
},
{
label: t('Status'),
dataIndex: 'status',
},
{
label: t('Status Reason'),
dataIndex: 'status_reason',
},
{
label: t('Created'),
dataIndex: 'created_at',
},
{
label: t('Updated'),
dataIndex: 'updated_at',
},
{
label: t('Project ID'),
dataIndex: 'project_id',
},
{
label: t('User ID'),
dataIndex: 'user_id',
},
];
return {
title: t('Cluster Type'),
options,
};
}
get containersCard() {
const options = [
{
label: t('Containers'),
dataIndex: 'containers',
render: (value) =>
value.map((it) => {
return (
<React.Fragment>
<b>Name</b> : {it.name} <br /> <b>Container ID</b> : {it.uuid}
</React.Fragment>
);
}),
},
];
return {
title: t('Containers'),
options,
};
}
get specCard() {
const options = [
{
label: t('CPU'),
dataIndex: 'cpu',
},
{
label: t('Memory'),
dataIndex: 'memory',
},
{
label: t('Restart Policy'),
dataIndex: 'restart_policy',
},
{
label: t('Labels'),
dataIndex: 'labels',
render: (value) => value || ' - ',
},
{
label: t('Links'),
dataIndex: 'links',
render: (value) =>
value.map((it) => {
return (
<div>
{it.href} : {it.rel}
</div>
);
}),
},
{
label: t('Addresses'),
dataIndex: 'addresses',
render: (value) => (value.length != null ? value : '-'),
},
];
return {
title: t('Spec'),
options,
};
}
}
export default inject("rootStore")(observer(BaseDetail))