Skip to content

Modern Docker Management, Designed for Everyone

feat: add support for auto-starting of logs (#983)

Julian Thannerf7e17861f1f5
diff --git a/frontend/messages/en.json b/frontend/messages/en.json
index a472e99e7..806b51471 100644
--- a/frontend/messages/en.json
+++ b/frontend/messages/en.json
@@ -1570,5 +1570,6 @@
"upgrade_status_complete": "Upgrade complete!",
"upgrade_status_checking": "Checking for new version...",
"upgrade_status_detected": "New version detected!",
- "upgrade_wait_info": "This may take 30-60 seconds. The page will reload automatically when ready."
+ "upgrade_wait_info": "This may take 30-60 seconds. The page will reload automatically when ready.",
+ "auto_start": "Auto-start"
}
diff --git a/frontend/src/lib/components/logs/log-controls.svelte b/frontend/src/lib/components/logs/log-controls.svelte
index 0136bf3bb..50c65fb5a 100644
--- a/frontend/src/lib/components/logs/log-controls.svelte
+++ b/frontend/src/lib/components/logs/log-controls.svelte
@@ -8,6 +8,7 @@
let {
autoScroll = $bindable(),
tailLines = $bindable(100),
+ autoStartLogs = $bindable(false),
isStreaming = false,
disabled = false,
onStart,
@@ -17,6 +18,7 @@
}: {
autoScroll: boolean;
tailLines?: number;
+ autoStartLogs?: boolean;
isStreaming?: boolean;
disabled?: boolean;
onStart?: () => void;
@@ -35,6 +37,7 @@
];
const persistedTailLines = new PersistedState('arcane_log_tail_lines', '100');
+ const persistedAutoStart = new PersistedState('arcane_log_auto_start', 'false');
let selectedTail = $state<string>(persistedTailLines.current);
@@ -47,6 +50,14 @@
}
});
+ $effect(() => {
+ autoStartLogs = persistedAutoStart.current === 'true';
+ });
+
+ $effect(() => {
+ persistedAutoStart.current = autoStartLogs ? 'true' : 'false';
+ });
+
const selectedLabel = $derived(tailOptions.find((o) => o.value === selectedTail)?.label ?? m.log_tail_100_lines());
</script>
@@ -56,6 +67,11 @@
<span class="text-sm font-medium">{m.common_autoscroll()}</span>
</label>
+ <label class="flex items-center gap-2">
+ <input type="checkbox" bind:checked={autoStartLogs} class="size-4" />
+ <span class="text-sm font-medium">{m.auto_start()}</span>
+ </label>
+
<Select.Root type="single" bind:value={selectedTail} disabled={isStreaming} onValueChange={(v: string) => (selectedTail = v)}>
<Select.Trigger class="h-9 w-32 text-xs">
<span>{selectedLabel}</span>
diff --git a/frontend/src/routes/containers/components/ContainerLogsPanel.svelte b/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
index e099a90dd..1692f40e8 100644
--- a/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
+++ b/frontend/src/routes/containers/components/ContainerLogsPanel.svelte
@@ -23,6 +23,8 @@
let isStreaming = $state(false);
let viewer = $state<LogViewer>();
+ let autoStartLogs = $state(false);
+ let hasAutoStarted = $state(false);
function handleStart() {
viewer?.startLogStream();
@@ -54,6 +56,19 @@
isStreaming = false;
onStop();
}
+
+ $effect(() => {
+ if (containerId) {
+ hasAutoStarted = false;
+ }
+ });
+
+ $effect(() => {
+ if (autoStartLogs && !hasAutoStarted && !isStreaming && containerId) {
+ hasAutoStarted = true;
+ handleStart();
+ }
+ });
</script>
<Card.Root>
@@ -75,15 +90,16 @@
</div>
<Card.Description>{m.containers_logs_description()}</Card.Description>
</div>
- <LogControls
- bind:autoScroll
- {isStreaming}
- disabled={!containerId}
- onStart={handleStart}
- onStop={handleStop}
- onClear={handleClear}
- onRefresh={handleRefresh}
- />
+ <LogControls
+ bind:autoScroll
+ bind:autoStartLogs
+ {isStreaming}
+ disabled={!containerId}
+ onStart={handleStart}
+ onStop={handleStop}
+ onClear={handleClear}
+ onRefresh={handleRefresh}
+ />
</div>
</Card.Header>
<Card.Content class="p-0">
diff --git a/frontend/src/routes/projects/components/ProjectLogsPanel.svelte b/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
index e1185e97b..dd8d6bc2d 100644
--- a/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
+++ b/frontend/src/routes/projects/components/ProjectLogsPanel.svelte
@@ -16,6 +16,8 @@
let isStreaming = $state(false);
let viewer = $state<LogViewer>();
let tailLines = $state(100);
+ let autoStartLogs = $state(false);
+ let hasAutoStarted = $state(false);
function handleStart() {
isStreaming = true;
@@ -35,6 +37,19 @@
viewer?.stopLogStream();
viewer?.startLogStream();
}
+
+ $effect(() => {
+ if (projectId) {
+ hasAutoStarted = false;
+ }
+ });
+
+ $effect(() => {
+ if (autoStartLogs && !hasAutoStarted && !isStreaming && projectId) {
+ hasAutoStarted = true;
+ handleStart();
+ }
+ });
</script>
<Card.Root>
@@ -57,15 +72,16 @@
<Card.Description>Real-time project logs</Card.Description>
</div>
<LogControls
- bind:autoScroll
- bind:tailLines
- {isStreaming}
- disabled={!projectId}
- onStart={handleStart}
- onStop={handleStop}
- onClear={handleClear}
- onRefresh={handleRefresh}
- />
+ bind:autoScroll
+ bind:tailLines
+ bind:autoStartLogs
+ {isStreaming}
+ disabled={!projectId}
+ onStart={handleStart}
+ onStop={handleStop}
+ onClear={handleClear}
+ onRefresh={handleRefresh}
+ />
</div>
</Card.Header>
<Card.Content class="p-0">