From 161ce0e98260e8cf487e6b60e1a64ea2b38f432e Mon Sep 17 00:00:00 2001 From: dklOrdix Date: Mon, 4 May 2026 09:18:04 +0200 Subject: [PATCH 001/136] refactor(frontend): clean up and restructure app --- dev/setup.sh | 102 +++++++++++++--- package-lock.json | 30 ++++- package.json | 1 + src/lib/components/layout/Header.svelte | 112 ------------------ .../components/layout/LanguageSwitcher.svelte | 31 +---- src/lib/components/layout/ThemeToggle.svelte | 30 +---- .../components/layout/header/Header.svelte | 49 ++++++++ .../components/layout/header/UserMenu.svelte | 52 ++++++++ .../layout/{ => sidebar}/Sidebar.svelte | 94 ++------------- .../components/layout/sidebar/nav-items.ts | 33 ++++++ src/routes/(app)/+layout.svelte | 6 +- 11 files changed, 263 insertions(+), 277 deletions(-) delete mode 100644 src/lib/components/layout/Header.svelte create mode 100644 src/lib/components/layout/header/Header.svelte create mode 100644 src/lib/components/layout/header/UserMenu.svelte rename src/lib/components/layout/{ => sidebar}/Sidebar.svelte (66%) create mode 100644 src/lib/components/layout/sidebar/nav-items.ts diff --git a/dev/setup.sh b/dev/setup.sh index bd60601b..d779b3b4 100755 --- a/dev/setup.sh +++ b/dev/setup.sh @@ -3,11 +3,22 @@ # Assumes: kind cluster is running, kubectl context points to it. set -euo pipefail +SKIP_TRINO=false +for arg in "$@"; do + case "$arg" in + --skip-trino) SKIP_TRINO=true ;; + *) echo "Unknown argument: $arg"; echo "Usage: $0 [--skip-trino]"; exit 1 ;; + esac +done + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" ENV_FILE="$PROJECT_DIR/.env.development" echo "=== Stackable UI dev environment setup ===" +if [[ "$SKIP_TRINO" == true ]]; then + echo "(Trino deployment skipped via --skip-trino)" +fi echo "" # ------------------------------------------------------------------ @@ -24,8 +35,13 @@ fi # 2. Install Stackable operators # ------------------------------------------------------------------ echo "" -echo "Installing Stackable operators (commons, listener, secret, trino)..." -stackablectl operator install commons listener secret trino +if [[ "$SKIP_TRINO" == true ]]; then + echo "Installing Stackable operators (commons, listener, secret)..." + stackablectl operator install commons listener secret +else + echo "Installing Stackable operators (commons, listener, secret, trino)..." + stackablectl operator install commons listener secret trino +fi # ------------------------------------------------------------------ # 3. Deploy Keycloak @@ -52,12 +68,32 @@ echo "Node IP: $NODE_IP" # ------------------------------------------------------------------ # 5. Deploy Trino (after node IP is known, trino.yaml is a template) # ------------------------------------------------------------------ -echo "" -echo "Deploying Trino..." -sed "s/\${NODE_IP}/$NODE_IP/g" "$SCRIPT_DIR/trino.yaml" | kubectl apply -f - +if [[ "$SKIP_TRINO" == false ]]; then + echo "" + echo "Deploying Trino..." + sed "s/\${NODE_IP}/$NODE_IP/g" "$SCRIPT_DIR/trino.yaml" | kubectl apply -f - +fi + +# On some local Kubernetes distributions (e.g. Rancher Desktop k3s), the node's +# InternalIP is not reachable from the host network, but NodePorts are exposed +# on localhost. Probe both and use the first reachable URL. +KEYCLOAK_BASE_URL="" +for base in "http://${NODE_IP}:30080" "http://127.0.0.1:30080" "http://localhost:30080"; do + if curl -sf --max-time 2 "${base}/realms/master" >/dev/null 2>&1; then + KEYCLOAK_BASE_URL="$base" + break + fi +done + +if [ -z "$KEYCLOAK_BASE_URL" ]; then + echo "ERROR: Could not reach Keycloak via NodePort 30080." + echo "Tried: http://${NODE_IP}:30080, http://127.0.0.1:30080, http://localhost:30080" + exit 1 +fi +echo "Keycloak URL: ${KEYCLOAK_BASE_URL}" echo "Waiting for Keycloak to accept connections" -until curl -sf "http://${NODE_IP}:30080/realms/master" >/dev/null 2>&1; do +until curl -sf "${KEYCLOAK_BASE_URL}/realms/master" >/dev/null 2>&1; do sleep 2 done @@ -147,31 +183,56 @@ if [ -f "$ENV_FILE" ]; then cp "$ENV_FILE" "$ENV_FILE.bak" fi -TRINO_PORT=$(kubectl get svc trino-coordinator -o jsonpath='{.spec.ports[0].nodePort}') +if [[ "$SKIP_TRINO" == false ]]; then + TRINO_PORT=$(kubectl get svc trino-coordinator -o jsonpath='{.spec.ports[0].nodePort}') + + # Probe Trino reachability the same way we did for Keycloak. + TRINO_BASE_URL="" + for base in "https://${NODE_IP}:${TRINO_PORT}" "https://127.0.0.1:${TRINO_PORT}" "https://localhost:${TRINO_PORT}"; do + if curl -sfk --max-time 2 "${base}/v1/info" >/dev/null 2>&1; then + TRINO_BASE_URL="$base" + break + fi + done + # Fall back to NODE_IP if none respond yet (Trino may still be starting). + TRINO_BASE_URL="${TRINO_BASE_URL:-https://${NODE_IP}:${TRINO_PORT}}" +fi -cat > "$ENV_FILE" < "$ENV_FILE" < "$ENV_FILE" <5.0.0" + } + }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "dev": true, + "license": "MIT" + }, "node_modules/@inlang/paraglide-js": { "version": "2.12.0", "resolved": "https://registry.npmjs.org/@inlang/paraglide-js/-/paraglide-js-2.12.0.tgz", @@ -3167,9 +3191,9 @@ } }, "node_modules/acorn": { - "version": "8.15.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", - "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz", + "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==", "devOptional": true, "license": "MIT", "bin": { diff --git a/package.json b/package.json index 1ebaf820..b29560f9 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "@cyclonedx/cyclonedx-npm": "^4.2.1", "@eslint/compat": "^2.0.2", "@eslint/js": "^9.39.2", + "@iconify/svelte": "^5.2.1", "@inlang/paraglide-js": "^2.12.0", "@playwright/test": "^1.58.2", "@sveltejs/adapter-node": "^5.5.3", diff --git a/src/lib/components/layout/Header.svelte b/src/lib/components/layout/Header.svelte deleted file mode 100644 index dbd087ef..00000000 --- a/src/lib/components/layout/Header.svelte +++ /dev/null @@ -1,112 +0,0 @@ - - -
- - - -

