From 16fa0a117096838795da8a5b78e2d67639b77682 Mon Sep 17 00:00:00 2001 From: Kacper Wojciechowski <39823706+jog1t@users.noreply.github.com> Date: Mon, 29 Sep 2025 22:06:13 +0200 Subject: [PATCH] feat: add datacenter field to actors list row --- .../data-providers/default-data-provider.tsx | 6 +++++ .../actors/actor-filters-context.tsx | 8 +++++- .../src/components/actors/actors-list-row.tsx | 26 +++++++++++++++++++ .../src/components/actors/queries/index.ts | 1 + 4 files changed, 40 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/data-providers/default-data-provider.tsx b/frontend/src/app/data-providers/default-data-provider.tsx index cb8e75d783..893de148cf 100644 --- a/frontend/src/app/data-providers/default-data-provider.tsx +++ b/frontend/src/app/data-providers/default-data-provider.tsx @@ -239,6 +239,12 @@ const defaultContext = { select: (data) => data.key, }); }, + actorDatacenterQueryOptions(actorId: ActorId) { + return queryOptions({ + ...this.actorQueryOptions(actorId), + select: (data) => data.datacenter ?? null, + }); + }, actorDestroyMutationOptions(actorId: ActorId) { return { mutationKey: ["actor", actorId, "destroy"], diff --git a/frontend/src/components/actors/actor-filters-context.tsx b/frontend/src/components/actors/actor-filters-context.tsx index c5b89deffd..b368926fbd 100644 --- a/frontend/src/components/actors/actor-filters-context.tsx +++ b/frontend/src/components/actors/actor-filters-context.tsx @@ -26,7 +26,7 @@ export const ACTORS_FILTERS_DEFINITIONS = { operators: [FilterOp.EQUAL], excludes: ["id"], }, - ...(__APP_TYPE__ === "engine" + ...(__APP_TYPE__ === "engine" || __APP_TYPE__ === "cloud" ? { showDestroyed: { type: "boolean", @@ -41,6 +41,12 @@ export const ACTORS_FILTERS_DEFINITIONS = { category: "display", ephemeral: true, }, + showDatacenter: { + type: "boolean", + label: "Show Actors Datacenter", + category: "display", + ephemeral: true, + }, wakeOnSelect: { type: "boolean", label: "Auto-wake Actors on select", diff --git a/frontend/src/components/actors/actors-list-row.tsx b/frontend/src/components/actors/actors-list-row.tsx index d0342e3a40..09cea8963e 100644 --- a/frontend/src/components/actors/actors-list-row.tsx +++ b/frontend/src/components/actors/actors-list-row.tsx @@ -66,6 +66,7 @@ export const ActorsListRow = memo( />
+
@@ -110,6 +111,31 @@ function Id({ actorId }: { actorId: ActorId }) { ); } +function Datacenter({ actorId }: { actorId: ActorId }) { + const { pick } = useActorsFilters(); + const { data: datacenter } = useQuery( + useDataProvider().actorDatacenterQueryOptions(actorId), + ); + + const showDatacenter = useSearch({ + strict: false, + select: (search) => + (pick(search).showDatacenter as FilterValue)?.value?.includes("1"), + }); + + if (!showDatacenter) { + return
; + } + + if (!datacenter) { + return -; + } + + return ( + {datacenter} + ); +} + function Tags({ actorId }: { actorId: ActorId }) { const { data } = useQuery(useDataProvider().actorKeysQueryOptions(actorId)); diff --git a/frontend/src/components/actors/queries/index.ts b/frontend/src/components/actors/queries/index.ts index 693c8993a0..8aa066042b 100644 --- a/frontend/src/components/actors/queries/index.ts +++ b/frontend/src/components/actors/queries/index.ts @@ -62,6 +62,7 @@ export type Actor = Omit & { sleepingAt?: string | null; connectableAt?: string | null; pendingAllocationAt?: string | null; + datacenter?: string | null; } & { id: ActorId }; export enum CrashPolicy {