Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ RUN APKO_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "aarch64" || echo "x86_64")
" - busybox" \
" - tzdata" \
" - docker-cli" \
" - docker-compose=5.5.0-r5" \
" - docker-compose=5.5.1-r1" \
" - docker-cli-buildx" \
" - sqlite" \
" - postgresql-client" \
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"better-sqlite3": "11.7.0",
"croner": "9.1.0",
"cronstrue": "3.9.0",
"devalue": "5.8.1",
"devalue": "5.9.2",
"drizzle-orm": "0.45.2",
"fast-xml-parser": "5.7.3",
"isomorphic-dompurify": "3.22.0",
Expand All @@ -56,7 +56,7 @@
"marked": "18.0.9",
"modern-tar": "0.8.0",
"mqtt": "5.15.2",
"nodemailer": "9.1.0",
"nodemailer": "9.1.1",
"otpauth": "9.4.1",
"postgres": "3.4.8",
"prom-client": "15.1.3",
Expand Down Expand Up @@ -118,6 +118,6 @@
"@codemirror/search": "6.6.0",
"@lezer/common": "1.5.0",
"@lezer/highlight": "1.2.3",
"devalue": "5.8.1"
"devalue": "5.9.2"
}
}
12 changes: 9 additions & 3 deletions scripts/generate-changelog-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,12 @@ export function stripRefs(text: string): string {
.trim();
}

// The version the site advertises as current. A coming-soon entry is not downloadable,
// so it is never the answer; null means nothing has shipped yet.
export function latestReleasedVersion(entries: ChangelogEntry[]): string | null {
return entries.find((e) => !e.comingSoon)?.version ?? null;
}

