Files
agent_coder a60b7be55d fix(#6): address review — hook reconnect/trim tests, sticky error banner, stale comment
- F1: cover the hook's riskiest path — a following stream that ends with an
  unwritten tail fragment then resumes (tail:0 + nano-since), asserting the
  fragment is dropped, resume params are correct, and the boundary line is
  deduped to one; plus MAX_LOG_LINES head-trim and buffer reset on
  resourceId/lineCount change.
- F2: clear the error banner on a SUCCESSFUL reconnect (via a new onOpen signal
  on StreamLogsFn), not only when new lines arrive — an idle-but-healthy
  reconnect no longer leaves a stuck 'unable to stream' banner.
- F4: update the stale comment in the React logs view registration (the React
  logs migration is now complete).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 20:55:15 +03:00

132 lines
3.5 KiB
TypeScript

import { StateRegistry } from '@uirouter/angularjs';
import angular from 'angular';
import { r2a } from '@/react-tools/react2angular';
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';
import { CreateView } from '@/react/docker/containers/CreateView';
import { InspectView } from '@/react/docker/containers/InspectView/InspectView';
import { ItemView } from '@/react/docker/containers/ItemView/ItemView';
export const containersModule = angular
.module('portainer.docker.react.views.containers', [])
.component(
'createContainerView',
r2a(withUIRouter(withCurrentUser(CreateView)), [])
)
.component(
'containersView',
r2a(withUIRouter(withReactQuery(withCurrentUser(ListView))), ['endpoint'])
)
.component(
'containerItemView',
r2a(withUIRouter(withCurrentUser(ItemView)), [])
)
// LogView renders the full React log viewer (streaming + snapshot); it falls
// back to an information panel only when logging is disabled for the container.
.component(
'containerLogView',
r2a(withUIRouter(withReactQuery(withCurrentUser(LogView))), [])
)
.component(
'dockerContainerInspectView',
r2a(withUIRouter(withReactQuery(withCurrentUser(InspectView))), [])
)
.config(config).name;
/* @ngInject */
function config($stateRegistryProvider: StateRegistry) {
$stateRegistryProvider.register({
name: 'docker.containers',
url: '/containers',
views: {
'content@': {
component: 'containersView',
},
},
data: {
docs: '/user/docker/containers',
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container',
url: '/:id?nodeName',
views: {
'content@': {
component: 'containerItemView',
},
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container.attach',
url: '/attach',
views: {
'content@': {
templateUrl: '~@/docker/views/containers/console/attach.html',
controller: 'ContainerConsoleController',
},
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container.exec',
url: '/exec',
views: {
'content@': {
templateUrl: '~@/docker/views/containers/console/exec.html',
controller: 'ContainerConsoleController',
},
},
});
$stateRegistryProvider.register({
name: 'docker.containers.new',
url: '/new?nodeName&from',
views: {
'content@': {
component: 'createContainerView',
},
},
data: {
docs: '/user/docker/containers/add',
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container.inspect',
url: '/inspect',
views: {
'content@': {
component: 'dockerContainerInspectView',
},
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container.logs',
url: '/logs',
views: {
'content@': {
templateUrl: '~@/docker/views/containers/logs/containerlogs.html',
controller: 'ContainerLogsController',
},
},
});
$stateRegistryProvider.register({
name: 'docker.containers.container.stats',
url: '/stats',
views: {
'content@': {
templateUrl: '~@/docker/views/containers/stats/containerstats.html',
controller: 'ContainerStatsController',
},
},
});
}