Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: support expand group (#20280)

ecmadao1d73e86e4ded
diff --git a/frontend/package.json b/frontend/package.json
index dec5a05d2a..bf0260601e 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -104,7 +104,6 @@
},
"devDependencies": {
"@biomejs/biome": "2.4.14",
- "@codingame/esbuild-import-meta-url-plugin": "^1.0.3",
"@intlify/eslint-plugin-vue-i18n": "^4.0.0",
"@intlify/unplugin-vue-i18n": "11.1.2",
"@playwright/test": "^1.59.1",
@@ -144,6 +143,7 @@
"autoprefixer": "10.5.0",
"code-inspector-plugin": "^1.4.4",
"dotenv": "^17.4.2",
+ "esbuild": "0.27.2",
"eslint": "10.3.0",
"eslint-plugin-vue": "10.9.1",
"jsdom": "27.4.0",
diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml
index 887ad5fd0c..c65a809fde 100644
--- a/frontend/pnpm-lock.yaml
+++ b/frontend/pnpm-lock.yaml
@@ -248,9 +248,6 @@ importers:
'@biomejs/biome':
specifier: 2.4.14
version: 2.4.14
- '@codingame/esbuild-import-meta-url-plugin':
- specifier: ^1.0.3
- version: 1.0.3
'@intlify/eslint-plugin-vue-i18n':
specifier: ^4.0.0
@@ -368,6 +365,9 @@ importers:
dotenv:
specifier: ^17.4.2
version: 17.4.2
+ esbuild:
+ specifier: 0.27.2
+ version: 0.27.2
eslint:
specifier: 10.3.0
version: 10.3.0([email protected])
@@ -1084,9 +1084,6 @@ packages:
'@code-inspector/[email protected]':
resolution: {integrity: sha512-8i3QI/bSirORDF/0P16T6NhNy1RxO7soip8sWeV/2btLbYCwyiaDnqT4Bw3JaM8MNz0N8NaA2qItUrrKE7TtCg==}
- '@codingame/[email protected]':
- resolution: {integrity: sha512-SAIOsWZteIWYAk04BCqQ+ugu8KiJm8EplQbMvxJl905uZv3r+21+XjtGg/zzrbxlVAY1cP+hGAG7z7sBPmy63w==}
-
'@codingame/[email protected]':
resolution: {integrity: sha512-K04QcQA+Zb0KXucBAK/BGCT5dldiwIqdUbBQq7yuLvBLbof3cP1WSUuxasMHGYwM0MWyzIAsDtyAYMS7is8ZuA==}
@@ -6345,11 +6342,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- '@codingame/[email protected]':
- dependencies:
- esbuild: 0.27.2
- import-meta-resolve: 4.1.0
-
'@codingame/[email protected]':
dependencies:
'@codingame/monaco-vscode-base-service-override': 25.1.2
diff --git a/frontend/src/react/components/PermissionGuard.tsx b/frontend/src/react/components/PermissionGuard.tsx
index 7dc2cb36f2..b876e8dc24 100644
--- a/frontend/src/react/components/PermissionGuard.tsx
+++ b/frontend/src/react/components/PermissionGuard.tsx
@@ -8,6 +8,12 @@ import { BlockTooltip, Tooltip } from "./ui/tooltip";
/**
* usePermissionCheck returns whether the user has all the required permissions
* and a tooltip message listing missing ones.
+ *
+ * Reads directly from the Zustand IAM caches without triggering a load —
+ * every current caller mounts inside a route shell that already preloads
+ * (`BannersWrapper` → `useWorkspacePermission` for workspace,
+ * `ProjectRouteShell` / `SQLEditorRouteShell` → `usePermissionDataReady`
+ * for project). If a future orphan caller appears, add the trigger then.
*/
export function usePermissionCheck(
permissions: Permission[],
diff --git a/frontend/src/react/components/UserCell.tsx b/frontend/src/react/components/UserCell.tsx
new file mode 100644
index 0000000000..744fc630c3
--- /dev/null
+++ b/frontend/src/react/components/UserCell.tsx
@@ -0,0 +1,80 @@
+import type { ReactNode } from "react";
+import { cn } from "@/react/lib/utils";
+import { UserAvatar } from "./UserAvatar";
+
+interface UserCellProps {
+ /** Display name. Falls back to email for avatar if empty. */
+ title: string;
+ /** Subtitle line (typically email). */
+ subtitle?: string;
+ /** Size of the avatar. */
+ size?: "sm" | "md";
+ /** Whether to show the avatar. Default true. */
+ showAvatar?: boolean;
+ /** Custom avatar element (e.g. group icon). Overrides the default UserAvatar. */
+ avatar?: ReactNode;
+ /** Name styling when deleted / expired. */
+ nameClassName?: string;
+ /** Wrap the name in a clickable element. */
+ nameLink?: {
+ onClick: () => void;
+ };
+ /** Inline badges rendered after the name. */
+ badges?: ReactNode;
+ /** Extra className on the outer wrapper. */
+ className?: string;
+}
+
+export function UserCell({
+ title,
+ subtitle,
+ size = "md",
+ showAvatar = true,
+ avatar,
+ nameClassName,
+ nameLink,
+ badges,
+ className,
+}: UserCellProps) {
+ const nameContent = title || subtitle || "?";
+
+ const nameEl = nameLink ? (
+ <button
+ type="button"
+ className={cn(
+ "font-medium text-accent hover:underline cursor-pointer",
+ size === "sm" && "text-sm",
+ nameClassName
+ )}
+ onClick={nameLink.onClick}
+ >
+ {nameContent}
+ </button>
+ ) : (
+ <span
+ className={cn(
+ "font-medium text-main",
+ size === "sm" && "text-sm",
+ nameClassName
+ )}
+ >
+ {nameContent}
+ </span>
+ );
+
+ return (
+ <div className={cn("flex items-center gap-x-3", className)}>
+ {showAvatar &&
+ (avatar ?? <UserAvatar title={title || subtitle || "?"} size={size} />)}
+ <div className="flex flex-col">
+ <div className="flex items-center gap-x-1.5">
+ {nameEl}
+ {badges}
+ </div>
+ {subtitle && (
+ <span className="text-control-light text-xs">{subtitle}</span>
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx b/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx
index 1c212555b8..bd7ad3a030 100644
--- a/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx
+++ b/frontend/src/react/components/sql-editor/ConnectionPane/ConnectionPane.tsx
@@ -1039,6 +1039,13 @@ function TreeRow({
}) {
const hoverState = useHoverState();
const rowRef = useRef<HTMLDivElement | null>(null);
+ // Tracks whether the most recent mousedown started on an interactive
+ // descendant (Checkbox, RequestQueryButton). The row's onMouseUp uses
+ // this to skip the row-activation when the user is interacting with a
+ // child control — even if the cursor drifts between mousedown and
+ // mouseup so the synthesized click never reaches the button (the
+ // failure mode `stopPropagation` on the wrapper alone doesn't cover).
+ const interactiveMouseDownRef = useRef(false);
const handleMouseEnter = (e: React.MouseEvent) => {
if (node.meta.type !== "database") return;
@@ -1068,13 +1075,36 @@ function TreeRow({
selected && "bg-accent/10"
)}
data-node-key={node.key}
+ onMouseDown={(e) => {
+ const target = e.target as HTMLElement;
+ // Match `data-row-interactive` first because tooltip / permission
+ // wrappers (Base UI's Tooltip.Trigger renders a `<span>`) can be
+ // the actual mousedown target when the wrapped control is
+ // disabled — `target.closest('button')` from that span walks UP
+ // and won't find the disabled `<button>` descendant. Wrappers
+ // owning interactive controls in this row mark themselves with
+ // `data-row-interactive` to opt out of row activation regardless
+ // of internal nesting.
+ interactiveMouseDownRef.current = !!target.closest(
+ '[data-row-interactive], button, [role="checkbox"], a, input'
+ );
+ }}
// Use `onMouseUp` instead of `onClick` for the row activation. Safari
// drops the synthesized `click` event when `mousedown` and `mouseup`
// resolve to different inner elements (the chevron / engine icon /
// text span). `mouseup` always fires regardless, so we drive the
// selection from there, gated to the primary button.
+ //
+ // We also skip when mousedown started on an interactive descendant
+ // — otherwise pressing a button/checkbox and slightly drifting the
+ // cursor before release would connect-and-close the panel before
+ // the button's click ever fires.
onMouseUp={(e) => {
if (e.button !== 0) return;
+ if (interactiveMouseDownRef.current) {
+ interactiveMouseDownRef.current = false;
+ return;
+ }
onClick(e);
}}
onMouseEnter={handleMouseEnter}
diff --git a/frontend/src/react/components/sql-editor/ConnectionPane/TreeNode/DatabaseNode.tsx b/frontend/src/react/components/sql-editor/ConnectionPane/TreeNode/DatabaseNode.tsx
index 46a8a33dde..5474bd5681 100644
--- a/frontend/src/react/components/sql-editor/ConnectionPane/TreeNode/DatabaseNode.tsx
+++ b/frontend/src/react/components/sql-editor/ConnectionPane/TreeNode/DatabaseNode.tsx
@@ -53,26 +53,31 @@ export function DatabaseNode({
const databaseName = extractDatabaseResourceName(database.name).databaseName;
const canQuery = isDatabaseV1Queryable(database);
+ // Wrappers around interactive controls (checkbox / RequestQueryButton)
+ // are marked with `data-row-interactive` so the parent `TreeRow`'s
+ // mousedown-target check skips row activation when the press starts
+ // anywhere inside — including on a tooltip-trigger `<span>` that
+ // wraps a disabled control (which `closest('button')` misses because
+ // closest walks UP the DOM and the disabled `<button>` is a
+ // descendant of the span).
+ //
+ // We only stop `onClick` propagation here, NOT `mousedown`/`mouseup` —
+ // the row's mousedown listener needs to see the press to record that
+ // it started on an interactive child (so it can skip `onMouseUp`-driven
+ // row activation even when the cursor drifts off the wrapper before
+ // release). Stopping `onClick` is enough to keep checkbox clicks from
+ // leaking to ancestor React onClick handlers.
const checkbox = supportBatchMode ? (
- // The row activates on `mouseup` (Safari workaround). Stop the
- // mouse events here so clicking the checkbox doesn't first connect
- // to the database (which closes the panel and prevents the toggle
- // click from registering) — the previous `onClick` stopPropagation
- // alone wasn't enough because mouseup bubbles before click fires.
- <div
- onMouseDown={(e) => e.stopPropagation()}
- onMouseUp={(e) => e.stopPropagation()}
- >
+ <span data-row-interactive onClick={(e) => e.stopPropagation()}>
<Tooltip content={checkTooltip ?? ""}>
<Checkbox
checked={!!checked}
className="mr-2"
disabled={checkDisabled}
- onClick={(e) => e.stopPropagation()}
onCheckedChange={(checked) => onCheckedChange?.(checked)}
/>
</Tooltip>
- </div>
+ </span>
) : null;
return (
@@ -98,12 +103,8 @@ export function DatabaseNode({
{!canQuery && (
<div
className="ml-auto shrink-0"
- // The row activates on `mouseup` (Safari workaround for click
- // events split across inner elements). Stop propagation here so
- // clicking the button doesn't connect to the database first
- // and unmount the button before its `onClick` can open the drawer.
- onMouseDown={(e) => e.stopPropagation()}
- onMouseUp={(e) => e.stopPropagation()}
+ data-row-interactive
+ onClick={(e) => e.stopPropagation()}
>
<RequestQueryButton
size="sm"
diff --git a/frontend/src/react/pages/settings/GroupsPage.tsx b/frontend/src/react/pages/settings/GroupsPage.tsx
index bdad22eb54..bf8b041e71 100644
--- a/frontend/src/react/pages/settings/GroupsPage.tsx
+++ b/frontend/src/react/pages/settings/GroupsPage.tsx
@@ -13,6 +13,7 @@ import { useTranslation } from "react-i18next";
import { ComponentPermissionGuard } from "@/react/components/ComponentPermissionGuard";
import { FeatureBadge } from "@/react/components/FeatureBadge";
import { HighlightLabelText } from "@/react/components/HighlightLabelText";
+import { UserCell } from "@/react/components/UserCell";
import { UserSelect } from "@/react/components/UserSelect";
import { Alert } from "@/react/components/ui/alert";
import { Badge } from "@/react/components/ui/badge";
@@ -400,19 +401,25 @@ function GroupRow({
return (
<TableRow key={user.name} className={stripeBg}>
<TableCell className="py-2 pl-14">
- <div className="flex items-center gap-x-2">
- <span>{user.title}</span>
- <span className="textinfolabel text-xs">{user.email}</span>
- {isOwner ? (
- <Badge variant="secondary" className="text-xs px-1.5 py-0">
- {t("settings.members.groups.form.role.owner")}
- </Badge>
- ) : (
- <Badge variant="default" className="text-xs px-1.5 py-0">
- {t("settings.members.groups.form.role.member")}
- </Badge>
- )}
- </div>
+ <UserCell
+ title={user.title}
+ subtitle={user.email}
+ size="sm"
+ badges={
+ isOwner ? (
+ <Badge
+ variant="secondary"
+ className="text-xs px-1.5 py-0"
+ >
+ {t("settings.members.groups.form.role.owner")}
+ </Badge>
+ ) : (
+ <Badge variant="default" className="text-xs px-1.5 py-0">
+ {t("settings.members.groups.form.role.member")}
+ </Badge>
+ )
+ }
+ />
</TableCell>
<TableCell />
</TableRow>
diff --git a/frontend/src/react/pages/settings/MembersPage.tsx b/frontend/src/react/pages/settings/MembersPage.tsx
index bf2fb58ced..0d3169d784 100644
--- a/frontend/src/react/pages/settings/MembersPage.tsx
+++ b/frontend/src/react/pages/settings/MembersPage.tsx
@@ -19,7 +19,7 @@ import React, {
} from "react";
import { useTranslation } from "react-i18next";
import { groupProjectRoleBindings } from "@/components/Member/projectRoleBindings";
-import type { MemberBinding } from "@/components/Member/types";
+import type { GroupBinding, MemberBinding } from "@/components/Member/types";
import { getMemberBindings } from "@/components/Member/utils";
import {
getRoleEnvironmentLimitationKind,
@@ -33,7 +33,7 @@ import { LearnMoreLink } from "@/react/components/LearnMoreLink";
import { PermissionGuard } from "@/react/components/PermissionGuard";
import { RoleSelect } from "@/react/components/RoleSelect";
import { DDLWarningCallout } from "@/react/components/role-grant/DDLWarningCallout";
-import { UserAvatar } from "@/react/components/UserAvatar";
+import { UserCell } from "@/react/components/UserCell";
import { Alert } from "@/react/components/ui/alert";
import { Badge } from "@/react/components/ui/badge";
import { Button } from "@/react/components/ui/button";
@@ -66,6 +66,11 @@ import { Tooltip } from "@/react/components/ui/tooltip";
import { useEscapeKey } from "@/react/hooks/useEscapeKey";
import { useVueState } from "@/react/hooks/useVueState";
import { cn } from "@/react/lib/utils";
+import {
+ useNavigate,
+ WORKSPACE_ROUTE_GROUPS,
+ WORKSPACE_ROUTE_USER_PROFILE,
+} from "@/react/router";
import {
pushNotification,
useActuatorV1Store,
@@ -75,6 +80,7 @@ import {
useRoleStore,
useSettingV1Store,
useSubscriptionV1Store,
+ useUserStore,
useWorkspaceV1Store,
} from "@/store";
import { projectNamePrefix } from "@/store/modules/v1/common";
@@ -89,6 +95,7 @@ import { State } from "@/types/proto-es/v1/common_pb";
import { type Binding, BindingSchema } from "@/types/proto-es/v1/iam_policy_pb";
import { Setting_SettingName } from "@/types/proto-es/v1/setting_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
+import type { User } from "@/types/proto-es/v1/user_service_pb";
import { AccountType, getAccountTypeByEmail } from "@/types/v1/user";
import {
displayRoleTitle,
@@ -145,6 +152,111 @@ function MemberTable({
const currentUser = useVueState(() => useCurrentUserV1().value);
const actuatorStore = useActuatorV1Store();
const isSaaSMode = useVueState(() => actuatorStore.isSaaSMode);
+ const userStore = useUserStore();
+ const navigate = useNavigate();
+ const canGetGroups = hasWorkspacePermissionV2("bb.groups.get");
+ const canGetUsers = hasWorkspacePermissionV2("bb.users.get");
+
+ // Group expand state. Cache is keyed by group name and invalidated
+ // when the group-binding *content* changes — not on `bindings`
+ // reference change, because the parent rebuilds `memberBindings` via
+ // `useVueState(() => getMemberBindings(...))` and gets a new array
+ // identity on every render. We can't use the `prevBindingsRef.current
+ // !== bindings` shortcut that `GroupsPage` uses (its `groups` comes
+ // from a reducer-backed `usePagedData` with stable identity).
+ // Comparing a content-derived signature instead lets the cache only
+ // reset on real membership changes — same effect, different trigger.
+ const [expandedGroups, setExpandedGroups] = useState<Set<string>>(new Set());
+ const [memberCache, setMemberCache] = useState<Map<string, User[]>>(
+ new Map()
+ );
+ const memberCacheRef = useRef(memberCache);
+ memberCacheRef.current = memberCache;
+ const loadingRef = useRef<Set<string>>(new Set());
+
+ const fetchGroupMembers = useCallback(
+ (group: GroupBinding) => {
+ if (loadingRef.current.has(group.name)) return;
+ loadingRef.current.add(group.name);
+ const memberNames = group.members.map((m) => m.member);
+ userStore
+ .batchGetOrFetchUsers(memberNames)
+ .then((users: (User | undefined)[]) => {
+ setMemberCache((prev) => {
+ const next = new Map(prev);
+ next.set(
+ group.name,
+ users.filter((u): u is User => !!u)
+ );
+ return next;
+ });
+ })
+ .catch(() => {
+ // Allow retry on next expand
+ })
+ .finally(() => loadingRef.current.delete(group.name));
+ },
+ [userStore]
+ );
+
+ // Signature of just the group bindings — that's all the cache cares
+ // about. Recomputed on every render (because `bindings` reference
+ // changes), but yields a stable string when group content is
+ // unchanged, so the effect below only fires on real membership
+ // changes.
+ const groupBindingsSignature = useMemo(() => {
+ const parts: string[] = [];
+ for (const b of bindings) {
+ if (b.type !== "groups" || !b.group) continue;
+ const members = b.group.members
+ .map((m) => m.member)
+ .sort()
+ .join(",");
+ parts.push(`${b.group.name}:${members}`);
+ }
+ return parts.join("|");
+ }, [bindings]);
+
+ // Reset the cache and refetch currently-expanded groups when the
+ // group-bindings signature changes (membership edit, IAM refresh).
+ const expandedGroupsRef = useRef(expandedGroups);
+ expandedGroupsRef.current = expandedGroups;
+ const bindingsRef = useRef(bindings);
+ bindingsRef.current = bindings;
+ const fetchGroupMembersRef = useRef(fetchGroupMembers);
+ fetchGroupMembersRef.current = fetchGroupMembers;
+ useEffect(() => {
+ setMemberCache(new Map());
+ loadingRef.current = new Set();
+ for (const groupName of expandedGroupsRef.current) {
+ const mb = bindingsRef.current.find(
+ (b) => b.type === "groups" && b.group?.name === groupName
+ );
+ if (mb?.group) {
+ fetchGroupMembersRef.current(mb.group);
+ }
+ }
+ }, [groupBindingsSignature]);
+
+ const toggleGroupExpand = useCallback(
+ (group: GroupBinding) => {
+ setExpandedGroups((prev) => {
+ const next = new Set(prev);
+ if (next.has(group.name)) {
+ next.delete(group.name);
+ } else {
+ next.add(group.name);
+ }
+ return next;
+ });
+
+ // Fetch members if not cached
+ if (!memberCacheRef.current.has(group.name)) {
+ fetchGroupMembers(group);
+ }
+ },
+ [fetchGroupMembers]
+ );
const selectableBindings = useMemo(
() =>
@@ -244,123 +356,222 @@ function MemberTable({
</TableRow>
</TableHeader>
<TableBody>
- {bindings.map((mb) => (
- <TableRow key={mb.binding}>
- {allowEdit && (
- <TableCell>
- <Checkbox
- checked={selectedBindings.includes(mb.binding)}
- disabled={isSelectDisabled(mb)}
- onCheckedChange={() => toggleOne(mb.binding)}
- />
- </TableCell>
- )}
- <TableCell>
- <div className="flex items-center gap-x-3">
- {mb.type === "users" ? (
- <UserAvatar title={mb.title || mb.user?.email || "?"} />
- ) : (
- <div className="size-9 rounded-full bg-control-bg-hover flex items-center justify-center shrink-0">
- <Users className="size-4 text-control-light" />
- </div>
+ {bindings.map((mb) => {
+ const isGroupExpanded =
+ mb.type === "groups" &&
+ mb.group &&
+ expandedGroups.has(mb.group.name);
+ const groupMembers = mb.group
+ ? memberCache.get(mb.group.name)
+ : undefined;
+
+ return (
+ <React.Fragment key={mb.binding}>
+ <TableRow>
+ {allowEdit && (
+ <TableCell>
+ <Checkbox
+ checked={selectedBindings.includes(mb.binding)}
+ disabled={isSelectDisabled(mb)}
+ onCheckedChange={() => toggleOne(mb.binding)}
+ />
+ </TableCell>
)}
- <div className="flex flex-col">
- <div className="flex items-center gap-x-1.5">
- <span className="font-medium text-accent">
- {mb.title}
- </span>
- {mb.type === "users" &&
- mb.user?.name === currentUser.name && (
- <Badge className="text-xs">{t("common.you")}</Badge>
- )}
- {isSaaSMode && mb.type === "users" && mb.pending && (
- <Badge variant="warning" className="text-xs">
- {t("settings.members.pending-invite")}
- </Badge>
- )}
- {mb.type === "users" &&
- mb.user?.email &&
- getAccountTypeByEmail(mb.user.email) ===
- AccountType.SERVICE_ACCOUNT && (
- <Badge variant="secondary" className="text-xs">
- {t("settings.members.service-account")}
- </Badge>
- )}
- {mb.type === "users" &&
- mb.user?.email &&
- getAccountTypeByEmail(mb.user.email) ===
- AccountType.WORKLOAD_IDENTITY && (
- <Badge variant="secondary" className="text-xs">
- {t("settings.members.workload-identity")}
- </Badge>
- )}
- {mb.group && (
- <span className="text-control-light text-xs">
- ({mb.group.members.length}{" "}
- {t("common.members", {
- count: mb.group.members.length,
- })}
- )
- </span>
+ <TableCell>
+ <UserCell
+ title={mb.title}
+ subtitle={
+ mb.type === "users"
+ ? mb.user?.email
+ : mb.binding.replace("group:", "groups/")
+ }
+ avatar={
+ mb.type === "groups" ? (
+ <>
+ <button
+ type="button"
+ className="flex size-5 shrink-0 items-center justify-center cursor-pointer"
+ onClick={() =>
+ mb.group && toggleGroupExpand(mb.group)
+ }
+ >
+ {isGroupExpanded ? (
+ <ChevronDown className="size-4 text-control-light" />
+ ) : (
+ <ChevronRight className="size-4 text-control-light" />
+ )}
+ </button>
+ <div className="size-9 rounded-full bg-control-bg-hover flex items-center justify-center shrink-0">
+ <Users className="size-4 text-control-light" />
+ </div>
+ </>
+ ) : undefined
+ }
+ nameLink={
+ mb.type === "users" && canGetUsers && mb.user?.email
+ ? {
+ onClick: () =>
+ void navigate.push({
+ name: WORKSPACE_ROUTE_USER_PROFILE,
+ params: {
+ principalEmail: mb.user!.email,
+ },
+ }),
+ }
+ : mb.type === "groups" && canGetGroups
+ ? {
+ onClick: () =>
+ void navigate.push({
+ name: WORKSPACE_ROUTE_GROUPS,
+ }),
+ }
+ : undefined
+ }
+ badges={
+ <>
+ {mb.type === "users" &&
+ mb.user?.name === currentUser.name && (
+ <Badge className="text-xs">
+ {t("common.you")}
+ </Badge>
+ )}
+ {isSaaSMode && mb.type === "users" && mb.pending && (
+ <Badge variant="warning" className="text-xs">
+ {t("settings.members.pending-invite")}
+ </Badge>
+ )}
+ {mb.type === "users" &&
+ mb.user?.email &&
+ getAccountTypeByEmail(mb.user.email) ===
+ AccountType.SERVICE_ACCOUNT && (
+ <Badge variant="secondary" className="text-xs">
+ {t("settings.members.service-account")}
+ </Badge>
+ )}
+ {mb.type === "users" &&
+ mb.user?.email &&
+ getAccountTypeByEmail(mb.user.email) ===
+ AccountType.WORKLOAD_IDENTITY && (
+ <Badge variant="secondary" className="text-xs">
+ {t("settings.members.workload-identity")}
+ </Badge>
+ )}
+ {mb.group && (
+ <span className="text-control-light text-xs">
+ ({mb.group.members.length}{" "}
+ {t("common.members", {
+ count: mb.group.members.length,
+ })}
+ )
+ </span>
+ )}
+ {mb.group?.deleted && (
+ <Badge variant="destructive" className="text-xs">
+ {t("common.deleted")}
+ </Badge>
+ )}
+ </>
+ }
+ />
+ </TableCell>
+ <TableCell>
+ <div className="flex flex-wrap gap-1">
+ {scope === "project"
+ ? renderProjectRoleSummary(mb.projectRoleBindings)
+ : sortRoles([...mb.workspaceLevelRoles]).map((role) => (
+ <Badge key={role} className="text-xs gap-x-1">
+ <Building2 className="h-3 w-3" />
+ {displayRoleTitle(role)}
+ </Badge>
+ ))}
+ </div>
+ </TableCell>
+ <TableCell>
+ <div className="flex items-center gap-x-1">
+ {allowEdit && canEdit(mb) && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => onUpdateBinding(mb)}
+ >
+ <Pencil className="h-4 w-4" />
+ </Button>
)}
- {mb.group?.deleted && (
- <Badge variant="destructive" className="text-xs">
- {t("common.deleted")}
- </Badge>
+ {allowEdit && (
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => {
+ if (
+ window.confirm(
+ t("settings.members.revoke-access-alert")
+ )
+ ) {
+ onRevokeBinding(mb);
+ }
+ }}
+ >
+ <Trash2 className="h-4 w-4" />
+ </Button>
)}
</div>
- <span className="text-control-light text-xs">
- {mb.type === "users"
- ? mb.user?.email
- : mb.binding.replace("group:", "groups/")}
- </span>
- </div>
- </div>
- </TableCell>
- <TableCell>
- <div className="flex flex-wrap gap-1">
- {scope === "project"
- ? renderProjectRoleSummary(mb.projectRoleBindings)
- : sortRoles([...mb.workspaceLevelRoles]).map((role) => (
- <Badge key={role} className="text-xs gap-x-1">
- <Building2 className="h-3 w-3" />
- {displayRoleTitle(role)}
- </Badge>
- ))}
- </div>
- </TableCell>
- <TableCell>
- <div className="flex items-center gap-x-1">
- {allowEdit && canEdit(mb) && (
- <Button
- variant="ghost"
- size="sm"
- onClick={() => onUpdateBinding(mb)}
- >
- <Pencil className="h-4 w-4" />
- </Button>
- )}
- {allowEdit && (
- <Button
- variant="ghost"
- size="sm"
- onClick={() => {
- if (
- window.confirm(
- t("settings.members.revoke-access-alert")
- )
- ) {
- onRevokeBinding(mb);
- }
- }}
- >
- <Trash2 className="h-4 w-4" />
- </Button>
- )}
- </div>
- </TableCell>
- </TableRow>
- ))}
+ </TableCell>
+ </TableRow>
+ {/* Expanded group members */}
+ {isGroupExpanded &&
+ (groupMembers ? (
+ groupMembers.map((user) => (
+ <TableRow key={`${mb.binding}-${user.name}`}>
+ {allowEdit && <TableCell />}
+ <TableCell>
+ <UserCell
+ title={user.title}
+ subtitle={user.email}
+ size="sm"
+ className="pl-12"
+ nameLink={
+ canGetUsers
+ ? {
+ onClick: () =>
+ void navigate.push({
+ name: WORKSPACE_ROUTE_USER_PROFILE,
+ params: {
+ principalEmail: user.email,
+ },
+ }),
+ }
+ : undefined
+ }
+ badges={
+ user.name === currentUser.name ? (
+ <Badge className="text-xs">
+ {t("common.you")}
+ </Badge>
+ ) : undefined
+ }
+ />
+ </TableCell>
+ <TableCell />
+ <TableCell />
+ </TableRow>
+ ))
+ ) : (
+ <TableRow>
+ {allowEdit && <TableCell />}
+ <TableCell>
+ <div className="flex items-center gap-x-3 pl-12">
+ <span className="text-sm text-control-light">
+ {t("common.loading")}
+ </span>
+ </div>
+ </TableCell>
+ <TableCell />
+ <TableCell />
+ </TableRow>
+ ))}
+ </React.Fragment>
+ );
+ })}
{bindings.length === 0 && (
<TableRow>
<TableCell
@@ -502,27 +713,26 @@ function MemberTableByRole({
className={cn(allExpired && "opacity-60")}
>
<TableCell className="pl-10">
- <div className="flex items-center gap-x-3">
- {mb.type === "users" ? (
- <UserAvatar
- title={mb.title || mb.user?.email || "?"}
- size="sm"
- />
- ) : (
- <div className="size-7 rounded-full bg-control-bg-hover flex items-center justify-center shrink-0">
- <Users className="size-3.5 text-control-light" />
- </div>
- )}
- <div className="flex flex-col">
- <div className="flex items-center gap-x-1.5">
- <span
- className={cn(
- "font-medium text-accent",
- allExpired && "line-through"
- )}
- >
- {mb.title}
- </span>
+ <UserCell
+ title={mb.title}
+ subtitle={
+ mb.type === "users"
+ ? mb.user?.email
+ : mb.binding.replace("group:", "groups/")
+ }
+ size="sm"
+ avatar={
+ mb.type === "groups" ? (
+ <div className="size-7 rounded-full bg-control-bg-hover flex items-center justify-center shrink-0">
+ <Users className="size-3.5 text-control-light" />
+ </div>
+ ) : undefined
+ }
+ nameClassName={
+ allExpired ? "line-through" : undefined
+ }
+ badges={
+ <>
{allExpired && (
<Badge
variant="destructive"
@@ -574,14 +784,9 @@ function MemberTableByRole({
{t("common.deleted")}
</Badge>
)}
- </div>
- <span className="text-control-light text-xs">
- {mb.type === "users"
- ? mb.user?.email
- : mb.binding.replace("group:", "groups/")}
- </span>
- </div>
- </div>
+ </>
+ }
+ />
</TableCell>
<TableCell />
<TableCell className="w-24">
@@ -1636,6 +1841,13 @@ export function MembersPage({ projectId }: { projectId?: string }) {
: undefined
);
+ // `useVueState` ensures we re-render whenever any reactive dep
+ // `getMemberBindings(...)` reads from changes — IAM policies, but
+ // also the group / user / service-account / workload-identity stores
+ // it pulls metadata from. The result array reference changes on every
+ // render; the table component handles that with content-based change
+ // detection (a group-bindings signature) so its expand-cache only
+ // resets on real membership changes.
const memberBindings = useVueState(() =>
getMemberBindings({
policies:
diff --git a/frontend/src/react/pages/settings/ServiceAccountsPage.tsx b/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
index e8674ad511..cac74f1d97 100644
--- a/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
+++ b/frontend/src/react/pages/settings/ServiceAccountsPage.tsx
@@ -5,7 +5,7 @@ import { useCallback, useMemo, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { PermissionGuard } from "@/react/components/PermissionGuard";
import { RoleSelect } from "@/react/components/RoleSelect";
-import { UserAvatar } from "@/react/components/UserAvatar";
+import { UserCell } from "@/react/components/UserCell";
import { Badge } from "@/react/components/ui/badge";
import { Button } from "@/react/components/ui/button";
import { Checkbox } from "@/react/components/ui/checkbox";
@@ -241,26 +241,20 @@ function ServiceAccountTable({
{/* Account column */}
<TableCell>
<div className="flex items-center gap-x-3">
- <UserAvatar title={user.title || user.email} />
- <div className="flex flex-col min-w-0">
- <div className="flex items-center gap-x-1.5">
- <span
- className={
- isDeleted
- ? "line-through text-control-light"
- : "font-medium text-main"
- }
- >
- {user.title}
- </span>
+ <UserCell
+ title={user.title}
+ subtitle={user.email}
+ nameClassName={
+ isDeleted
+ ? "line-through !text-control-light"
+ : undefined
+ }
+ badges={
<Badge className="text-xs px-1.5 py-0">
{t("settings.members.service-account")}
</Badge>
- </div>
- <span className="textinfolabel text-xs">
- {user.email}
- </span>
- </div>
+ }
+ />
{!isDeleted && (
<div className="ml-auto text-xs shrink-0">
{user.serviceKey && !copiedKeys.has(user.name) ? (
diff --git a/frontend/src/react/pages/settings/UsersPage.tsx b/frontend/src/react/pages/settings/UsersPage.tsx
index a3a888b8e9..e55d064c0b 100644
--- a/frontend/src/react/pages/settings/UsersPage.tsx
+++ b/frontend/src/react/pages/settings/UsersPage.tsx
@@ -16,7 +16,7 @@ import { useTranslation } from "react-i18next";
import { ComponentPermissionGuard } from "@/react/components/ComponentPermissionGuard";
import { FeatureBadge } from "@/react/components/FeatureBadge";
import { RoleSelect } from "@/react/components/RoleSelect";
-import { UserAvatar } from "@/react/components/UserAvatar";
+import { UserCell } from "@/react/components/UserCell";
import { Badge } from "@/react/components/ui/badge";
import { Button } from "@/react/components/ui/button";
import { Checkbox } from "@/react/components/ui/checkbox";
@@ -290,19 +290,14 @@ function UserTable({
>
{/* Account column */}
<TableCell className="py-2">
- <div className="flex items-center gap-x-3">
- <UserAvatar title={user.title || user.email} />
- <div className="flex flex-col">
- <div className="flex items-center gap-x-1.5">
- <span
- className={
- isDeleted
- ? "line-through text-control-light"
- : "font-medium text-main"
- }
- >
- {user.title}
- </span>
+ <UserCell
+ title={user.title}
+ subtitle={user.email}
+ nameClassName={
+ isDeleted ? "line-through !text-control-light" : undefined
+ }
+ badges={
+ <>
{isSelf && (
<Badge
variant="secondary"
@@ -329,12 +324,9 @@ function UserTable({
{user.profile.source}
</Badge>
)}
- </div>
- <span className="textinfolabel text-xs">
- {user.email}
- </span>
- </div>
- </div>
+ </>
+ }
+ />
</TableCell>
{/* Groups column */}
diff --git a/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx b/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
index 5757f43064..d88a5ce98b 100644
--- a/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
+++ b/frontend/src/react/pages/settings/WorkloadIdentitiesPage.tsx
@@ -3,7 +3,7 @@ import { useCallback, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { CreateWorkloadIdentitySheet } from "@/react/components/CreateWorkloadIdentitySheet";
import { PermissionGuard } from "@/react/components/PermissionGuard";
-import { UserAvatar } from "@/react/components/UserAvatar";
+import { UserCell } from "@/react/components/UserCell";
import { Button } from "@/react/components/ui/button";
import { Checkbox } from "@/react/components/ui/checkbox";
import {
@@ -162,23 +162,15 @@ function WorkloadIdentityTable({
>
{/* Account column */}
<TableCell>
- <div className="flex items-center gap-x-3">
- <UserAvatar title={user.title || user.email} />
- <div className="flex flex-col">
- <span
- className={
- isDeleted
- ? "line-through text-control-light font-medium"
- : "font-medium text-main"
- }
- >
- {user.title || user.email}
- </span>
- <span className="textinfolabel text-xs">
- {user.email}
- </span>
- </div>
- </div>
+ <UserCell
+ title={user.title}
+ subtitle={user.email}
+ nameClassName={
+ isDeleted
+ ? "line-through !text-control-light"
+ : undefined
+ }
+ />
</TableCell>
{/* Operations column — destructive/secondary actions only.
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index a015572290..cf4d38489a 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -1,7 +1,5 @@
import { fileURLToPath, URL } from "node:url";
-// @ts-ignore -- esbuild is a transitive dependency via vite
import { transform as esbuildTransform } from "esbuild";
-import importMetaUrlPlugin from "@codingame/esbuild-import-meta-url-plugin";
import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite";
import yaml from "@rollup/plugin-yaml";
import tailwindcss from "@tailwindcss/vite";
@@ -139,9 +137,6 @@ export default defineConfig({
},
optimizeDeps: {
include: ["vscode-textmate", "vscode-oniguruma"],
- esbuildOptions: {
- plugins: [importMetaUrlPlugin],
- },
},
envPrefix: ["BB_", "GIT_COMMIT"],
define: {