diff --git a/src/client/zun/index.js b/src/client/zun/index.js
index 1cd2a76e..6f0b701d 100644
--- a/src/client/zun/index.js
+++ b/src/client/zun/index.js
@@ -76,6 +76,9 @@ export class ZunClient extends Base {
key: 'container_actions',
responseKey: 'containerAction',
},
+ {
+ key: 'logs',
+ },
],
},
{
diff --git a/src/locales/en.json b/src/locales/en.json
index 3e6337dc..936e9973 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -1533,6 +1533,7 @@
"Nigeria": "Nigeria",
"No": "No",
"No Console": "No Console",
+ "No Logs...": "No Logs...",
"No Monitor": "No Monitor",
"No Outputs": "No Outputs",
"No Proxy": "No Proxy",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 58ff205e..3f439189 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -1533,6 +1533,7 @@
"Nigeria": "尼日利亚",
"No": "否",
"No Console": "",
+ "No Logs...": "暂无日志...",
"No Monitor": "无监控",
"No Outputs": "无输出",
"No Proxy": "非代理",
diff --git a/src/pages/container-service/containers/Containers/Detail/Logs.jsx b/src/pages/container-service/containers/Containers/Detail/Logs.jsx
new file mode 100644
index 00000000..5f5d755e
--- /dev/null
+++ b/src/pages/container-service/containers/Containers/Detail/Logs.jsx
@@ -0,0 +1,44 @@
+// 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 React, { useEffect, useState } from 'react';
+import globalContainersStore from 'stores/zun/containers';
+
+export default function Logs(props) {
+ const [logs, setLogs] = useState('');
+ const [loading, setLoading] = useState(true);
+
+ useEffect(() => {
+ const getLogs = async () => {
+ setLoading(true);
+ const cb = await globalContainersStore.fetchLogs(props.detail.uuid);
+ setLogs(cb);
+ setLoading(false);
+ };
+ getLogs();
+ }, []);
+
+ return (
+
+ {logs || loading ?
{logs}
: t('No Logs...')}
+
+ );
+}
diff --git a/src/pages/container-service/containers/Containers/Detail/index.jsx b/src/pages/container-service/containers/Containers/Detail/index.jsx
index 28fbc781..8b348f6d 100644
--- a/src/pages/container-service/containers/Containers/Detail/index.jsx
+++ b/src/pages/container-service/containers/Containers/Detail/index.jsx
@@ -14,9 +14,11 @@ import { inject, observer } from 'mobx-react';
import Base from 'containers/TabDetail';
import globalContainersStore from 'src/stores/zun/containers';
import { containerStatus } from 'resources/zun/container';
+import { checkPolicyRule } from 'resources/skyline/policy';
import actionConfigs from '../actions';
import BaseDetail from './BaseDetail';
import ActionLogs from './ActionLogs';
+import Logs from './Logs';
export class ContainerDetail extends Base {
init() {
@@ -56,8 +58,12 @@ export class ContainerDetail extends Base {
];
}
+ get showLogs() {
+ return checkPolicyRule('container:logs');
+ }
+
get tabs() {
- return [
+ const items = [
{
title: t('Detail'),
key: 'general_info',
@@ -69,6 +75,14 @@ export class ContainerDetail extends Base {
component: ActionLogs,
},
];
+ if (this.showLogs) {
+ items.push({
+ title: t('Logs'),
+ key: 'logs',
+ component: Logs,
+ });
+ }
+ return items;
}
}
diff --git a/src/resources/zun/actions.jsx b/src/resources/zun/actions.jsx
index ed5632a2..e8de4291 100644
--- a/src/resources/zun/actions.jsx
+++ b/src/resources/zun/actions.jsx
@@ -24,7 +24,6 @@ export const actionEvent = {
compute__do_container_restart: t('Restart Container'),
compute__do_container_pause: t('Pause Container'),
compute__do_container_unpause: t('Unpause Container'),
- compute__do_container_resize: t('Resize Container'),
compute__do_container_rebuild: t('Rebuild Container'),
compute__do_container_kill: t('Kill Container'),
compute__do_container_delete: t('Delete Container'),
diff --git a/src/stores/zun/containers.js b/src/stores/zun/containers.js
index e68013db..887e56db 100644
--- a/src/stores/zun/containers.js
+++ b/src/stores/zun/containers.js
@@ -81,6 +81,11 @@ export class ContainersStore extends Base {
const stats = (await this.client.stats.list(uuid)) || {};
return { ...item, ...stats };
}
+
+ async fetchLogs(id) {
+ const logs = await this.client.logs.list(id);
+ return logs;
+ }
}
const globalContainersStore = new ContainersStore();