diff --git a/src/layouts/admin-menu.jsx b/src/layouts/admin-menu.jsx
index 18704b2b..92f3899a 100644
--- a/src/layouts/admin-menu.jsx
+++ b/src/layouts/admin-menu.jsx
@@ -878,39 +878,39 @@ const renderMenu = (t) => {
icon: ,
children: [
{
- path: '/container/containers-admin',
+ path: '/container-service/containers-admin',
name: t('Containers'),
key: 'zunContainersAdmin',
endpoints: 'zun',
level: 1,
children: [
{
- path: /^\/container\/containers-admin\/detail\/.[^/]+$/,
+ path: /^\/container-service\/containers-admin\/detail\/.[^/]+$/,
name: t('Container Detail'),
key: 'zunContainerDetailAdmin',
level: 2,
- routePath: '/container/containers-admin/detail/:id',
+ routePath: '/container-service/containers-admin/detail/:id',
},
],
},
{
- path: '/container/hosts-admin',
+ path: '/container-service/hosts-admin',
name: t('Hosts'),
key: 'zunHostsAdmin',
endpoints: 'zun',
level: 1,
children: [
{
- path: /^\/container\/hosts-admin\/detail\/.[^/]+$/,
+ path: /^\/container-service\/hosts-admin\/detail\/.[^/]+$/,
name: t('Host Detail'),
key: 'zuHostsDetailAdmin',
level: 2,
- routePath: '/container/hosts-admin/detail/:id',
+ routePath: '/container-service/hosts-admin/detail/:id',
},
],
},
{
- path: '/container/services-admin',
+ path: '/container-service/services-admin',
name: t('Services'),
key: 'zunServicesAdmin',
endpoints: 'zun',
diff --git a/src/layouts/menu.jsx b/src/layouts/menu.jsx
index 5c6e8cdb..4517afe6 100644
--- a/src/layouts/menu.jsx
+++ b/src/layouts/menu.jsx
@@ -637,40 +637,40 @@ const renderMenu = (t) => {
icon: ,
children: [
{
- path: '/container/containers',
+ path: '/container-service/containers',
name: t('Containers'),
key: 'zunContainers',
endpoints: 'zun',
level: 1,
children: [
{
- path: '/container/containers/create',
+ path: '/container-service/containers/create',
name: t('Create Container'),
key: 'zunContainersCreateContainer',
level: 2,
},
{
- path: /^\/container\/containers\/detail\/.[^/]+$/,
+ path: /^\/container-service\/containers\/detail\/.[^/]+$/,
name: t('Container Detail'),
key: 'zunContainerDetail',
level: 2,
- routePath: '/container/containers/detail/:id',
+ routePath: '/container-service/containers/detail/:id',
},
],
},
{
- path: '/container/capsules',
+ path: '/container-service/capsules',
name: t('Capsules'),
key: 'zunCapsules',
endpoints: 'zun',
level: 1,
children: [
{
- path: /^\/container\/capsules\/detail\/.[^/]+$/,
+ path: /^\/container-service\/capsules\/detail\/.[^/]+$/,
name: t('Capsule Detail'),
key: 'zunCapsuleDetail',
level: 2,
- routePath: '/container/capsules/detail/:id',
+ routePath: '/container-service/capsules/detail/:id',
},
],
},
diff --git a/src/pages/basic/routes/index.js b/src/pages/basic/routes/index.js
index 01e6c2db..ff58ee7e 100644
--- a/src/pages/basic/routes/index.js
+++ b/src/pages/basic/routes/index.js
@@ -53,7 +53,7 @@ const Share = lazy(() =>
const ContainerInfra = lazy(() =>
import(/* webpackChunkName: "container-infra" */ 'pages/container-infra/App')
);
-const Containers = lazy(() =>
+const ContainerService = lazy(() =>
import(/* webpackChunkName: "Container" */ 'pages/container-service/App')
);
const E404 = lazy(() =>
@@ -113,8 +113,8 @@ export default [
component: ContainerInfra,
},
{
- path: `/container`,
- component: Containers,
+ path: `/container-service`,
+ component: ContainerService,
},
{ path: '*', component: E404 },
],
diff --git a/src/pages/container-service/containers/Capsules/index.jsx b/src/pages/container-service/containers/Capsules/index.jsx
index c4920623..029d3afb 100644
--- a/src/pages/container-service/containers/Capsules/index.jsx
+++ b/src/pages/container-service/containers/Capsules/index.jsx
@@ -36,31 +36,33 @@ export class Capsules extends Base {
return actionConfigs;
}
- getColumns = () => [
- {
- title: t('ID/Name'),
- dataIndex: 'meta_name',
- isLink: true,
- routeName: this.getRouteName('zunCapsuleDetail'),
- idKey: 'uuid',
- },
- {
- title: t('Status'),
- isHideable: true,
- dataIndex: 'status',
- valueMap: capsuleStatus,
- },
- {
- title: t('CPU'),
- isHideable: true,
- dataIndex: 'cpu',
- },
- {
- title: t('Memory'),
- isHideable: true,
- dataIndex: 'memory',
- },
- ];
+ getColumns() {
+ return [
+ {
+ title: t('ID/Name'),
+ dataIndex: 'meta_name',
+ isLink: true,
+ routeName: this.getRouteName('zunCapsuleDetail'),
+ idKey: 'uuid',
+ },
+ {
+ title: t('Status'),
+ isHideable: true,
+ dataIndex: 'status',
+ valueMap: capsuleStatus,
+ },
+ {
+ title: t('CPU'),
+ isHideable: true,
+ dataIndex: 'cpu',
+ },
+ {
+ title: t('Memory'),
+ isHideable: true,
+ dataIndex: 'memory',
+ },
+ ];
+ }
}
export default inject('rootStore')(observer(Capsules));
diff --git a/src/pages/container-service/containers/Containers/Detail/index.jsx b/src/pages/container-service/containers/Containers/Detail/index.jsx
index 45a08c50..e43ada3f 100644
--- a/src/pages/container-service/containers/Containers/Detail/index.jsx
+++ b/src/pages/container-service/containers/Containers/Detail/index.jsx
@@ -59,7 +59,9 @@ export class ContainerDetail extends Base {
}
get showLogs() {
- return checkPolicyRule('container:logs');
+ const { status } = this.detailData || {};
+ const acceptedStatus = ['Created', 'Running', 'Stopped', 'Paused'];
+ return checkPolicyRule('container:logs') && acceptedStatus.includes(status);
}
get tabs() {
diff --git a/src/pages/container-service/containers/Containers/actions/StepCreate/index.jsx b/src/pages/container-service/containers/Containers/actions/StepCreate/index.jsx
index cf66834b..4a3a8f06 100644
--- a/src/pages/container-service/containers/Containers/actions/StepCreate/index.jsx
+++ b/src/pages/container-service/containers/Containers/actions/StepCreate/index.jsx
@@ -34,7 +34,7 @@ export class StepCreate extends StepAction {
static title = t('Create Container');
- static path = '/container/containers/create';
+ static path = '/container-service/containers/create';
static policy = 'container:create';
diff --git a/src/pages/container-service/containers/Containers/index.jsx b/src/pages/container-service/containers/Containers/index.jsx
index c6227d90..f5c51f38 100644
--- a/src/pages/container-service/containers/Containers/index.jsx
+++ b/src/pages/container-service/containers/Containers/index.jsx
@@ -39,36 +39,34 @@ export class Containers extends Base {
return actionConfigs.actionConfigs;
}
- get rowKey() {
- return 'uuid';
+ getColumns() {
+ return [
+ {
+ title: t('ID/Name'),
+ dataIndex: 'name',
+ isLink: true,
+ routeName: this.getRouteName('zunContainerDetail'),
+ idKey: 'uuid',
+ },
+ {
+ title: t('Status'),
+ isHideable: true,
+ dataIndex: 'status',
+ valueMap: containerStatus,
+ },
+ {
+ title: t('Image'),
+ isHideable: true,
+ dataIndex: 'image',
+ },
+ {
+ title: t('Task State'),
+ isHideable: true,
+ dataIndex: 'task_state',
+ valueMap: containerTaskStatus,
+ },
+ ];
}
-
- getColumns = () => [
- {
- title: t('ID/Name'),
- dataIndex: 'name',
- isLink: true,
- routeName: this.getRouteName('zunContainerDetail'),
- idKey: 'uuid',
- },
- {
- title: t('Status'),
- isHideable: true,
- dataIndex: 'status',
- valueMap: containerStatus,
- },
- {
- title: t('Image'),
- isHideable: true,
- dataIndex: 'image',
- },
- {
- title: t('Task State'),
- isHideable: true,
- dataIndex: 'task_state',
- valueMap: containerTaskStatus,
- },
- ];
}
export default inject('rootStore')(observer(Containers));
diff --git a/src/pages/container-service/containers/Hosts/index.jsx b/src/pages/container-service/containers/Hosts/index.jsx
index bd1c515d..dc83982c 100644
--- a/src/pages/container-service/containers/Hosts/index.jsx
+++ b/src/pages/container-service/containers/Hosts/index.jsx
@@ -32,65 +32,70 @@ export class Hosts extends Base {
return 'host:get_all';
}
- getColumns = () => [
- {
- title: t('ID/Name'),
- dataIndex: 'name',
- routeName: 'zuHostsDetailAdmin',
- },
- {
- title: t('Architecture'),
- dataIndex: 'architecture',
- isHideable: true,
- },
- {
- title: t('Total Containers'),
- dataIndex: 'total_containers',
- isHideable: true,
- },
- {
- title: t('CPU (Core)'),
- dataIndex: 'cpu_percent',
- render: (value, record) => (
-
- ),
- width: 180,
- stringify: (value, record) =>
- `${value}% (${t('Used')}: ${record.cpu_used} / ${t('Total')}: ${
- record.cpus
- })`,
- },
- {
- title: t('Configured Memory (GiB)'),
- dataIndex: 'memory_percent',
- render: (value, record) => (
-
- ),
- width: 180,
- stringify: (value, record) =>
- `${value}% (${t('Used')}: ${record.mem_used_gb} / ${t('Total')}: ${
- record.mem_total_gb
- })`,
- },
- {
- title: t('Configured Disk (GiB)'),
- dataIndex: 'disk_percent',
- render: (value, record) => (
-
- ),
- width: 180,
- stringify: (value, record) =>
- `${value}% (${t('Used')}: ${record.disk_used} / ${t('Total')}: ${
- record.disk_total
- })`,
- },
- ];
+ getColumns() {
+ return [
+ {
+ title: t('ID/Name'),
+ dataIndex: 'name',
+ routeName: 'zuHostsDetailAdmin',
+ },
+ {
+ title: t('Architecture'),
+ dataIndex: 'architecture',
+ isHideable: true,
+ },
+ {
+ title: t('Total Containers'),
+ dataIndex: 'total_containers',
+ isHideable: true,
+ },
+ {
+ title: t('CPU (Core)'),
+ dataIndex: 'cpu_percent',
+ render: (value, record) => (
+
+ ),
+ width: 180,
+ stringify: (value, record) =>
+ `${value}% (${t('Used')}: ${record.cpu_used} / ${t('Total')}: ${
+ record.cpus
+ })`,
+ },
+ {
+ title: t('Configured Memory (GiB)'),
+ dataIndex: 'memory_percent',
+ render: (value, record) => (
+
+ ),
+ width: 180,
+ stringify: (value, record) =>
+ `${value}% (${t('Used')}: ${record.mem_used_gb} / ${t('Total')}: ${
+ record.mem_total_gb
+ })`,
+ },
+ {
+ title: t('Configured Disk (GiB)'),
+ dataIndex: 'disk_percent',
+ render: (value, record) => (
+
+ ),
+ width: 180,
+ stringify: (value, record) =>
+ `${value}% (${t('Used')}: ${record.disk_used} / ${t('Total')}: ${
+ record.disk_total
+ })`,
+ },
+ ];
+ }
}
export default inject('rootStore')(observer(Hosts));
diff --git a/src/pages/container-service/containers/Services/index.jsx b/src/pages/container-service/containers/Services/index.jsx
index 4d94fd72..92a9cc9d 100644
--- a/src/pages/container-service/containers/Services/index.jsx
+++ b/src/pages/container-service/containers/Services/index.jsx
@@ -32,50 +32,52 @@ export class Services extends Base {
return 'zun-service:get_all';
}
- getColumns = () => [
- {
- title: t('Name'),
- dataIndex: 'binary',
- },
- {
- title: t('Hosts'),
- dataIndex: 'host',
- isHideable: true,
- },
- {
- title: t('Availability Zone'),
- dataIndex: 'availability_zone',
- isHideable: true,
- },
- {
- title: t('Report Count'),
- dataIndex: 'report_count',
- isHideable: true,
- },
- {
- title: t('Forced Down'),
- dataIndex: 'forced_down',
- valueRender: 'yesNo',
- isHideable: true,
- },
- {
- title: t('Forbidden'),
- dataIndex: 'disabled',
- valueRender: 'yesNo',
- isHideable: true,
- },
- {
- title: t('Service State'),
- dataIndex: 'state',
- valueMap: serviceState,
- },
- {
- title: t('Last Updated'),
- dataIndex: 'updated_at',
- isHideable: true,
- valueRender: 'sinceTime',
- },
- ];
+ getColumns() {
+ return [
+ {
+ title: t('Name'),
+ dataIndex: 'binary',
+ },
+ {
+ title: t('Hosts'),
+ dataIndex: 'host',
+ isHideable: true,
+ },
+ {
+ title: t('Availability Zone'),
+ dataIndex: 'availability_zone',
+ isHideable: true,
+ },
+ {
+ title: t('Report Count'),
+ dataIndex: 'report_count',
+ isHideable: true,
+ },
+ {
+ title: t('Forced Down'),
+ dataIndex: 'forced_down',
+ valueRender: 'yesNo',
+ isHideable: true,
+ },
+ {
+ title: t('Forbidden'),
+ dataIndex: 'disabled',
+ valueRender: 'yesNo',
+ isHideable: true,
+ },
+ {
+ title: t('Service State'),
+ dataIndex: 'state',
+ valueMap: serviceState,
+ },
+ {
+ title: t('Last Updated'),
+ dataIndex: 'updated_at',
+ isHideable: true,
+ valueRender: 'sinceTime',
+ },
+ ];
+ }
}
export default inject('rootStore')(observer(Services));
diff --git a/src/pages/container-service/routes/index.js b/src/pages/container-service/routes/index.js
index b88e8d02..d47f724c 100644
--- a/src/pages/container-service/routes/index.js
+++ b/src/pages/container-service/routes/index.js
@@ -23,7 +23,7 @@ import HostsDetail from '../containers/Hosts/Detail';
import StepCreateContainer from '../containers/Containers/actions/StepCreate';
import Services from '../containers/Services';
-const PATH = '/container';
+const PATH = '/container-service';
export default [
{
path: PATH,
diff --git a/src/stores/zun/capsules.js b/src/stores/zun/capsules.js
index b787ce65..bca7a4ee 100644
--- a/src/stores/zun/capsules.js
+++ b/src/stores/zun/capsules.js
@@ -21,6 +21,13 @@ export class CapsulesStore extends Base {
return client.zun.capsules;
}
+ get mapper() {
+ return (data) => ({
+ ...data,
+ id: data.uuid,
+ });
+ }
+
@action
async create(newbody) {
return this.client.create(newbody);
diff --git a/src/stores/zun/containers.js b/src/stores/zun/containers.js
index f9510344..8039b4ac 100644
--- a/src/stores/zun/containers.js
+++ b/src/stores/zun/containers.js
@@ -22,6 +22,13 @@ export class ContainersStore extends Base {
return client.zun.containers;
}
+ get mapper() {
+ return (data) => ({
+ ...data,
+ id: data.uuid,
+ });
+ }
+
@action
async create(newbody) {
return this.submitting(this.client.create(newbody));
diff --git a/src/stores/zun/services.js b/src/stores/zun/services.js
index e5d1419c..7608394b 100644
--- a/src/stores/zun/services.js
+++ b/src/stores/zun/services.js
@@ -19,6 +19,13 @@ export class ServicesStore extends Base {
get client() {
return client.zun.services;
}
+
+ get mapper() {
+ return (data) => ({
+ ...data,
+ id: data.uuid,
+ });
+ }
}
const globalServicesStore = new ServicesStore();