You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2026/07/27 01:20:28 UTC
(airavata-custos) 12/18: Add allocation access status panel and member grid
This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch pearc26
in repository https://gitbox.apache.org/repos/asf/airavata-custos.git
commit 5386d1f882e9e6c3244c2d048fd698778c38e7ca
Author: lahiruj <la...@gmail.com>
AuthorDate: Fri Jul 24 17:41:10 2026 -0400
Add allocation access status panel and member grid
---
.../__tests__/AllocationAccessBand.test.tsx | 104 +++++++++
web/src/features/core/access-status/api.ts | 36 ++++
.../components/AllocationAccessBand.tsx | 233 +++++++++++++++++++++
web/src/features/core/access-status/queries.ts | 55 +++++
web/src/features/core/access-status/schemas.ts | 60 ++++++
.../__tests__/AllocationMembersTab.test.tsx | 3 +
.../components/AllocationMembersTab.tsx | 22 ++
.../core/analytics/components/AnalyticsPage.tsx | 2 +
8 files changed, 515 insertions(+)
diff --git a/web/src/features/core/access-status/__tests__/AllocationAccessBand.test.tsx b/web/src/features/core/access-status/__tests__/AllocationAccessBand.test.tsx
new file mode 100644
index 000000000..a6afd8934
--- /dev/null
+++ b/web/src/features/core/access-status/__tests__/AllocationAccessBand.test.tsx
@@ -0,0 +1,104 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { fireEvent, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import type { AccessStatus } from "../schemas";
+
+const state: { data: AccessStatus | undefined } = { data: undefined };
+vi.mock("../queries", () => ({
+ useAccessStatus: () => ({ data: state.data, isLoading: false, error: null }),
+}));
+
+import { AllocationAccessBand } from "../components/AllocationAccessBand";
+
+const now = new Date().toISOString();
+
+function check(type: "SIGN_IN" | "JOB_SUBMISSION", ui_state: AccessStatus["checks"][0]["ui_state"]) {
+ return {
+ type,
+ status: ui_state === "ok" ? ("OK" as const) : ui_state === "setting_up" ? ("PENDING" as const) : ("FAILING" as const),
+ ui_state,
+ last_checked_at: now,
+ last_ok_at: ui_state === "ok" ? now : null,
+ failing_since: ui_state === "retrying" || ui_state === "stuck" ? now : null,
+ };
+}
+
+function renderBand(status: AccessStatus) {
+ state.data = status;
+ return render(<AllocationAccessBand allocationId="alloc-1" allocationName="pearc26-tutorial" />);
+}
+
+describe("<AllocationAccessBand />", () => {
+ it("renders nothing before the first result", () => {
+ state.data = undefined;
+ const { container } = render(
+ <AllocationAccessBand allocationId="alloc-1" allocationName="pearc26-tutorial" />,
+ );
+ expect(container).toBeEmptyDOMElement();
+ });
+
+ it("collapses to one line when everything is live, expanding on demand", () => {
+ renderBand({
+ checks: [check("SIGN_IN", "ok"), check("JOB_SUBMISSION", "ok")],
+ events: [{ check_type: "SIGN_IN", event_type: "ONLINE", occurred_at: now }],
+ });
+ expect(screen.getByText("Your access is live")).toBeInTheDocument();
+ expect(screen.queryByText("Cluster sign-in")).not.toBeInTheDocument();
+
+ fireEvent.click(screen.getByRole("button", { name: "View checks" }));
+ expect(screen.getByText("Cluster sign-in")).toBeInTheDocument();
+ expect(screen.getByText("Job submission")).toBeInTheDocument();
+ expect(screen.getByText("Cluster sign-in came online")).toBeInTheDocument();
+ });
+
+ it("expands automatically while access is still being set up", () => {
+ renderBand({
+ checks: [check("SIGN_IN", "ok"), check("JOB_SUBMISSION", "setting_up")],
+ events: [],
+ });
+ expect(screen.getByText("Setting up your access")).toBeInTheDocument();
+ expect(screen.getByText(/Job submission is still being set up/)).toBeInTheDocument();
+ expect(screen.getByText("Ready")).toBeInTheDocument();
+ // Both the band badge and the check chip carry the state label.
+ expect(screen.getAllByText("Setting up")).toHaveLength(2);
+ });
+
+ it("reads a failing check as calm retrying, not an alarm", () => {
+ renderBand({
+ checks: [check("SIGN_IN", "ok"), check("JOB_SUBMISSION", "retrying")],
+ events: [{ check_type: "JOB_SUBMISSION", event_type: "FAILED", occurred_at: now }],
+ });
+ expect(screen.getByText("Reconnecting your access")).toBeInTheDocument();
+ expect(screen.getByText(/retrying automatically, and no action is needed/)).toBeInTheDocument();
+ expect(screen.getByText("Retrying")).toBeInTheDocument();
+ expect(screen.getByText("Job submission failed a check")).toBeInTheDocument();
+ });
+
+ it("escalates a stuck check with the support next step", () => {
+ renderBand({
+ checks: [check("SIGN_IN", "ok"), check("JOB_SUBMISSION", "stuck")],
+ events: [{ check_type: "JOB_SUBMISSION", event_type: "STUCK", occurred_at: now }],
+ });
+ expect(screen.getByText("Your job submission access needs attention")).toBeInTheDocument();
+ expect(screen.getByText(/Your sign-in still works/)).toBeInTheDocument();
+ expect(screen.getByText(/Contact support if it doesn't clear/)).toBeInTheDocument();
+ expect(screen.getByText("Not working")).toBeInTheDocument();
+ expect(screen.getByText("Job submission still failing")).toBeInTheDocument();
+ });
+});
diff --git a/web/src/features/core/access-status/api.ts b/web/src/features/core/access-status/api.ts
new file mode 100644
index 000000000..f118f7920
--- /dev/null
+++ b/web/src/features/core/access-status/api.ts
@@ -0,0 +1,36 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { apiFetch } from "@/shared/api/client";
+import {
+ type AccessStatus,
+ accessStatusSchema,
+ type AllocationAccessMembers,
+ allocationAccessMembersSchema,
+} from "./schemas";
+
+export async function getAccessStatus(allocationId: string): Promise<AccessStatus> {
+ const raw = await apiFetch(`/compute-allocations/${allocationId}/access-status`);
+ return accessStatusSchema.parse(raw);
+}
+
+export async function getAllocationAccessMembers(
+ allocationId: string,
+): Promise<AllocationAccessMembers> {
+ const raw = await apiFetch(`/compute-allocations/${allocationId}/access-status?members=true`);
+ return allocationAccessMembersSchema.parse(raw);
+}
diff --git a/web/src/features/core/access-status/components/AllocationAccessBand.tsx b/web/src/features/core/access-status/components/AllocationAccessBand.tsx
new file mode 100644
index 000000000..804210f52
--- /dev/null
+++ b/web/src/features/core/access-status/components/AllocationAccessBand.tsx
@@ -0,0 +1,233 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+"use client";
+
+import * as React from "react";
+import { StatusBadge, type StatusBadgeVariant } from "@/shared/ui/StatusBadge";
+import { useAccessStatus } from "../queries";
+import type { AccessCheck, AccessCheckEvent, AccessUIState } from "../schemas";
+
+export const CHECK_NAME: Record<string, string> = {
+ SIGN_IN: "Cluster sign-in",
+ JOB_SUBMISSION: "Job submission",
+};
+
+const CHECK_DESCRIPTION: Record<string, string> = {
+ SIGN_IN: "Signing in over SSH.",
+ JOB_SUBMISSION: "Running jobs charged to this allocation.",
+};
+
+export const CHECK_CHIP: Record<AccessUIState, { variant: StatusBadgeVariant; label: string }> = {
+ ok: { variant: "active", label: "Ready" },
+ setting_up: { variant: "pending", label: "Setting up" },
+ retrying: { variant: "warning", label: "Retrying" },
+ stuck: { variant: "deleted", label: "Not working" },
+};
+
+// The band's overall tone is the worst check's tone.
+const BAND_ORDER: AccessUIState[] = ["stuck", "retrying", "setting_up", "ok"];
+
+const BAND_BADGE: Record<AccessUIState, { variant: StatusBadgeVariant; label: string }> = {
+ ok: { variant: "active", label: "Live" },
+ setting_up: { variant: "pending", label: "Setting up" },
+ retrying: { variant: "warning", label: "Reconnecting" },
+ stuck: { variant: "deleted", label: "Needs attention" },
+};
+
+export function AllocationAccessBand({
+ allocationId,
+ allocationName,
+}: {
+ allocationId: string;
+ allocationName: string;
+}) {
+ const query = useAccessStatus(allocationId);
+ const [expanded, setExpanded] = React.useState(false);
+
+ // Renders nothing until the first result: access is usually live, and a
+ // placeholder would push the page around for the common case.
+ if (!query.data) return null;
+
+ const checks = [...query.data.checks].sort((a) => (a.type === "SIGN_IN" ? -1 : 1));
+ // Both checks log STARTED at the same setup; the story needs it once, at
+ // the moment setup began. Events arrive newest first, so keep the last.
+ const lastStarted = query.data.events.reduce(
+ (acc, e, i) => (e.event_type === "STARTED" ? i : acc),
+ -1,
+ );
+ const events = query.data.events.filter(
+ (e, i) => e.event_type !== "STARTED" || i === lastStarted,
+ );
+ const overall = BAND_ORDER.find((s) => checks.some((c) => c.ui_state === s)) ?? "ok";
+ const showDetails = overall !== "ok" || expanded;
+
+ return (
+ <section
+ aria-label="Access to this allocation"
+ className="rounded-xl border border-border bg-card p-4"
+ >
+ <div className="flex flex-wrap items-center justify-between gap-2">
+ <div className="flex items-center gap-3">
+ <StatusBadge {...BAND_BADGE[overall]} />
+ <span className="text-sm font-medium">{verdictHeading(overall, checks)}</span>
+ <span className="text-xs text-muted-foreground">
+ {allocationName} · checked {relativeTime(lastChecked(checks))}
+ </span>
+ </div>
+ {overall === "ok" ? (
+ <button
+ type="button"
+ className="text-xs font-medium text-muted-foreground underline-offset-2 hover:underline"
+ onClick={() => setExpanded((v) => !v)}
+ >
+ {expanded ? "Hide checks" : "View checks"}
+ </button>
+ ) : null}
+ </div>
+
+ {showDetails ? (
+ <div className="mt-4 space-y-4">
+ <p className="text-sm text-muted-foreground">{verdictBody(overall, checks)}</p>
+ <div className="grid grid-cols-1 gap-3 sm:grid-cols-2">
+ {checks.map((c) => (
+ <CheckRow key={c.type} check={c} />
+ ))}
+ </div>
+ {events.length > 0 ? <Timeline events={events} /> : null}
+ </div>
+ ) : null}
+ </section>
+ );
+}
+
+function CheckRow({ check }: { check: AccessCheck }) {
+ const chip = CHECK_CHIP[check.ui_state];
+ return (
+ <div className="flex items-start justify-between gap-3 rounded-lg border border-border p-3">
+ <div className="space-y-0.5">
+ <div className="text-sm font-medium">{CHECK_NAME[check.type]}</div>
+ <div className="text-xs text-muted-foreground">{CHECK_DESCRIPTION[check.type]}</div>
+ {check.ui_state === "retrying" ? (
+ <div className="text-xs text-[color:var(--tone-warn-fg)]">
+ Retrying automatically. Usually clears within a few minutes.
+ </div>
+ ) : null}
+ {check.ui_state === "stuck" && check.failing_since ? (
+ <div className="text-xs text-[color:var(--tone-error-fg)]">
+ Failing since {timeLabel(check.failing_since)}.
+ </div>
+ ) : null}
+ </div>
+ <StatusBadge {...chip} />
+ </div>
+ );
+}
+
+const EVENT_LABEL: Record<AccessCheckEvent["event_type"], (name: string) => string> = {
+ STARTED: () => "Access setup started",
+ ONLINE: (name) => `${name} came online`,
+ FAILED: (name) => `${name} failed a check`,
+ RECOVERED: (name) => `${name} came back online`,
+ STUCK: (name) => `${name} still failing`,
+};
+
+function Timeline({ events }: { events: AccessCheckEvent[] }) {
+ return (
+ <div>
+ <h3 className="text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ How your access came online
+ </h3>
+ <ul className="mt-2 space-y-1.5 border-l border-border pl-4">
+ {events.map((e, i) => (
+ <li
+ key={`${e.check_type}-${e.event_type}-${e.occurred_at}-${i}`}
+ className="flex items-baseline justify-between gap-3 text-sm"
+ >
+ <span>{EVENT_LABEL[e.event_type](CHECK_NAME[e.check_type] ?? "Access")}</span>
+ <span className="shrink-0 text-xs text-muted-foreground">
+ {timeLabel(e.occurred_at)}
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ );
+}
+
+function verdictHeading(overall: AccessUIState, checks: AccessCheck[]): string {
+ switch (overall) {
+ case "ok":
+ return "Your access is live";
+ case "setting_up":
+ return "Setting up your access";
+ case "retrying":
+ return "Reconnecting your access";
+ case "stuck":
+ return `Your ${worstName(checks, "stuck").toLowerCase()} access needs attention`;
+ }
+}
+
+function verdictBody(overall: AccessUIState, checks: AccessCheck[]): string {
+ const signInOK = checks.some((c) => c.type === "SIGN_IN" && c.ui_state === "ok");
+ switch (overall) {
+ case "ok":
+ return "You can sign in to the cluster and submit jobs against this allocation. Nothing for you to do.";
+ case "setting_up":
+ return signInOK
+ ? "Your cluster sign-in is ready. Job submission is still being set up. This is automatic and usually takes a few minutes."
+ : "Your access is being set up. This is automatic and usually takes a few minutes.";
+ case "retrying": {
+ const name = worstName(checks, "retrying").toLowerCase();
+ return `A system check for ${name} is failing right now. This is almost always temporary. We're retrying automatically, and no action is needed from you.`;
+ }
+ case "stuck": {
+ const name = worstName(checks, "stuck");
+ const rest = signInOK && name !== "Cluster sign-in" ? " Your sign-in still works." : "";
+ return `${name} has been failing its checks for longer than a normal hiccup.${rest} Contact support if it doesn't clear.`;
+ }
+ }
+}
+
+function worstName(checks: AccessCheck[], state: AccessUIState): string {
+ const check = checks.find((c) => c.ui_state === state);
+ return (check && CHECK_NAME[check.type]) || "Access";
+}
+
+function lastChecked(checks: AccessCheck[]): string {
+ return checks.map((c) => c.last_checked_at).sort().at(-1) ?? "";
+}
+
+function relativeTime(iso: string): string {
+ if (!iso) return "just now";
+ const seconds = Math.max(0, Math.floor((Date.now() - Date.parse(iso)) / 1000));
+ if (seconds < 60) return `${seconds}s ago`;
+ const minutes = Math.floor(seconds / 60);
+ if (minutes < 60) return `${minutes}m ago`;
+ const hours = Math.floor(minutes / 60);
+ if (hours < 24) return `${hours}h ago`;
+ return `${Math.floor(hours / 24)}d ago`;
+}
+
+function timeLabel(iso: string): string {
+ const date = new Date(iso);
+ const today = new Date();
+ const sameDay = date.toDateString() === today.toDateString();
+ const time = date.toLocaleTimeString(undefined, { hour: "numeric", minute: "2-digit" });
+ if (sameDay) return `Today · ${time}`;
+ return `${date.toLocaleDateString(undefined, { month: "short", day: "numeric" })} · ${time}`;
+}
diff --git a/web/src/features/core/access-status/queries.ts b/web/src/features/core/access-status/queries.ts
new file mode 100644
index 000000000..b331ee63b
--- /dev/null
+++ b/web/src/features/core/access-status/queries.ts
@@ -0,0 +1,55 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+"use client";
+
+import { useQuery } from "@tanstack/react-query";
+import { getAccessStatus, getAllocationAccessMembers } from "./api";
+
+export const accessStatusKeys = {
+ all: ["access-status"] as const,
+ status: (allocationId: string) => [...accessStatusKeys.all, allocationId] as const,
+ members: (allocationId: string) => [...accessStatusKeys.all, allocationId, "members"] as const,
+};
+
+export function useAccessStatus(allocationId: string | undefined) {
+ return useQuery({
+ queryKey: allocationId
+ ? accessStatusKeys.status(allocationId)
+ : [...accessStatusKeys.all, "none"],
+ queryFn: () => getAccessStatus(allocationId as string),
+ enabled: Boolean(allocationId),
+ refetchInterval: 30_000,
+ refetchOnWindowFocus: false,
+ staleTime: 15_000,
+ gcTime: 300_000,
+ });
+}
+
+export function useAllocationAccessMembers(allocationId: string | undefined, enabled: boolean) {
+ return useQuery({
+ queryKey: allocationId
+ ? accessStatusKeys.members(allocationId)
+ : [...accessStatusKeys.all, "members", "none"],
+ queryFn: () => getAllocationAccessMembers(allocationId as string),
+ enabled: Boolean(allocationId) && enabled,
+ refetchInterval: 30_000,
+ refetchOnWindowFocus: false,
+ staleTime: 15_000,
+ gcTime: 300_000,
+ });
+}
diff --git a/web/src/features/core/access-status/schemas.ts b/web/src/features/core/access-status/schemas.ts
new file mode 100644
index 000000000..b885dc7f2
--- /dev/null
+++ b/web/src/features/core/access-status/schemas.ts
@@ -0,0 +1,60 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+import { z } from "zod";
+
+export const accessCheckTypeSchema = z.enum(["SIGN_IN", "JOB_SUBMISSION"]);
+export type AccessCheckType = z.infer<typeof accessCheckTypeSchema>;
+
+export const accessUIStateSchema = z.enum(["setting_up", "ok", "retrying", "stuck"]);
+export type AccessUIState = z.infer<typeof accessUIStateSchema>;
+
+export const accessCheckSchema = z.object({
+ type: accessCheckTypeSchema,
+ status: z.enum(["PENDING", "OK", "FAILING"]),
+ ui_state: accessUIStateSchema,
+ last_checked_at: z.string(),
+ last_ok_at: z.string().nullish(),
+ failing_since: z.string().nullish(),
+});
+export type AccessCheck = z.infer<typeof accessCheckSchema>;
+
+export const accessCheckEventSchema = z.object({
+ check_type: accessCheckTypeSchema.or(z.literal("")),
+ event_type: z.enum(["STARTED", "ONLINE", "FAILED", "RECOVERED", "STUCK"]),
+ occurred_at: z.string(),
+});
+export type AccessCheckEvent = z.infer<typeof accessCheckEventSchema>;
+
+export const accessStatusSchema = z.object({
+ checks: z.array(accessCheckSchema),
+ events: z.array(accessCheckEventSchema),
+});
+export type AccessStatus = z.infer<typeof accessStatusSchema>;
+
+export const memberAccessStatusSchema = z.object({
+ user_id: z.string(),
+ display_name: z.string(),
+ email: z.string(),
+ checks: z.array(accessCheckSchema),
+});
+export type MemberAccessStatus = z.infer<typeof memberAccessStatusSchema>;
+
+export const allocationAccessMembersSchema = z.object({
+ members: z.array(memberAccessStatusSchema),
+});
+export type AllocationAccessMembers = z.infer<typeof allocationAccessMembersSchema>;
diff --git a/web/src/features/core/allocations/__tests__/AllocationMembersTab.test.tsx b/web/src/features/core/allocations/__tests__/AllocationMembersTab.test.tsx
index b0e4db108..bdc265d6a 100644
--- a/web/src/features/core/allocations/__tests__/AllocationMembersTab.test.tsx
+++ b/web/src/features/core/allocations/__tests__/AllocationMembersTab.test.tsx
@@ -57,6 +57,9 @@ vi.mock("../queries", () => ({
useSetMemberProjectRole: () => roleMutation,
useRemoveMember: () => mutation,
}));
+vi.mock("@/features/core/access-status/queries", () => ({
+ useAllocationAccessMembers: () => ({ data: undefined, isLoading: false, error: null }),
+}));
import { AllocationMembersTab } from "../components/AllocationMembersTab";
diff --git a/web/src/features/core/allocations/components/AllocationMembersTab.tsx b/web/src/features/core/allocations/components/AllocationMembersTab.tsx
index f5a3b3795..737ec0c7a 100644
--- a/web/src/features/core/allocations/components/AllocationMembersTab.tsx
+++ b/web/src/features/core/allocations/components/AllocationMembersTab.tsx
@@ -25,6 +25,9 @@ import { EmptyState } from "@/shared/ui/EmptyState";
import { ErrorState } from "@/shared/ui/ErrorState";
import { TableSkeleton } from "@/shared/ui/Loading";
import { StatusBadge } from "@/shared/ui/StatusBadge";
+import { CHECK_CHIP } from "@/features/core/access-status/components/AllocationAccessBand";
+import { useAllocationAccessMembers } from "@/features/core/access-status/queries";
+import type { AccessCheckType } from "@/features/core/access-status/schemas";
import {
useAddMember,
useAllocationMembers,
@@ -57,8 +60,26 @@ function initialsFrom(name: string): string {
return name.slice(0, 2).toUpperCase();
}
+// Manager-only columns showing each member's access health, fed by the same
+// checks that drive the analytics access band.
+function accessColumns(
+ members: Array<{ user_id: string; checks: Array<{ type: AccessCheckType; ui_state: keyof typeof CHECK_CHIP }> }> | undefined,
+): Array<DataTableColumn<AllocationMembership>> {
+ const byUser = new Map(members?.map((m) => [m.user_id, m.checks]) ?? []);
+ const cellFor = (row: AllocationMembership, type: AccessCheckType) => {
+ const check = byUser.get(row.user_id)?.find((c) => c.type === type);
+ if (!check) return <span className="text-xs text-muted-foreground">—</span>;
+ return <StatusBadge {...CHECK_CHIP[check.ui_state]} />;
+ };
+ return [
+ { key: "signin", header: "Sign-in", cell: (row) => cellFor(row, "SIGN_IN") },
+ { key: "jobs", header: "Jobs", cell: (row) => cellFor(row, "JOB_SUBMISSION") },
+ ];
+}
+
export function AllocationMembersTab({ allocation, canManage }: AllocationMembersTabProps) {
const query = useAllocationMembers(allocation.id);
+ const accessQuery = useAllocationAccessMembers(allocation.id, canManage);
const addMutation = useAddMember(allocation.id);
const roleMutation = useSetMemberProjectRole(allocation.id);
const removeMutation = useRemoveMember(allocation.id);
@@ -143,6 +164,7 @@ export function AllocationMembersTab({ allocation, canManage }: AllocationMember
/>
),
},
+ ...(canManage ? accessColumns(accessQuery.data?.members) : []),
{
key: "actions",
header: "",
diff --git a/web/src/features/core/analytics/components/AnalyticsPage.tsx b/web/src/features/core/analytics/components/AnalyticsPage.tsx
index ffe110859..2b2cbfd50 100644
--- a/web/src/features/core/analytics/components/AnalyticsPage.tsx
+++ b/web/src/features/core/analytics/components/AnalyticsPage.tsx
@@ -19,6 +19,7 @@
import * as React from "react";
import { ChartColumn } from "lucide-react";
+import { AllocationAccessBand } from "@/features/core/access-status/components/AllocationAccessBand";
import { EmptyState } from "@/shared/ui/EmptyState";
import { ErrorState } from "@/shared/ui/ErrorState";
import { Skeleton } from "@/shared/ui/skeleton";
@@ -87,6 +88,7 @@ export function AnalyticsPage() {
selectedAllocationId={allocation.id}
onSelect={select}
/>
+ <AllocationAccessBand allocationId={allocation.id} allocationName={allocation.name} />
<AnalyticsBody
project={project}
allocation={allocation}