// Build an RSS 2.0 feed from the released changelog entries (coming-soon excluded).
function generateRssFeed(entries: ChangelogEntry[]): string {
const released = entries.filter((e) => !e.comingSoon && e.date);
Expand Down Expand Up @@ -375,9 +381,9 @@ if (import.meta.main) {

indexHtml = indexHtml.replace(changelogRegex, newChangelogSection);

// Also update softwareVersion in JSON-LD schema
if (changelog.length > 0) {
const latestVersion = changelog[0].version;
// Also update softwareVersion in JSON-LD schema.
const latestVersion = latestReleasedVersion(changelog);
if (latestVersion) {
// Match "softwareVersion": "X.X" or "softwareVersion": "X.X.X"
const versionRegex = /"softwareVersion":\s*"[\d.]+"/;
if (versionRegex.test(indexHtml)) {
Expand Down
37 changes: 33 additions & 4 deletions src/lib/components/ConfirmPopover.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import { tick } from 'svelte';
import { Button } from '$lib/components/ui/button';
import * as Popover from '$lib/components/ui/popover';
import type { Snippet } from 'svelte';
Expand Down Expand Up @@ -56,6 +57,13 @@
// Truncate long names
const displayName = $derived(itemName && itemName.length > 20 ? itemName.slice(0, 20) + '...' : itemName);

// The heavy bits-ui Popover.Root (floating-ui context + portal) is only mounted once
// this confirm is actually opened. Before that the trigger is a plain button, so a grid
// of N rows with several ConfirmPopovers each mounts N cheap buttons instead of hundreds
// of popovers - the difference between an instant filter/regroup and a multi-second one.
let activated = $state(open);
$effect(() => { if (open) activated = true; });

// Auto-hide after specified time
$effect(() => {
if (open && autoHideMs > 0) {
Expand All @@ -73,15 +81,24 @@
onOpenChange?.(false);
}

function handleTriggerClick(e: MouseEvent) {
async function handleTriggerClick(e: MouseEvent) {
e.stopPropagation();
// If confirmDestructive is disabled, execute action immediately
// If confirmDestructive is disabled, execute action immediately (no popover ever).
if (!confirmDestructive) {
onConfirm();
return;
}
open = !open;
onOpenChange?.(open);
if (open) {
open = false;
onOpenChange?.(false);
return;
}
// Mount the Root first, then open on the next microtask so bits-ui positions the
// content against a trigger already in the DOM.
activated = true;
await tick();
open = true;
onOpenChange?.(true);
}

function handleOpenChange(newOpen: boolean) {
Expand All @@ -90,6 +107,17 @@
}
</script>

{#if !activated}
<!-- Cheap placeholder: no Popover.Root until this confirm is opened. -->
<button
type="button"
{title}
onclick={handleTriggerClick}
class={triggerClass}
>
{@render children({ open: false })}
</button>
{:else}
<Popover.Root bind:open onOpenChange={handleOpenChange}>
<Popover.Trigger>
{#snippet child({ props })}
Expand Down Expand Up @@ -124,3 +152,4 @@
</div>
</Popover.Content>
</Popover.Root>
{/if}
4 changes: 2 additions & 2 deletions src/lib/data/changelog.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"version": "1.0.49",
"date": "2026-09-22",
"comingSoon": true,
"date": "2026-09-23",
"comingSoon": false,
"changes": [
{ "type": "fix", "text": "select-all checkbox shows a partial state, not a full tick, for a partial selection (#1605)" },
{ "type": "fix", "text": "a long backup no longer crashes the app when its log stream goes quiet (#1610)" },
Expand Down
9 changes: 5 additions & 4 deletions src/lib/server/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5497,12 +5497,13 @@ async function streamLocalStderr(
onStdout?: (data: string) => void
): Promise<void> {
const wantStdout = onStdout ? 'true' : 'false';
// Pass the caller's abort signal to the fetch itself, not only to the reader below:
// with no body timeout on the streaming dispatcher, a fetch that stalls BEFORE the
// response arrives has no other bound, so container-exit must be able to cancel it.
// The abort signal cancels the READER on container exit (below), NOT the fetch itself:
// aborting the fetch surfaces as a thrown "operation aborted" that a caller without a
// .catch (restore redeploy) reads as a real failure. A pre-header stall is already
// bounded by undici's default headersTimeout, so the fetch needs no signal.
const response = await dockerFetch(
`/containers/${containerId}/logs?stdout=${wantStdout}&stderr=true&follow=true`,
{ streaming: true, signal },
{ streaming: true },
envId
);

Expand Down
18 changes: 12 additions & 6 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -799,12 +799,18 @@

const stats = await response.json() as EnvironmentStats;

tiles = tiles.map(t =>
t.id === envId
? { ...t, stats, loading: false }
: t
);
dashboardData.updateTile(envId, { stats, loading: false });
// MERGE, don't replace: this endpoint doesn't compute topContainers/recentEvents
// (only the SSE stream does), so replacing the whole stats object would blank the
// richer lists the tile already got from the stream. Merge keeps them (it skips
// undefined fields) while still applying the fresh counts this refresh carries.
tiles = tiles.map(t => {
if (t.id !== envId) return t;
const merged = { ...t.stats } as Record<string, any>;
mergePartialStats(merged, stats as any);
return { ...t, stats: merged as EnvironmentStats, loading: false };
});
dashboardData.updateTilePartial(envId, definedPartialForStore(stats as any));
dashboardData.updateTile(envId, { loading: false });
} catch {
// Ignore errors - next full refresh will catch up
}
Expand Down
18 changes: 15 additions & 3 deletions src/routes/api/dashboard/stats/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ export interface EnvironmentStats {
total: number;
today: number;
};
topContainers: Array<{
// Optional: this non-streaming endpoint does NOT compute topContainers or recentEvents
// (only the SSE stream does). Omitting them lets the dashboard's merge keep the richer
// lists it already received from the stream instead of blanking them on an event refresh.
topContainers?: Array<{
id: string;
name: string;
cpuPercent: number;
Expand Down Expand Up @@ -190,8 +193,8 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
networks: { total: 0 },
stacks: { total: 0, running: 0, partial: 0, stopped: 0 },
metrics: null,
events: { total: 0, today: 0 },
topContainers: []
events: { total: 0, today: 0 }
// topContainers / recentEvents intentionally omitted - not computed here.
};

try {
Expand Down Expand Up @@ -233,6 +236,15 @@ export const GET: RequestHandler = async ({ cookies, url }) => {
envStats.containers.restarting = containers.filter((c: any) => c.state === 'restarting').length;
envStats.containers.unhealthy = containers.filter((c: any) => c.health === 'unhealthy').length;

// This endpoint does not compute topContainers (only the SSE stream does), so it
// omits the field and the dashboard's merge keeps the stream's list. But when
// there are zero running containers the list is genuinely empty, so send [] as an
// explicit signal the merge honours - otherwise a just-emptied env would show a
// stale "Top containers" list until the next stream cycle.
if (envStats.containers.running === 0) {
envStats.topContainers = [];
}

// Helper to get valid size (Docker API returns -1 for uncalculated sizes)
const getValidSize = (size: number | undefined | null): number => {
return size && size > 0 ? size : 0;
Expand Down
11 changes: 10 additions & 1 deletion src/routes/settings/environments/EnvironmentsTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,16 @@
<UndoDot class="w-3.5 h-3.5 text-green-500 glow-green" />
</span>
{/if}
<span class="font-medium truncate">{env.name}</span>
{#if $canAccess('environments', 'edit')}
<button
type="button"
class="font-medium truncate text-left hover:underline cursor-pointer"
title="Edit environment"
onclick={() => openEditEnvModal(env)}
>{env.name}</button>
{:else}
<span class="font-medium truncate">{env.name}</span>
{/if}
</div>
</Table.Cell>

Expand Down
11 changes: 10 additions & 1 deletion src/routes/settings/git/GitRepositoriesTab.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,16 @@
<div class="flex items-center justify-between py-2 px-3 rounded-md border bg-card hover:bg-muted/50 transition-colors">
<div class="flex items-center gap-2 min-w-0 flex-1">
<ForgeIcon class="w-4 h-4 shrink-0 text-muted-foreground" />
<span class="font-medium text-sm truncate">{repo.name}</span>
{#if $canAccess('settings', 'edit')}
<button
type="button"
class="font-medium text-sm truncate text-left hover:underline cursor-pointer"
title="Edit repository"
onclick={() => openModal(repo)}
>{repo.name}</button>
{:else}
<span class="font-medium text-sm truncate">{repo.name}</span>
{/if}
<span class="text-xs text-muted-foreground truncate hidden sm:inline">{repo.url}</span>
</div>
<div class="flex items-center gap-2 shrink-0">
Expand Down
39 changes: 39 additions & 0 deletions tests/changelog-filter.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { describe, test, expect } from 'bun:test';
import { releasedEntries } from '../src/lib/utils/changelog-filter';
import { latestReleasedVersion } from '../scripts/generate-changelog-page';
import changelogJson from '../src/lib/data/changelog.json';

describe('releasedEntries', () => {
test('drops coming-soon (unreleased) entries', () => {
Expand Down Expand Up @@ -29,3 +31,40 @@ describe('releasedEntries', () => {
expect(releasedEntries(entries)[0].version).toBe('1.0.47');
});
});

describe('latestReleasedVersion (landing page JSON-LD softwareVersion)', () => {
test('skips a coming-soon top entry and resolves to the newest shipped one', () => {
// The distinguishing case: reading entries[0] here would advertise a version
// nobody can download.
expect(
latestReleasedVersion([
{ version: '1.0.50', comingSoon: true },
{ version: '1.0.49' },
{ version: '1.0.48' }
] as never)
).toBe('1.0.49');
});

test('resolves to the first entry when nothing is coming-soon', () => {
expect(
latestReleasedVersion([{ version: '1.0.49' }, { version: '1.0.48' }] as never)
).toBe('1.0.49');
});

test('returns null when every entry is coming-soon, so the caller leaves the schema alone', () => {
expect(latestReleasedVersion([{ version: '1.0.50', comingSoon: true }] as never)).toBeNull();
});

test('returns null for an empty changelog', () => {
expect(latestReleasedVersion([])).toBeNull();
});

test('the shipped changelog resolves to a version that is not the coming-soon top entry', () => {
const changelog = changelogJson as { version: string; comingSoon?: boolean }[];
const resolved = latestReleasedVersion(changelog as never);
expect(resolved).toBe(changelog.find((e) => !e.comingSoon)!.version);
if (changelog[0].comingSoon) {
expect(resolved).not.toBe(changelog[0].version);
}
});
});
35 changes: 35 additions & 0 deletions tests/merge-partial-stats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,41 @@ describe('mergePartialStats - skeleton placeholders never blank a populated tile
});
});

describe('mergePartialStats - event-triggered refresh keeps lists the non-stream endpoint omits', () => {
// The non-streaming /api/dashboard/stats does not compute topContainers/recentEvents
// (only the SSE stream does). An event-triggered refresh must MERGE its response so the
// richer lists a tile already got from the stream survive, instead of being blanked.
it('undefined topContainers/recentEvents in the refresh keep the stream-provided lists', () => {
// existing = what the SSE stream delivered
const existing: any = {
id: 8,
containers: { total: 8, running: 8, stopped: 0 },
topContainers: [{ id: 'a' }, { id: 'b' }, { id: 'c' }, { id: 'd' }, { id: 'e' }, { id: 'f' }, { id: 'g' }, { id: 'h' }],
recentEvents: Array.from({ length: 10 }, (_, i) => ({ action: 'start', container_name: `c${i}` })),
events: { today: 400, total: 700 }
};
// partial = the non-stream refresh: correct counts, no lists (fields omitted)
mergePartialStats(existing, {
id: 8,
containers: { total: 8, running: 8, stopped: 0 },
topContainers: undefined,
recentEvents: undefined,
events: { today: 488, total: 712 }
});
expect(existing.topContainers.length).toBe(8); // preserved, not blanked
expect(existing.recentEvents.length).toBe(10); // preserved, not blanked
expect(existing.events).toEqual({ today: 488, total: 712 }); // fresh counts applied
expect(existing.containers.running).toBe(8);
});

it('a genuine empty topContainers array (present, no loading flag) DOES replace', () => {
// If the endpoint ever explicitly sends [] (real "no running containers"), honour it.
const existing: any = { id: 8, topContainers: [{ id: 'a' }] };
mergePartialStats(existing, { id: 8, topContainers: [] });
expect(existing.topContainers).toEqual([]);
});
});

describe('definedPartialForStore - store payload drops placeholder sections but keeps loading', () => {
it('drops a loading section, keeps loading + ready sections', () => {
const partial: any = {
Expand Down
Loading