skyline/src/pages/container-infra/containers/Clusters/Detail/index.jsx
xusongfu 47b3cead09 feature: Support magnum in administrator platform
1. Show list and detail of cluster instance
2. Show list and detail of cluster template
3. Hide the keypair if in administrator platform

Change-Id: I61532a12312383cdedf2fdfca10633b16064f77b
2022-11-18 14:24:13 +08:00

97 lines
2.3 KiB
JavaScript

// Copyright 2021 99cloud
//
// 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 { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
import { clusterStatus, healthStatus } from 'resources/magnum/cluster';
import globalClustersStore from 'src/stores/magnum/clusters';
import { isEmpty } from 'lodash';
import BaseDetail from './BaseDetail';
import actionConfigs from '../actions';
export class ClustersDetail extends Base {
init() {
this.store = globalClustersStore;
}
get name() {
return t('Cluster Detail');
}
get listUrl() {
return this.getRoutePath('containerInfraClusters');
}
get policy() {
return 'cluster:detail';
}
get actionConfigs() {
if (this.isAdminPage) {
return actionConfigs.actionConfigsAdmin;
}
return actionConfigs.actionConfigs;
}
get detailInfos() {
return [
{
title: t('Name'),
dataIndex: 'name',
},
{
title: t('Created'),
dataIndex: 'created_at',
valueRender: 'toLocalTime',
},
{
title: t('Updated'),
dataIndex: 'updated_at',
valueRender: 'toLocalTime',
},
{
title: t('Status'),
dataIndex: 'status',
valueMap: clusterStatus,
},
{
title: t('Status Reason'),
dataIndex: 'status_reason',
},
{
title: t('Health Status'),
dataIndex: 'health_status',
valueMap: healthStatus,
},
{
title: t('Health Status Reason'),
dataIndex: 'health_status_reason',
render: (value) => (isEmpty(value) ? '-' : JSON.stringify(value)),
},
];
}
get tabs() {
return [
{
title: t('Detail'),
key: 'general_info',
component: BaseDetail,
},
];
}
}
export default inject('rootStore')(observer(ClustersDetail));