From 8e9fcb877a3cfe9f6a9c124693b47fef77325499 Mon Sep 17 00:00:00 2001 From: Kacper Wojciechowski <39823706+jog1t@users.noreply.github.com> Date: Tue, 7 Oct 2025 00:38:05 +0200 Subject: [PATCH] feat: add allocating actor label --- .../actors/actor-status-indicator.tsx | 1 + .../components/actors/actor-status-label.tsx | 1 + .../src/components/actors/queries/index.ts | 19 +++++++++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/actors/actor-status-indicator.tsx b/frontend/src/components/actors/actor-status-indicator.tsx index 76d5dcad7c..356ff9a98e 100644 --- a/frontend/src/components/actors/actor-status-indicator.tsx +++ b/frontend/src/components/actors/actor-status-indicator.tsx @@ -54,6 +54,7 @@ export const ActorStatusIndicator = ({ "bg-blue-600 animate-pulse": status === "starting", "bg-destructive": status === "crashed", "bg-foreground/10": status === "stopped", + "bg-primary": status === "pending", "bg-accent": status === "unknown", }, props.className, diff --git a/frontend/src/components/actors/actor-status-label.tsx b/frontend/src/components/actors/actor-status-label.tsx index cd45604e87..2e282330c3 100644 --- a/frontend/src/components/actors/actor-status-label.tsx +++ b/frontend/src/components/actors/actor-status-label.tsx @@ -9,6 +9,7 @@ export const ACTOR_STATUS_LABEL_MAP = { stopped: "Stopped", crashed: "Crashed", sleeping: "Sleeping", + pending: "Pending (Allocating)", } satisfies Record; export const ActorStatusLabel = ({ status }: { status?: ActorStatus }) => { diff --git a/frontend/src/components/actors/queries/index.ts b/frontend/src/components/actors/queries/index.ts index 8aa066042b..9303d62300 100644 --- a/frontend/src/components/actors/queries/index.ts +++ b/frontend/src/components/actors/queries/index.ts @@ -95,15 +95,30 @@ export type ActorStatus = | "stopped" | "crashed" | "sleeping" + | "pending" | "unknown"; export function getActorStatus( actor: Pick< Actor, - "createdAt" | "startedAt" | "destroyedAt" | "sleepingAt" + | "createdAt" + | "startedAt" + | "destroyedAt" + | "sleepingAt" + | "pendingAllocationAt" >, ): ActorStatus { - const { createdAt, startedAt, destroyedAt, sleepingAt } = actor; + const { + createdAt, + startedAt, + destroyedAt, + sleepingAt, + pendingAllocationAt, + } = actor; + + if (pendingAllocationAt && !startedAt && !destroyedAt) { + return "pending"; + } if (createdAt && sleepingAt && !destroyedAt) { return "sleeping";