From d67a9c9b628b6e84d1c6569d32fe55edb9405d8e Mon Sep 17 00:00:00 2001 From: Matthew Daubney Date: Tue, 20 Oct 2026 12:16:02 +0100 Subject: [PATCH] Rework Graph page: node cards, key, toolbar bar and details card - Custom graph nodes with identity kind tags and per-column colours; wider text, styled edge labels, "full access" for everything grants. - Filters, refresh and the key share one bar above the canvas. - Details card restructured into sections with capability chips, a collapsible policy HCL and a red Revoke button; shared CapabilityChips component. Co-Authored-By: Claude Sonnet 5.5 --- src/features/graph/Details.tsx | 162 +++++++++++---- src/features/graph/GraphNode.tsx | 14 ++ src/features/graph/GraphPage.test.tsx | 4 +- src/features/graph/GraphPage.tsx | 72 +++++-- src/features/secrets/AccessPanel.tsx | 18 +- src/features/shared/CapabilityChips.tsx | 20 ++ src/index.css | 261 +++++++++++++++++++++--- 7 files changed, 441 insertions(+), 110 deletions(-) create mode 100644 src/features/graph/GraphNode.tsx create mode 100644 src/features/shared/CapabilityChips.tsx diff --git a/src/features/graph/Details.tsx b/src/features/graph/Details.tsx index 1482add..bf6ccd3 100644 --- a/src/features/graph/Details.tsx +++ b/src/features/graph/Details.tsx @@ -3,6 +3,7 @@ import type { BaoClient } from '../../api/bao' import { revokeAccess } from '../../api/grants' import type { AccessGraph, GraphEdge, GraphNode, PolicyInput } from '../../model/graph' import { parseManagedPolicy, type GrantTarget } from '../../model/managed' +import { CapabilityChips } from '../shared/CapabilityChips' export type Selection = { kind: 'node'; id: string } | { kind: 'edge'; id: string } @@ -17,65 +18,125 @@ interface Props { const nodeById = (g: AccessGraph, id: string) => g.nodes.find((n) => n.id === id) const label = (n: GraphNode | undefined) => n?.label ?? '?' +/** An identity's name with its kind, so "alice" the user and "alice" the entity read differently. */ +function Who({ node }: { node: GraphNode | undefined }) { + return ( + <> + {label(node)} + {node?.type === 'identity' && {node.kind}} + + ) +} + +function Warnings({ items }: { items: string[] | undefined }) { + return items?.map((w) => ( +

+ {w} +

+ )) +} + function NodeDetails({ node, full, policies }: { node: GraphNode; full: AccessGraph; policies: PolicyInput[] }) { const out = full.edges.filter((e) => e.source === node.id) const into = full.edges.filter((e) => e.target === node.id) - const caps = (e: GraphEdge) => (e.capabilities?.length ? ` (${e.capabilities.join(', ')})` : '') if (node.type === 'identity') { return ( <> -

{node.label}

-

{node.kind}

+
+

{node.label}

+ {node.kind} +

Policies

- - - ) - } - if (node.type === 'policy') { - const hcl = policies.find((p) => p.name === node.label)?.hcl - return ( - <> -

{node.label}

-

- {node.missing ? 'Attached but does not exist.' : node.managed ? 'Managed by EnvBao.' : 'Not managed by EnvBao (read-only).'} -

- {node.warnings.length > 0 && ( -