refactor(logs): collapse no-op ternary, drop speculative export, fix stale comment (F8,F9,F10)

F8: formatJSONLogs plain-text fallback — both arms of `withTimestamps ? rawText
    : text` yield rawText (text === rawText when !withTimestamps), so use rawText.
F9: controllerLogsController comment referenced the old 'Live logs' label removed
    by F7 — update it to 'Auto-refresh logs'.
F10: stripHeadersFunc has no external importers — drop the speculative export.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude code agent
2026-06-29 15:37:37 +03:00
parent d520aec159
commit da6933c218
3 changed files with 3 additions and 3 deletions
@@ -35,7 +35,7 @@ export function formatJSONLine(
// parses to a string, whose `Object.keys` is `['0','1',...]` — which used to
// render as `0=h 1=e ...`. Fall back to the plain-text path in that case.
if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
const plain = withTimestamps ? rawText : text;
const plain = rawText;
return [{ line: plain, spans: [{ text: plain }] }];
}
const json = parsed as JSONLogs;
+1 -1
View File
@@ -139,7 +139,7 @@ export function formatLogs(
// services for container/service/task logs) where every line starts on a frame
// boundary. The live-stream path (logStream.ts) demuxes frames at the byte
// level instead and calls formatLogs WITHOUT `stripHeaders`.
export function stripHeadersFunc(logs: string) {
function stripHeadersFunc(logs: string) {
return logs.substring(8).replace(/\r?\n(.{8})/g, '\n');
}
@@ -46,7 +46,7 @@ angular.module('portainer.docker').controller('ContainerLogsController', [
errorNotified: false,
};
// Live toggle (the "Live logs" switch in the viewer).
// Live toggle (the "Auto-refresh logs" switch in the viewer).
$scope.changeLogCollection = function (logCollectionStatus) {
if (!logCollectionStatus) {
pauseStream();