mirror of
https://github.com/portainer/portainer.git
synced 2025-08-01 20:05:23 +02:00
fix(docker/container): container logs viewer error when logging is disabled (#10384)
* fix(docker/container-logs): invalid string breadcrumb * fix(docker/container): let docker select the logging driver by default on container create * fix(docker/container-logs): information panel in container logs when logging is disabled * fix(docker/container): dont include HostConfig.LogConfig if no driver is selected
This commit is contained in:
parent
d678b155ba
commit
ada6b31f69
9 changed files with 74 additions and 6 deletions
|
@ -6,6 +6,7 @@ import { ListView } from '@/react/docker/containers/ListView';
|
|||
import { withCurrentUser } from '@/react-tools/withCurrentUser';
|
||||
import { withReactQuery } from '@/react-tools/withReactQuery';
|
||||
import { withUIRouter } from '@/react-tools/withUIRouter';
|
||||
import { LogView } from '@/react/docker/containers/LogView';
|
||||
|
||||
export const containersModule = angular
|
||||
.module('portainer.docker.react.views.containers', [])
|
||||
|
@ -13,6 +14,13 @@ export const containersModule = angular
|
|||
'containersView',
|
||||
r2a(withUIRouter(withReactQuery(withCurrentUser(ListView))), ['endpoint'])
|
||||
)
|
||||
// the view only contains the information panel when logging is disabled
|
||||
// this is a temporary solution to avoid creating a publicly exposed component
|
||||
// or an AngularJS component until the logs view is migrated to React
|
||||
.component(
|
||||
'containerLogView',
|
||||
r2a(withUIRouter(withReactQuery(withCurrentUser(LogView))), [])
|
||||
)
|
||||
|
||||
.config(config).name;
|
||||
|
||||
|
|
|
@ -75,7 +75,13 @@ angular.module('portainer.docker').controller('ContainerLogsController', [
|
|||
.then(function success(data) {
|
||||
var container = data;
|
||||
$scope.container = container;
|
||||
startLogPolling(!container.Config.Tty);
|
||||
|
||||
const logsEnabled = container.HostConfig && container.HostConfig.LogConfig && container.HostConfig.LogConfig.Type && container.HostConfig.LogConfig.Type !== 'none';
|
||||
$scope.logsEnabled = logsEnabled;
|
||||
|
||||
if (logsEnabled) {
|
||||
startLogPolling(!container.Config.Tty);
|
||||
}
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to retrieve container information');
|
||||
|
|
|
@ -5,14 +5,16 @@
|
|||
{
|
||||
label:(container.Name | trimcontainername),
|
||||
link: 'docker.containers.container',
|
||||
linkParams:container.Id
|
||||
linkParams: { id: container.Id }
|
||||
}, 'Logs']"
|
||||
>
|
||||
</page-header>
|
||||
|
||||
<container-log-view ng-if="!logsEnabled"></container-log-view>
|
||||
|
||||
<log-viewer
|
||||
data="logs"
|
||||
ng-if="logs"
|
||||
ng-if="logs && logsEnabled"
|
||||
log-collection-change="changeLogCollection"
|
||||
display-timestamps="state.displayTimestamps"
|
||||
line-count="state.lineCount"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue