From 79afa704a2a984b845126d1e67bb4317add6fd94 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 19:09:27 +0000 Subject: [PATCH 1/4] Initial plan From 2c529911a4771d1c492b506e979b3c00d43f063d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 19:17:06 +0000 Subject: [PATCH 2/4] Update worker status response structure to match new API Co-authored-by: HermanPlay <78978614+HermanPlay@users.noreply.github.com> --- src/lib/dto/worker.ts | 8 ++++- src/routes/dashboard/admin/+page.svelte | 42 +++++++++++++++---------- 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/src/lib/dto/worker.ts b/src/lib/dto/worker.ts index 9476fb2..6e2b413 100644 --- a/src/lib/dto/worker.ts +++ b/src/lib/dto/worker.ts @@ -1,6 +1,12 @@ +export interface WorkerStatusItem { + id: number; + status: string; + processingMessageId?: string; +} + export interface WorkerStatus { busyWorkers: number; statusTime: string; totalWorkers: number; - workerStatus: Record; + workerStatus: WorkerStatusItem[]; } diff --git a/src/routes/dashboard/admin/+page.svelte b/src/routes/dashboard/admin/+page.svelte index 91b10f3..24269f5 100644 --- a/src/routes/dashboard/admin/+page.svelte +++ b/src/routes/dashboard/admin/+page.svelte @@ -142,7 +142,7 @@ - {#if Object.keys(status.workerStatus).length > 0} + {#if status.workerStatus.length > 0} @@ -165,7 +165,7 @@
- {#each Object.entries(status.workerStatus) as [workerId, workerState] (workerId)} + {#each status.workerStatus as worker (worker.id)}
@@ -173,22 +173,30 @@ class="absolute inset-0 bg-gradient-to-br from-[var(--primary)] to-[var(--secondary)] opacity-5 transition-opacity duration-300 group-hover/item:opacity-10" >
-
-
-

{workerId}

+
+
+

+ Worker {worker.id} +

+ {#if worker.status === 'idle'} + + {worker.status} + + {:else} + + {worker.status} + + {/if}
- {#if workerState === 'idle'} - - {workerState} - - {:else} - - {workerState} - + {#if worker.processingMessageId} +
+ Processing: + {worker.processingMessageId} +
{/if}
From f36466385efd871d0c30df990990f2d506ec356b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 9 Dec 2025 22:59:55 +0000 Subject: [PATCH 3/4] Address PR feedback: Add enum for worker status and internationalize UI labels Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com> --- messages/en.json | 4 ++- messages/pl.json | 4 ++- src/lib/dto/worker.ts | 7 ++++- src/routes/dashboard/admin/+page.svelte | 35 ++++++++++++++----------- 4 files changed, 32 insertions(+), 18 deletions(-) diff --git a/messages/en.json b/messages/en.json index be46a6a..7beb075 100644 --- a/messages/en.json +++ b/messages/en.json @@ -574,5 +574,7 @@ "contest_collaborators_remove_cancel": "Cancel", "contest_collaborators_remove_success": "Collaborator removed successfully!", "contest_collaborators_remove_error": "Failed to remove collaborator", - "admin_contests_card_view_collaborators": "View Collaborators" + "admin_contests_card_view_collaborators": "View Collaborators", + "admin_dashboard_worker_id": "Worker {id}", + "admin_dashboard_worker_processing": "Processing:" } diff --git a/messages/pl.json b/messages/pl.json index 1483dc8..33864af 100644 --- a/messages/pl.json +++ b/messages/pl.json @@ -574,5 +574,7 @@ "contest_collaborators_remove_cancel": "Anuluj", "contest_collaborators_remove_success": "Współpracownik został usunięty pomyślnie!", "contest_collaborators_remove_error": "Nie udało się usunąć współpracownika", - "admin_contests_card_view_collaborators": "Zobacz Współpracowników" + "admin_contests_card_view_collaborators": "Zobacz Współpracowników", + "admin_dashboard_worker_id": "Worker {id}", + "admin_dashboard_worker_processing": "Przetwarzanie:" } diff --git a/src/lib/dto/worker.ts b/src/lib/dto/worker.ts index 6e2b413..0984c1c 100644 --- a/src/lib/dto/worker.ts +++ b/src/lib/dto/worker.ts @@ -1,6 +1,11 @@ +export enum WorkerStatusType { + Idle = 'idle', + Busy = 'busy' +} + export interface WorkerStatusItem { id: number; - status: string; + status: WorkerStatusType; processingMessageId?: string; } diff --git a/src/routes/dashboard/admin/+page.svelte b/src/routes/dashboard/admin/+page.svelte index 24269f5..afd782d 100644 --- a/src/routes/dashboard/admin/+page.svelte +++ b/src/routes/dashboard/admin/+page.svelte @@ -8,8 +8,19 @@ import Activity from '@lucide/svelte/icons/activity'; import CheckCircle from '@lucide/svelte/icons/check-circle'; import Clock from '@lucide/svelte/icons/clock'; + import { WorkerStatusType } from '$lib/dto/worker'; const workerStatusQuery = getWorkerStatus(); + + // Status styling configuration + const statusStyles = { + [WorkerStatusType.Idle]: 'bg-primary/10 text-primary', + [WorkerStatusType.Busy]: 'bg-secondary/10 text-secondary-foreground' + } as const; + + function getStatusStyle(status: WorkerStatusType): string { + return statusStyles[status] || 'bg-muted/10 text-muted-foreground'; + }
@@ -176,25 +187,19 @@

- Worker {worker.id} + {m.admin_dashboard_worker_id({ id: worker.id })}

- {#if worker.status === 'idle'} - - {worker.status} - - {:else} - - {worker.status} - - {/if} + + {worker.status} +
{#if worker.processingMessageId}
- Processing: + {m.admin_dashboard_worker_processing()} {worker.processingMessageId}
{/if} From 0e8a0f2040191c4cc63a5079b7010fb372fa48f4 Mon Sep 17 00:00:00 2001 From: HermanPlay Date: Wed, 10 Dec 2025 00:26:52 +0100 Subject: [PATCH 4/4] fix: small changes --- src/routes/dashboard/admin/+page.svelte | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/routes/dashboard/admin/+page.svelte b/src/routes/dashboard/admin/+page.svelte index afd782d..5fe4ab0 100644 --- a/src/routes/dashboard/admin/+page.svelte +++ b/src/routes/dashboard/admin/+page.svelte @@ -51,7 +51,7 @@ class="group relative overflow-hidden shadow-lg transition-all duration-300 hover:-translate-y-2 hover:shadow-xl" >
@@ -66,7 +66,7 @@

@@ -75,7 +75,7 @@
@@ -86,7 +86,7 @@ class="group relative overflow-hidden shadow-lg transition-all duration-300 hover:-translate-y-2 hover:shadow-xl" >
@@ -101,7 +101,7 @@

@@ -110,7 +110,7 @@
@@ -121,7 +121,7 @@ class="group relative overflow-hidden shadow-lg transition-all duration-300 hover:-translate-y-2 hover:shadow-xl" >
@@ -136,7 +136,7 @@

@@ -145,7 +145,7 @@
@@ -159,7 +159,7 @@ >
@@ -181,7 +181,7 @@ class="group/item relative overflow-hidden rounded-lg border border-border bg-card p-4 transition-all duration-300 hover:-translate-y-1 hover:shadow-md" >