Skip to content

Update worker status response to handle array-based structure with type safety and i18n#111

Merged
TheRealSeber merged 4 commits intomasterfrom
copilot/adjust-worker-status-response
Dec 9, 2025
Merged

Update worker status response to handle array-based structure with type safety and i18n#111
TheRealSeber merged 4 commits intomasterfrom
copilot/adjust-worker-status-response

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

The /workers/status endpoint now returns worker details as an array of objects instead of a key-value map.

Backend API Changes:

// Before
workerStatus: Record<string, string>  // { "worker-1": "idle", "worker-2": "busy" }

// After
workerStatus: WorkerStatusItem[]  // [{ id: 1, status: "idle", processingMessageId?: "..." }]

Changes:

  • DTO updates (src/lib/dto/worker.ts):

    • Added WorkerStatusType enum with Idle and Busy values for type safety
    • Added WorkerStatusItem interface with id, status (using enum), and optional processingMessageId fields
    • Changed WorkerStatus.workerStatus from Record<string, string> to WorkerStatusItem[]
  • UI updates (src/routes/dashboard/admin/+page.svelte):

    • Replaced Object.entries() iteration with direct array iteration
    • Implemented comprehensive status styling pattern with mapping object and fallback for unknown statuses
    • Internationalized worker labels using admin_dashboard_worker_id and admin_dashboard_worker_processing
    • Display now shows structured worker ID and conditionally renders processing message ID when present
  • Internationalization (messages/en.json and messages/pl.json):

    • Added admin_dashboard_worker_id: "Worker {id}" with parameterized message support
    • Added admin_dashboard_worker_processing: "Processing:" / "Przetwarzanie:"

The new structure provides type safety through enums, supports displaying which message each worker is currently processing, and follows project i18n conventions for better observability into worker activity.

Original prompt

This section details on the original issue you should resolve

<issue_title>Adjust for the new worker status response</issue_title>
<issue_description>/workers/status returns updated response where there is more details etc. Please use it, refer to backend swagger for details</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: HermanPlay <78978614+HermanPlay@users.noreply.github.com>
Copilot AI changed the title [WIP] Update handling for new worker status response Update worker status response to handle array-based structure Dec 9, 2025
Copilot AI requested a review from HermanPlay December 9, 2025 19:20
@TheRealSeber TheRealSeber marked this pull request as ready for review December 9, 2025 22:40
Copilot AI review requested due to automatic review settings December 9, 2025 22:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the worker status response handling to align with backend API changes that now return worker details as an array of objects instead of a key-value map. The change improves observability by enabling the UI to display which specific message each worker is currently processing.

Key Changes

  • Type safety improvements: Introduced WorkerStatusItem interface with structured fields (id, status, processingMessageId)
  • Array-based iteration: Replaced Object.entries() iteration with direct array mapping for better type inference
  • Enhanced UI display: Added conditional rendering to show processing message IDs for busy workers

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/lib/dto/worker.ts Added WorkerStatusItem interface and changed WorkerStatus.workerStatus from Record<string, string> to WorkerStatusItem[]
src/routes/dashboard/admin/+page.svelte Updated worker card rendering to iterate over array, display structured worker IDs, and conditionally show processing message IDs

…UI labels

Co-authored-by: TheRealSeber <111927572+TheRealSeber@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 9, 2025

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.jsdelivr.net
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node ./node_modules/.bin/../@inlang/paraglide-js/bin/run.js compile (dns block)
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node ./node_modules/.bin/../@inlang/paraglide-js/bin/run.js compile --project ./project.inlang --outdir ./src/lib/paraglide (dns block)
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node /home/REDACTED/work/frontend/frontend/node_modules/.bin/../vite/bin/vite.js build (dns block)
  • eu.posthog.com
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node ./node_modules/.bin/../@inlang/paraglide-js/bin/run.js compile (dns block)
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node ./node_modules/.bin/../@inlang/paraglide-js/bin/run.js compile --project ./project.inlang --outdir ./src/lib/paraglide (dns block)
    • Triggering command: /opt/hostedtoolcache/node/22.21.1/x64/bin/node node /home/REDACTED/work/frontend/frontend/node_modules/.bin/../vite/bin/vite.js build (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title Update worker status response to handle array-based structure Update worker status response to handle array-based structure with type safety and i18n Dec 9, 2025
Copilot AI requested a review from TheRealSeber December 9, 2025 23:04
@TheRealSeber TheRealSeber merged commit 17b5427 into master Dec 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adjust for the new worker status response

3 participants