Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
fix: reload interface when switching environments
Kyle Mendell53c0aa43dc7d
diff --git a/.vscode/settings.json b/.vscode/settings.jsonindex f26caa386..64ee97abf 100644--- a/.vscode/settings.json+++ b/.vscode/settings.json@@ -8,8 +8,5 @@},"typescript.tsdk": "frontend/node_modules/typescript/lib","go.buildTags": "playwright",- "prettier.documentSelectors": [- "**/*.svelte"- ],- "kiroAgent.configureMCP": "Disabled"+ "prettier.documentSelectors": ["**/*.svelte"]}diff --git a/backend/.air.toml b/backend/.air.tomlindex e8afd0524..2918e4591 100644--- a/backend/.air.toml+++ b/backend/.air.toml@@ -3,7 +3,7 @@ tmp_dir = ".bin"[build]bin = "./.bin/arcane"- cmd = "CGO_ENABLED=1 go build -o ./.bin/arcane ./cmd"+ cmd = "CGO_ENABLED=0 go build -o ./.bin/arcane ./cmd"exclude_dir = [".bin", "data"]stop_on_error = truedelay = 1000diff --git a/docker-compose.dev.yml b/docker-compose.dev.ymlindex 923e125b8..8433de0c5 100644--- a/docker-compose.dev.yml+++ b/docker-compose.dev.yml@@ -6,7 +6,7 @@ services:dockerfile: docker/Dockerfile.devtarget: frontend-devargs:- NODE_VERSION: "24"+ NODE_VERSION: '24'container_name: arcane-frontend-devports:- '3000:3000'@@ -41,7 +41,7 @@ services:dockerfile: docker/Dockerfile.devtarget: backend-devargs:- GO_VERSION: "1.25"+ GO_VERSION: '1.25'container_name: arcane-backend-devports:- '3552:3552'@@ -72,6 +72,21 @@ services:retries: 3start_period: 40s+ arcane-agent:+ image: ghcr.io/ofkm/arcane-headless:latest+ container_name: arcane-agent+ ports:+ - '3553:3553'+ environment:+ - AGENT_MODE=true+ - AGENT_BOOTSTRAP_TOKEN=development-bootstrap-token+ volumes:+ - /var/run/docker.sock:/var/run/docker.sock+ - agent-dev-data:/app/data+ networks:+ - arcane-dev+ restart: unless-stopped+networks:arcane-dev:driver: bridge@@ -79,4 +94,6 @@ networks:volumes:arcane-dev-data:- name: arcane-dev-data+ name: arcane-dev-data-+ agent-dev-data:+ name: agent-dev-datadiff --git a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelteindex 9ca8dbf29..0ce96deac 100644--- a/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte+++ b/frontend/src/lib/components/sidebar/sidebar-env-switcher.svelte@@ -37,9 +37,9 @@};});- function handleSelect(env: Environment) {+ async function handleSelect(env: Environment) {try {- environmentStore.setEnvironment(env);+ await environmentStore.setEnvironment(env);} catch (error) {console.error('Failed to set environment:', error);toast.error('Failed to Connect to Environment');diff --git a/frontend/src/lib/stores/environment.store.ts b/frontend/src/lib/stores/environment.store.tsindex 9265c2ef3..b209b4960 100644--- a/frontend/src/lib/stores/environment.store.ts+++ b/frontend/src/lib/stores/environment.store.ts@@ -1,6 +1,5 @@import { writable, get } from 'svelte/store';-import { browser } from '$app/environment';-import { goto } from '$app/navigation';+import { invalidateAll } from '$app/navigation';import type { Environment } from '$lib/types/environment.type';export const LOCAL_DOCKER_ENVIRONMENT_ID = '0';@@ -39,7 +38,7 @@ function createEnvironmentManagementStore() {}function _getSavedEnvironmentId(): string | null {- if (browser && localStorage) {+ if (localStorage) {return localStorage.getItem('selectedEnvironmentId');}return null;@@ -99,16 +98,11 @@ function createEnvironmentManagementStore() {if (currentSelected?.id !== environment.id) {_selectedEnvironment.set(environment);- if (browser && localStorage) {+ if (localStorage) {localStorage.setItem('selectedEnvironmentId', environment.id);}- if (browser) {- await goto(window.location.pathname + window.location.search, {- replaceState: true,- invalidateAll: true- });- }+ await invalidateAll();}},isInitialized: () => _initialized,diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelteindex 35684d526..eaf3c2cdc 100644--- a/frontend/src/routes/dashboard/+page.svelte+++ b/frontend/src/routes/dashboard/+page.svelte@@ -30,6 +30,16 @@let dockerInfo = $state(data.dockerInfo);let containerStatusCounts = $state(data.containerStatusCounts);+ // Keep page state in sync when the route's load data updates (e.g., after env switch)+ $effect(() => {+ containers = data.containers;+ images = data.images;+ dockerInfo = data.dockerInfo;+ containerStatusCounts = data.containerStatusCounts;+ dashboardStates.dockerInfo = data.dockerInfo;+ dashboardStates.settings = data.settings;+ });+let dashboardStates = $state({dockerInfo: data.dockerInfo,settings: data.settings,@@ -145,32 +155,9 @@(async () => {await environmentStore.ready;- const getEnvId = () => {- const env = get(environmentStore.selected);- return env ? env.id : '0';- };-- statsWSClient = createStatsWebSocket({- getEnvId,- onOpen: () => {- if (!hasInitialStatsLoaded) {- isLoading.loadingStats = true;- }- },- onMessage: (data) => {- if (!mounted) return;- liveSystemStats = data;- dashboardStates.systemStats = data;- addToHistoricalData(data);- hasInitialStatsLoaded = true;- isLoading.loadingStats = false;- },- onError: (e) => {- console.error('Stats websocket error:', e);- }- });-- statsWSClient.connect();+ if (mounted) {+ setupStatsWS();+ }})();return () => {@@ -180,6 +167,61 @@};});+ function resetStats() {+ liveSystemStats = null;+ hasInitialStatsLoaded = false;+ historicalData = {+ cpu: [],+ memory: [],+ disk: [],+ containers: []+ };+ }++ function setupStatsWS() {+ const getEnvId = () => {+ const env = get(environmentStore.selected);+ return env ? env.id : '0';+ };++ statsWSClient = createStatsWebSocket({+ getEnvId,+ onOpen: () => {+ if (!hasInitialStatsLoaded) {+ isLoading.loadingStats = true;+ }+ },+ onMessage: (data) => {+ liveSystemStats = data;+ dashboardStates.systemStats = data;+ addToHistoricalData(data);+ hasInitialStatsLoaded = true;+ isLoading.loadingStats = false;+ },+ onError: (e) => {+ console.error('Stats websocket error:', e);+ }+ });+ statsWSClient.connect();+ }++ // Reconnect stats WS and refresh data when environment changes+ $effect(() => {+ const unsubscribe = environmentStore.selected.subscribe(async (env) => {+ if (!env) return;+ // If already mounted and client exists, reconnect and refresh+ if (statsWSClient) {+ statsWSClient.close();+ statsWSClient = null;+ resetStats();+ setupStatsWS();+ // Also refresh non-WS data for this page+ await refreshData();+ }+ });+ return () => unsubscribe();+ });+async function handleStartAll() {if (isLoading.starting || !dashboardStates.dockerInfo || stoppedContainers === 0) return;isLoading.starting = true;diff --git a/scripts/development/download-compose.sh b/scripts/development/download-compose.shdeleted file mode 100644index f9d579a5f..000000000--- a/scripts/development/download-compose.sh+++ /dev/null@@ -1,35 +0,0 @@-#!/usr/bin/env sh-set -eu--# Usage: download-compose.sh <version> <dest-path> [target-arch]-# version: e.g. 2.39.2-# dest-path: absolute path where the binary will be written-# target-arch: buildx TARGETARCH (amd64|arm64). If omitted, inferred.--VERSION="${1:-${COMPOSE_VERSION:-2.39.2}}"-DEST="${2:-/usr/local/bin/docker-compose}"-TARGETARCH_IN="${3:-${TARGETARCH:-}}"--# Normalize architecture-ARCH_GH=""-case "${TARGETARCH_IN}" in- amd64|"") ARCH_GH="x86_64" ;;- arm64) ARCH_GH="aarch64" ;;- *)- # Try uname -m as last resort- UNAME_ARCH="$(uname -m 2>/dev/null || echo x86_64)"- case "${UNAME_ARCH}" in- x86_64|amd64) ARCH_GH="x86_64" ;;- aarch64|arm64) ARCH_GH="aarch64" ;;- *) ARCH_GH="x86_64" ;;- esac- ;;-esac--URL="https://github.com/docker/compose/releases/download/v${VERSION}/docker-compose-linux-${ARCH_GH}"--echo "Downloading docker-compose v${VERSION} (${ARCH_GH}) -> ${DEST}"-mkdir -p "$(dirname "${DEST}")"-curl -fsSL --retry 3 --retry-delay 2 -o "${DEST}" "${URL}"-chmod +x "${DEST}"-echo "docker-compose installed at ${DEST}"\ No newline at end of filediff --git a/scripts/development/download-docker.sh b/scripts/development/download-docker.shdeleted file mode 100644index afee485fa..000000000--- a/scripts/development/download-docker.sh+++ /dev/null@@ -1,66 +0,0 @@-#!/usr/bin/env sh-set -eu--# Usage: download-docker.sh <platform> <arch> <version>-PLATFORM_IN="${1:-}"-ARCH_IN="${2:-}"-VERSION_IN="${3:-}"--if [ -z "${PLATFORM_IN}" ] || [ -z "${ARCH_IN}" ] || [ -z "${VERSION_IN}" ]; then- echo "Usage: $0 <platform> <arch> <version>" >&2- exit 1-fi--# strip leading 'v' if present-DOCKER_VERSION="${VERSION_IN#v}"--PLATFORM="${PLATFORM_IN}"-case "${PLATFORM}" in- darwin) PLATFORM="mac" ;;-esac--ARCH="${ARCH_IN}"-case "${ARCH}" in- amd64) ARCH="x86_64" ;;- arm) ARCH="armhf" ;;- arm64) ARCH="aarch64" ;;- ppc64le|s390x)- DOCKER_VERSION="28.4.0"- ;;- *)- # try to infer from uname as a last resort- UNAME_ARCH="$(uname -m 2>/dev/null || echo x86_64)"- case "${UNAME_ARCH}" in- x86_64|amd64) ARCH="x86_64" ;;- aarch64|arm64) ARCH="aarch64" ;;- *) ARCH="x86_64" ;;- esac- ;;-esac--DOWNLOAD_FOLDER=".tmp/download"-DEST_DIR="dist"--rm -rf "${DOWNLOAD_FOLDER}"-mkdir -p "${DOWNLOAD_FOLDER}"-mkdir -p "${DEST_DIR}"--TARGZ_PATH="${DOWNLOAD_FOLDER}/docker-binaries.tgz"-URL="https://download.docker.com/${PLATFORM}/static/stable/${ARCH}/docker-${DOCKER_VERSION}.tgz"--echo "Downloading docker ${DOCKER_VERSION} for ${PLATFORM}/${ARCH} -> ${TARGZ_PATH}"-curl -fsSL --retry 3 --retry-delay 2 -o "${TARGZ_PATH}" "${URL}"-tar -xf "${TARGZ_PATH}" -C "${DOWNLOAD_FOLDER}"--# extracted layout: docker/docker-if [ -f "${DOWNLOAD_FOLDER}/docker/docker" ]; then- mv "${DOWNLOAD_FOLDER}/docker/docker" "${DEST_DIR}/docker"- chmod +x "${DEST_DIR}/docker"- echo "docker installed at ${DEST_DIR}/docker"-else- echo "Expected docker binary not found in archive" >&2- exit 2-fi--# cleanup-rm -rf "${DOWNLOAD_FOLDER}"\ No newline at end of file