Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: stop project log panel from recursing on viewer stop callback (#3927)
Kyle Mendelle8cc329c1042
diff --git a/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte b/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelteindex 8f15796a2..2e7ebfd4c 100644--- a/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte+++ b/frontend/src/routes/(app)/projects/components/ProjectLogsPanel.svelte@@ -24,17 +24,16 @@let hasAutoStarted = $state(false);function handleStart() {- isStreaming = true;+ if (!isRunning) return;viewer?.startLogStream();}function handleStop() {- isStreaming = false;viewer?.stopLogStream();}async function handleRefresh() {- await viewer?.clearLogs({ hard: true, restart: true });+ await viewer?.clearLogs({ hard: true, restart: isRunning });}// The panel stays visible while the project is stopped; the stream pauses and@@ -67,7 +66,7 @@mobileLayout="full"showDesktop={false}{isStreaming}- disabled={!projectId}+ disabled={!projectId || !isRunning}onStart={handleStart}onStop={handleStop}onRefresh={handleRefresh}@@ -81,7 +80,7 @@{preferences}mobileLayout="none"{isStreaming}- disabled={!projectId}+ disabled={!projectId || !isRunning}onStart={handleStart}onStop={handleStop}onRefresh={handleRefresh}@@ -101,8 +100,8 @@maxLines={500}showTimestamps={true}height="100%"- onStart={handleStart}- onStop={handleStop}+ onStart={() => (isStreaming = true)}+ onStop={() => (isStreaming = false)}/></Card.Content></Card.Root>diff --git a/tests/spec/project.spec.ts b/tests/spec/project.spec.tsindex 255a69075..c302c384e 100644--- a/tests/spec/project.spec.ts+++ b/tests/spec/project.spec.ts@@ -1597,13 +1597,46 @@ test.describe('Project Detail Page', () => {).toBeVisible();await expect(page.getByTitle('Refresh')).toBeVisible();- const startButton = page.getByRole('button', { name: 'Start', exact: true });+ const logViewer = page.getByRole('log');+ const startButton = page+ .getByRole('button', { name: 'Start', exact: true })+ .filter({ visible: true })+ .first();+ const stopButton = page+ .getByRole('button', { name: 'Stop', exact: true })+ .filter({ visible: true })+ .first();+if ((await startButton.count()) > 0) {- await startButton.first().click();+ await startButton.click();}+ await expect(logViewer).toHaveAttribute('data-is-streaming', 'true');+ await expect(stopButton).toBeVisible();++ await stopButton.click();+ await expect(logViewer).toHaveAttribute('data-is-streaming', 'false');+ await expect(startButton).toBeEnabled();++ await startButton.click();+ await expect(logViewer).toHaveAttribute('data-is-streaming', 'true');++ await page.getByTitle('Refresh').click();+ await expect(logViewer).toHaveAttribute('data-is-streaming', 'true');+ await expect(stopButton).toBeVisible();await expect(page.getByText('No project selected. Please select a project to view logs.', { exact: true })).not.toBeVisible();++ const stoppedProject = realProjects.find((p) => p.status === 'stopped');+ expect(stoppedProject, 'GitOps setup must provide a stopped project').toBeDefined();++ await page.goto(`/projects/${stoppedProject!.id || stoppedProject!.name}?tab=services`);+ await page.waitForLoadState('load');++ await expect(page.getByText('Real-time project logs', { exact: true })).toBeVisible();+ await expect(startButton).toBeDisabled();+ await page.getByTitle('Refresh').click();+ await expect(logViewer).toHaveAttribute('data-is-streaming', 'false');});});