diff --git a/releasenotes/notes/Support-magnum-in-administrator-platform-07bc09b2eaeaf87f.yaml b/releasenotes/notes/Support-magnum-in-administrator-platform-07bc09b2eaeaf87f.yaml
new file mode 100644
index 00000000..bb656c56
--- /dev/null
+++ b/releasenotes/notes/Support-magnum-in-administrator-platform-07bc09b2eaeaf87f.yaml
@@ -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
\ No newline at end of file
diff --git a/src/components/DetailCard/index.jsx b/src/components/DetailCard/index.jsx
index da9f8715..fbc76f44 100644
--- a/src/components/DetailCard/index.jsx
+++ b/src/components/DetailCard/index.jsx
@@ -88,14 +88,16 @@ const renderLabel = (option) => {
};
const renderOptions = (options, data, loading, labelCol, contentCol) =>
- options.map((option, index) => (
-
-
- {renderLabel(option)}
- {getContent(data, option)}
-
-
- ));
+ options
+ .filter((option) => !option.hidden)
+ .map((option, index) => (
+
+
+ {renderLabel(option)}
+ {getContent(data, option)}
+
+
+ ));
const DetailCard = ({
title,
diff --git a/src/layouts/admin-menu.jsx b/src/layouts/admin-menu.jsx
index 92472b84..18704b2b 100644
--- a/src/layouts/admin-menu.jsx
+++ b/src/layouts/admin-menu.jsx
@@ -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',
+ },
+ ],
+ },
],
},
];
diff --git a/src/locales/en.json b/src/locales/en.json
index 45e6538b..8135b614 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -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",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 372f11d3..69d90aca 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -361,6 +361,8 @@
"Cluster Detail": "集群详情",
"Cluster Distro": "集群发行版",
"Cluster Info": "集群信息",
+ "Cluster Instance": "集群实例",
+ "Cluster Instance Detail": "集群实例详情",
"Cluster Management": "集群管理",
"Cluster Name": "集群名称",
"Cluster Network": "集群网络",
diff --git a/src/pages/container-infra/containers/ClusterTemplates/Detail/BaseDetail.jsx b/src/pages/container-infra/containers/ClusterTemplates/Detail/BaseDetail.jsx
index 98648485..70bb093d 100644
--- a/src/pages/container-infra/containers/ClusterTemplates/Detail/BaseDetail.jsx
+++ b/src/pages/container-infra/containers/ClusterTemplates/Detail/BaseDetail.jsx
@@ -166,6 +166,7 @@ export class BaseDetail extends Base {
{
label: t('Keypair'),
content: keypairUrl,
+ hidden: this.isAdminPage,
},
{
label: t('Flavor ID'),
diff --git a/src/pages/container-infra/containers/ClusterTemplates/Detail/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/Detail/index.jsx
index fb64ec22..50b92d15 100644
--- a/src/pages/container-infra/containers/ClusterTemplates/Detail/index.jsx
+++ b/src/pages/container-infra/containers/ClusterTemplates/Detail/index.jsx
@@ -34,7 +34,10 @@ export class ClusterTemplateDetail extends Base {
}
get actionConfigs() {
- return actionConfigs;
+ if (this.isAdminPage) {
+ return actionConfigs.actionConfigsAdmin;
+ }
+ return actionConfigs.actionConfigs;
}
get detailInfos() {
diff --git a/src/pages/container-infra/containers/ClusterTemplates/actions/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/actions/index.jsx
index 447eacdc..e11ead85 100644
--- a/src/pages/container-infra/containers/ClusterTemplates/actions/index.jsx
+++ b/src/pages/container-infra/containers/ClusterTemplates/actions/index.jsx
@@ -23,4 +23,13 @@ const actionConfigs = {
primaryActions: [Create],
};
-export default actionConfigs;
+const actionConfigsAdmin = {
+ rowActions: {
+ firstAction: Delete,
+ moreActions: [],
+ },
+ batchActions: [Delete],
+ primaryActions: [],
+};
+
+export default { actionConfigs, actionConfigsAdmin };
diff --git a/src/pages/container-infra/containers/ClusterTemplates/index.jsx b/src/pages/container-infra/containers/ClusterTemplates/index.jsx
index 5451f2ee..ff00fbf7 100644
--- a/src/pages/container-infra/containers/ClusterTemplates/index.jsx
+++ b/src/pages/container-infra/containers/ClusterTemplates/index.jsx
@@ -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);
diff --git a/src/pages/container-infra/containers/Clusters/Detail/BaseDetail.jsx b/src/pages/container-infra/containers/Clusters/Detail/BaseDetail.jsx
index 2d14fc99..049b5242 100644
--- a/src/pages/container-infra/containers/Clusters/Detail/BaseDetail.jsx
+++ b/src/pages/container-infra/containers/Clusters/Detail/BaseDetail.jsx
@@ -105,6 +105,7 @@ export class BaseDetail extends Base {
{
label: t('Keypair'),
content: keypairUrl,
+ hidden: this.isAdminPage,
},
{
label: t('Docker Volume Size (GiB)'),
diff --git a/src/pages/container-infra/containers/Clusters/Detail/index.jsx b/src/pages/container-infra/containers/Clusters/Detail/index.jsx
index 8de0680e..449d3d13 100644
--- a/src/pages/container-infra/containers/Clusters/Detail/index.jsx
+++ b/src/pages/container-infra/containers/Clusters/Detail/index.jsx
@@ -38,7 +38,10 @@ export class ClustersDetail extends Base {
}
get actionConfigs() {
- return actionConfigs;
+ if (this.isAdminPage) {
+ return actionConfigs.actionConfigsAdmin;
+ }
+ return actionConfigs.actionConfigs;
}
get detailInfos() {
diff --git a/src/pages/container-infra/containers/Clusters/actions/index.jsx b/src/pages/container-infra/containers/Clusters/actions/index.jsx
index 54ad6cc8..685946be 100644
--- a/src/pages/container-infra/containers/Clusters/actions/index.jsx
+++ b/src/pages/container-infra/containers/Clusters/actions/index.jsx
@@ -22,4 +22,13 @@ const actionConfigs = {
primaryActions: [Create],
};
-export default actionConfigs;
+const actionConfigsAdmin = {
+ rowActions: {
+ firstAction: Delete,
+ moreActions: [],
+ },
+ batchActions: [Delete],
+ primaryActions: [],
+};
+
+export default { actionConfigs, actionConfigsAdmin };
diff --git a/src/pages/container-infra/containers/Clusters/index.jsx b/src/pages/container-infra/containers/Clusters/index.jsx
index 8e015366..78e5299a 100644
--- a/src/pages/container-infra/containers/Clusters/index.jsx
+++ b/src/pages/container-infra/containers/Clusters/index.jsx
@@ -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 })
diff --git a/src/pages/container-infra/routes/index.js b/src/pages/container-infra/routes/index.js
index 9b091d2b..cba3553e 100644
--- a/src/pages/container-infra/routes/index.js
+++ b/src/pages/container-infra/routes/index.js
@@ -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 },
],
},
diff --git a/src/resources/magnum/template.js b/src/resources/magnum/template.js
index 8c8697ce..c3460edc 100644
--- a/src/resources/magnum/template.js
+++ b/src/resources/magnum/template.js
@@ -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 })