{title}

- -
- -
- - - {#if user} - - {/if} -
-
diff --git a/src/lib/components/layout/LanguageSwitcher.svelte b/src/lib/components/layout/LanguageSwitcher.svelte index 2852ab2a..0d3e99d7 100644 --- a/src/lib/components/layout/LanguageSwitcher.svelte +++ b/src/lib/components/layout/LanguageSwitcher.svelte @@ -1,6 +1,7 @@ + +
+ + + +

{title}

+ +
+ +
+ + + {#if user} + + {/if} +
+
diff --git a/src/lib/components/layout/header/UserMenu.svelte b/src/lib/components/layout/header/UserMenu.svelte new file mode 100644 index 00000000..bda04ab0 --- /dev/null +++ b/src/lib/components/layout/header/UserMenu.svelte @@ -0,0 +1,52 @@ + + + diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/sidebar/Sidebar.svelte similarity index 66% rename from src/lib/components/layout/Sidebar.svelte rename to src/lib/components/layout/sidebar/Sidebar.svelte index b0a9eaff..65c5f350 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/sidebar/Sidebar.svelte @@ -1,6 +1,8 @@ {#snippet navIcon(name: string)} - {#if name === 'dashboard'} - - {:else if name === 'database'} - - {/if} + {@const iconName = `material-symbols:${name}`} +