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
This commit is contained in:
xusongfu 2022-11-18 11:17:32 +08:00
parent 9df7b6ca0f
commit 47b3cead09
15 changed files with 120 additions and 14 deletions

View File

@ -0,0 +1,10 @@
---
features:
- |
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

View File

@ -88,7 +88,9 @@ const renderLabel = (option) => {
};
const renderOptions = (options, data, loading, labelCol, contentCol) =>
options.map((option, index) => (
options
.filter((option) => !option.hidden)
.map((option, index) => (
<Skeleton loading={loading} key={`detail-row-${index}`}>
<Row className={classnames(styles['card-item'], 'sl-card-item')}>
<Col span={labelCol}>{renderLabel(option)}</Col>

View File

@ -916,6 +916,38 @@ const renderMenu = (t) => {
endpoints: 'zun',
level: 1,
},
{
path: '/container-infra/clusters-admin',
name: t('Cluster Instance'),
key: 'containerInfraClustersAdmin',
endpoints: 'magnum',
level: 1,
children: [
{
path: /^\/container-infra\/clusters-admin\/detail\/.[^/]+$/,
name: t('Cluster Instance Detail'),
key: 'containerInfraClusterDetailAdmin',
level: 2,
routePath: '/container-infra/clusters-admin/detail/:id',
},
],
},
{
path: '/container-infra/cluster-template-admin',
name: t('Cluster Templates'),
key: 'clusterTemplateAdmin',
endpoints: 'magnum',
level: 1,
children: [
{
path: /^\/container-infra\/cluster-template-admin\/detail\/.[^/]+$/,
name: t('Cluster Template Detail'),
key: 'containerInfraClusterTemplateDetailAdmin',
level: 2,
routePath: '/container-infra/cluster-template-admin/detail/:id',
},
],
},
],
},
];

View File

@ -361,6 +361,8 @@
"Cluster Detail": "Cluster Detail",
"Cluster Distro": "Cluster Distro",
"Cluster Info": "Cluster Info",
"Cluster Instance": "Cluster Instance",
"Cluster Instance Detail": "Cluster Instance Detail",
"Cluster Management": "Cluster Management",
"Cluster Name": "Cluster Name",
"Cluster Network": "Cluster Network",

View File

@ -361,6 +361,8 @@
"Cluster Detail": "集群详情",
"Cluster Distro": "集群发行版",
"Cluster Info": "集群信息",
"Cluster Instance": "集群实例",
"Cluster Instance Detail": "集群实例详情",
"Cluster Management": "集群管理",
"Cluster Name": "集群名称",
"Cluster Network": "集群网络",

View File

@ -166,6 +166,7 @@ export class BaseDetail extends Base {
{
label: t('Keypair'),
content: keypairUrl,
hidden: this.isAdminPage,
},
{
label: t('Flavor ID'),

View File

@ -34,7 +34,10 @@ export class ClusterTemplateDetail extends Base {
}
get actionConfigs() {
return actionConfigs;
if (this.isAdminPage) {
return actionConfigs.actionConfigsAdmin;
}
return actionConfigs.actionConfigs;
}
get detailInfos() {

View File

@ -23,4 +23,13 @@ const actionConfigs = {
primaryActions: [Create],
};
export default actionConfigs;
const actionConfigsAdmin = {
rowActions: {
firstAction: Delete,
moreActions: [],
},
batchActions: [Delete],
primaryActions: [],
};
export default { actionConfigs, actionConfigsAdmin };

View File

@ -30,8 +30,15 @@ export class ClusterTemplates extends Base {
return 'clustertemplate:get_all';
}
get fetchDataByAllProjects() {
return false;
}
get actionConfigs() {
return actionConfigs;
if (this.isAdminPage) {
return actionConfigs.actionConfigsAdmin;
}
return actionConfigs.actionConfigs;
}
getColumns = () => getBaseTemplateColumns(this);

View File

@ -105,6 +105,7 @@ export class BaseDetail extends Base {
{
label: t('Keypair'),
content: keypairUrl,
hidden: this.isAdminPage,
},
{
label: t('Docker Volume Size (GiB)'),

View File

@ -38,7 +38,10 @@ export class ClustersDetail extends Base {
}
get actionConfigs() {
return actionConfigs;
if (this.isAdminPage) {
return actionConfigs.actionConfigsAdmin;
}
return actionConfigs.actionConfigs;
}
get detailInfos() {

View File

@ -22,4 +22,13 @@ const actionConfigs = {
primaryActions: [Create],
};
export default actionConfigs;
const actionConfigsAdmin = {
rowActions: {
firstAction: Delete,
moreActions: [],
},
batchActions: [Delete],
primaryActions: [],
};
export default { actionConfigs, actionConfigsAdmin };

View File

@ -32,8 +32,15 @@ export class Clusters extends Base {
return 'cluster:get_all';
}
get fetchDataByAllProjects() {
return false;
}
get actionConfigs() {
return actionConfigs;
if (this.isAdminPage) {
return actionConfigs.actionConfigsAdmin;
}
return actionConfigs.actionConfigs;
}
getColumns = () => [
@ -58,6 +65,7 @@ export class Clusters extends Base {
title: t('Keypair'),
isHideable: true,
dataIndex: 'keypair',
hidden: this.isAdminPage,
render: (value) => {
return value
? this.getLinkRender('keypairDetail', value, { id: value })

View File

@ -39,6 +39,12 @@ export default [
component: ClustersCreate,
exact: true,
},
{ path: `${PATH}/clusters-admin`, component: Clusters, exact: true },
{
path: `${PATH}/clusters-admin/detail/:id`,
component: ClustersDetail,
exact: true,
},
{
path: `${PATH}/cluster-template`,
component: ClusterTemplates,
@ -59,6 +65,16 @@ export default [
component: ClusterTemplateUpdate,
exact: true,
},
{
path: `${PATH}/cluster-template-admin`,
component: ClusterTemplates,
exact: true,
},
{
path: `${PATH}/cluster-template-admin/detail/:id`,
component: ClusterTemplateDetail,
exact: true,
},
{ path: '*', component: E404 },
],
},

View File

@ -32,6 +32,7 @@ export const getBaseTemplateColumns = (self) => [
title: t('Keypair'),
isHideable: true,
dataIndex: 'keypair_id',
hidden: self.isAdminPage,
render: (value) => {
return value
? self.getLinkRender('keypairDetail', value, { id: value })