Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix(frontend): hide empty pending invitation tables

Josuéac124c51625e
diff --git a/control-ui/app/globals.css b/control-ui/app/globals.css
index eecafa271..3f8dec945 100644
--- a/control-ui/app/globals.css
+++ b/control-ui/app/globals.css
@@ -1841,6 +1841,10 @@ textarea.cu-input {
border-top: 1px solid var(--cu-border-subtle);
}
+.cu-table-wrap--section-gap {
+ margin-top: var(--cu-space-4);
+}
+
.cu-table {
width: 100%;
border-collapse: collapse;
diff --git a/control-ui/components/ControlAdminsPanel/index.tsx b/control-ui/components/ControlAdminsPanel/index.tsx
index 90e87eee7..a244c86e2 100644
--- a/control-ui/components/ControlAdminsPanel/index.tsx
+++ b/control-ui/components/ControlAdminsPanel/index.tsx
@@ -113,6 +113,7 @@ export function ControlAdminsPanel({
.some(value => value.toLowerCase().includes(normalizedSearch))
)
}, [invitations, normalizedSearch])
+ const showInvitationsTable = loading || invitations.length > 0
const filteredAdmins = useMemo(() => {
// Disabled admins are retained for audit/lifecycle history, but they are
@@ -359,78 +360,83 @@ export function ControlAdminsPanel({
return (
<div className="cu-profile-section">
{error ? <div className="cu-banner cu-banner--error">{error}</div> : null}
- <div className="eft-table-viewport cu-table-wrap cu-table-wrap--border-top">
- <DataTable className="eft-table cu-table cu-table--header-band">
- <thead>
- <tr>
- <TableHeaderCell
- activeDirection={invitationSort.key === 'email' ? invitationSort.direction : null}
- label="Pending invitation"
- onSort={() => invitationSort.sortBy('email')}
- />
- <TableHeaderCell
- activeDirection={invitationSort.key === 'status' ? invitationSort.direction : null}
- label="Status"
- onSort={() => invitationSort.sortBy('status')}
- />
- <TableHeaderCell
- activeDirection={invitationSort.key === 'expires' ? invitationSort.direction : null}
- label="Expires"
- onSort={() => invitationSort.sortBy('expires')}
- />
- <TableHeaderCell
- activeDirection={invitationSort.key === 'created' ? invitationSort.direction : null}
- label="Created"
- onSort={() => invitationSort.sortBy('created')}
- />
- <th aria-label="Actions" />
- </tr>
- </thead>
- <tbody>
- {loading ? (
- <TableStateRow colSpan={5} kind="loading" message="Loading invitations…" />
- ) : error && filteredInvitations.length === 0 ? (
- <TableStateRow colSpan={5} kind="error" message={error} />
- ) : filteredInvitations.length === 0 ? (
- <TableStateRow
- colSpan={5}
- message={
- normalizedSearch
- ? 'No pending invitations match this search.'
- : 'No pending invitations.'
- }
- />
- ) : (
- invitationSort.sortedRows.map(invitation => (
- <tr key={invitation.id}>
- <td>{invitation.email}</td>
- <td>{invitation.status}</td>
- <td>{formatDate(invitation.expiresAt)}</td>
- <td>{formatDate(invitation.createdAt)}</td>
- <td className="cu-table__cell-actions">
- <RowActionsMenu
- ariaLabel={`Actions for invitation ${invitation.email}`}
- actions={[
- {
- key: 'cancel',
- label:
- cancellingInvitationId === invitation.id
- ? 'Canceling…'
- : 'Cancel invitation',
- disabled: cancellingInvitationId === invitation.id,
- onClick: () => void handleCancelInvitation(invitation),
- danger: true,
- },
- ]}
- />
- </td>
- </tr>
- ))
- )}
- </tbody>
- </DataTable>
- </div>
- <div className="eft-table-viewport cu-table-wrap cu-table-wrap--border-top">
+ {showInvitationsTable ? (
+ <div className="eft-table-viewport cu-table-wrap cu-table-wrap--border-top">
+ <DataTable className="eft-table cu-table cu-table--header-band">
+ <thead>
+ <tr>
+ <TableHeaderCell
+ activeDirection={invitationSort.key === 'email' ? invitationSort.direction : null}
+ label="Pending invitation"
+ onSort={() => invitationSort.sortBy('email')}
+ />
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'status' ? invitationSort.direction : null
+ }
+ label="Status"
+ onSort={() => invitationSort.sortBy('status')}
+ />
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'expires' ? invitationSort.direction : null
+ }
+ label="Expires"
+ onSort={() => invitationSort.sortBy('expires')}
+ />
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'created' ? invitationSort.direction : null
+ }
+ label="Created"
+ onSort={() => invitationSort.sortBy('created')}
+ />
+ <th aria-label="Actions" />
+ </tr>
+ </thead>
+ <tbody>
+ {loading ? (
+ <TableStateRow colSpan={5} kind="loading" message="Loading invitations…" />
+ ) : error && filteredInvitations.length === 0 ? (
+ <TableStateRow colSpan={5} kind="error" message={error} />
+ ) : filteredInvitations.length === 0 ? (
+ <TableStateRow colSpan={5} message="No pending invitations match this search." />
+ ) : (
+ invitationSort.sortedRows.map(invitation => (
+ <tr key={invitation.id}>
+ <td>{invitation.email}</td>
+ <td>{invitation.status}</td>
+ <td>{formatDate(invitation.expiresAt)}</td>
+ <td>{formatDate(invitation.createdAt)}</td>
+ <td className="cu-table__cell-actions">
+ <RowActionsMenu
+ ariaLabel={`Actions for invitation ${invitation.email}`}
+ actions={[
+ {
+ key: 'cancel',
+ label:
+ cancellingInvitationId === invitation.id
+ ? 'Canceling…'
+ : 'Cancel invitation',
+ disabled: cancellingInvitationId === invitation.id,
+ onClick: () => void handleCancelInvitation(invitation),
+ danger: true,
+ },
+ ]}
+ />
+ </td>
+ </tr>
+ ))
+ )}
+ </tbody>
+ </DataTable>
+ </div>
+ ) : null}
+ <div
+ className={`eft-table-viewport cu-table-wrap cu-table-wrap--border-top${
+ showInvitationsTable ? ' cu-table-wrap--section-gap' : ''
+ }`}
+ >
<DataTable className="eft-table cu-table cu-table--header-band">
<thead>
<tr>
diff --git a/control-ui/components/ProfileAdminHome.tsx b/control-ui/components/ProfileAdminHome.tsx
index 4650ca708..132a92c43 100644
--- a/control-ui/components/ProfileAdminHome.tsx
+++ b/control-ui/components/ProfileAdminHome.tsx
@@ -161,6 +161,8 @@ export function ProfileAdminHome({ activeTab, highlightedAdminId = '' }: Profile
.includes(q)
)
}, [pendingInvitations, searchInput])
+ const showPendingInvitations =
+ (busy && !loaded) || pendingInvitations.length > 0 || (Boolean(error) && !loaded)
const visibleUsers = useMemo(() => {
const pendingEmails = new Set(
@@ -673,101 +675,104 @@ export function ProfileAdminHome({ activeTab, highlightedAdminId = '' }: Profile
</div>
) : (
<>
- <div className="cu-profile-section">
- <p className="cu-profile-section__label">Pending invitations</p>
- <div className="eft-table-viewport cu-table-wrap">
- <DataTable className="eft-table cu-table cu-table--profile cu-table--header-band">
- <thead>
- <tr>
- <th>Team</th>
- <th>Email</th>
- <th className="cu-table__col-role">Role</th>
- <th className="cu-table__col-date">Invited</th>
- <th className="cu-table__col-actions" aria-label="Actions" />
- </tr>
- </thead>
- <tbody>
- {busy && !loaded ? (
- <TableStateRow
- colSpan={5}
- kind="loading"
- message="Loading pending invitations…"
- />
- ) : error && filteredPendingInvitations.length === 0 ? (
- <TableStateRow colSpan={5} kind="error" message={error} />
- ) : filteredPendingInvitations.length === 0 ? (
- <TableStateRow
- colSpan={5}
- message={
- searchInput.trim()
- ? 'No pending invitations match this search.'
- : 'No pending invitations.'
- }
- />
- ) : (
- filteredPendingInvitations.map(invitation => (
- <tr key={invitation.id}>
- <td>
- {invitation.team_id ? (
- <button
- type="button"
- className="cu-link"
- onClick={() =>
- router.push(
- CONTROL_ROUTES.usersAndTeams.team(invitation.team_id)
- )
- }
- >
- {pendingInvitationTeamLabel(invitation)}
- </button>
- ) : (
- <span className="cu-muted">No team</span>
- )}
- </td>
- <td className="cu-table__cell-soft">{invitation.email}</td>
- <td>{formatTeamRole(invitation.role)}</td>
- <td className="cu-table__cell-muted">
- {new Date(invitation.created_at).toLocaleString()}
- </td>
- <td className="cu-table__cell-actions">
- <RowActionsMenu
- ariaLabel={`Actions for invitation to ${invitation.email}`}
- horizontalTrigger
- actions={[
- {
- key: 'resend',
- label:
- resendingInvitationId === invitation.id
- ? 'Sending…'
- : 'Resend',
- disabled:
- (busy && !loaded) || resendingInvitationId === invitation.id,
- onClick: () => void resendPendingInvitation(invitation),
- },
- {
- key: 'cancel',
- label:
- revokingInvitationId === invitation.id
- ? 'Cancelling…'
- : 'Cancel',
- danger: true,
- disabled:
- (busy && !loaded) || revokingInvitationId === invitation.id,
- onClick: () => {
- setDeleteDialogError('')
- setInvitationToCancel(invitation)
+ {showPendingInvitations ? (
+ <div className="cu-profile-section">
+ <p className="cu-profile-section__label">Pending invitations</p>
+ <div className="eft-table-viewport cu-table-wrap">
+ <DataTable className="eft-table cu-table cu-table--profile cu-table--header-band">
+ <thead>
+ <tr>
+ <th>Team</th>
+ <th>Email</th>
+ <th className="cu-table__col-role">Role</th>
+ <th className="cu-table__col-date">Invited</th>
+ <th className="cu-table__col-actions" aria-label="Actions" />
+ </tr>
+ </thead>
+ <tbody>
+ {busy && !loaded ? (
+ <TableStateRow
+ colSpan={5}
+ kind="loading"
+ message="Loading pending invitations…"
+ />
+ ) : error && filteredPendingInvitations.length === 0 ? (
+ <TableStateRow colSpan={5} kind="error" message={error} />
+ ) : filteredPendingInvitations.length === 0 ? (
+ <TableStateRow
+ colSpan={5}
+ message={
+ searchInput.trim()
+ ? 'No pending invitations match this search.'
+ : 'No pending invitations.'
+ }
+ />
+ ) : (
+ filteredPendingInvitations.map(invitation => (
+ <tr key={invitation.id}>
+ <td>
+ {invitation.team_id ? (
+ <button
+ type="button"
+ className="cu-link"
+ onClick={() =>
+ router.push(
+ CONTROL_ROUTES.usersAndTeams.team(invitation.team_id)
+ )
+ }
+ >
+ {pendingInvitationTeamLabel(invitation)}
+ </button>
+ ) : (
+ <span className="cu-muted">No team</span>
+ )}
+ </td>
+ <td className="cu-table__cell-soft">{invitation.email}</td>
+ <td>{formatTeamRole(invitation.role)}</td>
+ <td className="cu-table__cell-muted">
+ {new Date(invitation.created_at).toLocaleString()}
+ </td>
+ <td className="cu-table__cell-actions">
+ <RowActionsMenu
+ ariaLabel={`Actions for invitation to ${invitation.email}`}
+ horizontalTrigger
+ actions={[
+ {
+ key: 'resend',
+ label:
+ resendingInvitationId === invitation.id
+ ? 'Sending…'
+ : 'Resend',
+ disabled:
+ (busy && !loaded) ||
+ resendingInvitationId === invitation.id,
+ onClick: () => void resendPendingInvitation(invitation),
},
- },
- ]}
- />
- </td>
- </tr>
- ))
- )}
- </tbody>
- </DataTable>
+ {
+ key: 'cancel',
+ label:
+ revokingInvitationId === invitation.id
+ ? 'Cancelling…'
+ : 'Cancel',
+ danger: true,
+ disabled:
+ (busy && !loaded) || revokingInvitationId === invitation.id,
+ onClick: () => {
+ setDeleteDialogError('')
+ setInvitationToCancel(invitation)
+ },
+ },
+ ]}
+ />
+ </td>
+ </tr>
+ ))
+ )}
+ </tbody>
+ </DataTable>
+ </div>
</div>
- </div>
+ ) : null}
<div className="eft-table-viewport cu-table-wrap">
<DataTable className="eft-table cu-table cu-table--profile cu-table--header-band">
<thead>
diff --git a/control-ui/components/__tests__/ControlAdminsPanel.gfsOperatorLink.test.tsx b/control-ui/components/__tests__/ControlAdminsPanel.gfsOperatorLink.test.tsx
index fd73d4de2..2c6c083be 100644
--- a/control-ui/components/__tests__/ControlAdminsPanel.gfsOperatorLink.test.tsx
+++ b/control-ui/components/__tests__/ControlAdminsPanel.gfsOperatorLink.test.tsx
@@ -159,6 +159,14 @@ describe('ControlAdminsPanel GFS operator link lifecycle', () => {
expect(await screen.findByTestId('gfs-operator-link-admin-2')).toHaveTextContent('Not linked')
})
+ it('hides the pending invitations table when there are no pending admin invitations', async () => {
+ render(<ControlAdminsPanel />)
+
+ await screen.findByText('initial-admin')
+ expect(screen.queryByRole('columnheader', { name: 'Pending invitation' })).toBeNull()
+ expect(screen.queryByText('No pending invitations.')).toBeNull()
+ })
+
it('views the matching member from the admin row menu', async () => {
render(<ControlAdminsPanel />)
diff --git a/control-ui/components/__tests__/ProfileAdminHome.test.tsx b/control-ui/components/__tests__/ProfileAdminHome.test.tsx
index 6b262a600..8a718e222 100644
--- a/control-ui/components/__tests__/ProfileAdminHome.test.tsx
+++ b/control-ui/components/__tests__/ProfileAdminHome.test.tsx
@@ -125,6 +125,31 @@ describe('ProfileAdminHome — members invitations', () => {
expect(screen.getByRole('menuitem', { name: 'Resend' })).toBeInTheDocument()
})
+ it('hides the pending invitations section when there are no pending invitations', async () => {
+ vi.mocked(getProfileAdminOverview).mockResolvedValueOnce({
+ teams: [{ id: 'team-1', name: 'Marketing', memberCount: 1 }],
+ users: [
+ {
+ id: 'user-1',
+ email: '[email protected]',
+ name: 'Member Example',
+ picture: null,
+ displayName: 'Member Example',
+ activeTeamCount: 1,
+ },
+ ],
+ pendingInvitations: [],
+ teamAgentCounts: { 'team-1': 0 },
+ teamContextCounts: { 'team-1': 0 },
+ })
+
+ renderProfileAdminHome()
+
+ expect(await screen.findByText('Member Example')).toBeInTheDocument()
+ expect(screen.queryByText('Pending invitations')).toBeNull()
+ expect(screen.queryByText('No pending invitations.')).toBeNull()
+ })
+
it('keeps the new create member route as the add-member flow', async () => {
renderProfileAdminHome()
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 6a7c4bbee..08c982e46 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.520",
+ "version": "0.1.521",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.520",
+ "version": "0.1.521",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index d8da7e655..d57361d99 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.520",
+ "version": "0.1.521",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/profile-ui/app/members/page.tsx b/profile-ui/app/members/page.tsx
index 5cb9c02b8..9b7ec885e 100644
--- a/profile-ui/app/members/page.tsx
+++ b/profile-ui/app/members/page.tsx
@@ -53,6 +53,7 @@ export default function MembersPage() {
expires: (invitation: ManagedPendingInvitation) => new Date(invitation.expiresAt),
},
})
+ const showInvitationsTable = state === 'loading' || invitations.length > 0
const memberSort = useTableSort<ManagedMember, 'name' | 'email' | 'teams'>({
rows: members,
defaultKey: 'name' as const,
@@ -179,80 +180,80 @@ export default function MembersPage() {
</div>
) : null}
- <section className="section members-section">
- <div className="settings-section-head">
- <div>
- <h2 className="section-title">Pending invitations</h2>
+ {showInvitationsTable ? (
+ <section className="section members-section">
+ <div className="settings-section-head">
+ <div>
+ <h2 className="section-title">Pending invitations</h2>
+ </div>
</div>
- </div>
- <div className="eft-table-viewport">
- <DataTable className="eft-table eft-table--wide">
- <thead>
- <tr>
- <TableHeaderCell
- activeDirection={
- invitationSort.key === 'email' ? invitationSort.direction : null
- }
- label="Email"
- onSort={() => invitationSort.sortBy('email')}
- />
- <TableHeaderCell
- activeDirection={
- invitationSort.key === 'teams' ? invitationSort.direction : null
- }
- label="Teams"
- onSort={() => invitationSort.sortBy('teams')}
- />
- <TableHeaderCell
- activeDirection={
- invitationSort.key === 'expires' ? invitationSort.direction : null
- }
- label="Expires"
- onSort={() => invitationSort.sortBy('expires')}
- />
- <th></th>
- </tr>
- </thead>
- <tbody>
- {state === 'loading' ? (
- <TableStateRow colSpan={4} kind="loading" message="Loading invitations…" />
- ) : state === 'error' ? (
- <TableStateRow colSpan={4} kind="error" message="Invitations unavailable." />
- ) : invitationSort.sortedRows.length === 0 ? (
- <TableStateRow colSpan={4} message="No pending invitations." />
- ) : (
- invitationSort.sortedRows.map(invitation => (
- <tr key={invitation.id}>
- <td>{invitation.email}</td>
- <td>{invitation.teams.map(team => team.name).join(', ')}</td>
- <td>{new Date(invitation.expiresAt).toLocaleString()}</td>
- <td className="eft-table__cell--actions">
- <RowActionMenu
- ariaLabel={`Actions for invitation ${invitation.email}`}
- actions={[
- {
- key: 'resend',
- label: 'Resend invitation',
- disabled: busy || !invitation.canResend,
- onSelect: () => void resendInvitation(invitation),
- },
- {
- key: 'cancel',
- label: 'Cancel invitation',
- danger: true,
- disabled: busy || !invitation.canCancel,
- onSelect: () => void cancelInvitation(invitation),
- },
- ]}
- />
- </td>
- </tr>
- ))
- )}
- </tbody>
- </DataTable>
- </div>
- </section>
+ <div className="eft-table-viewport">
+ <DataTable className="eft-table eft-table--wide">
+ <thead>
+ <tr>
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'email' ? invitationSort.direction : null
+ }
+ label="Email"
+ onSort={() => invitationSort.sortBy('email')}
+ />
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'teams' ? invitationSort.direction : null
+ }
+ label="Teams"
+ onSort={() => invitationSort.sortBy('teams')}
+ />
+ <TableHeaderCell
+ activeDirection={
+ invitationSort.key === 'expires' ? invitationSort.direction : null
+ }
+ label="Expires"
+ onSort={() => invitationSort.sortBy('expires')}
+ />
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {state === 'loading' ? (
+ <TableStateRow colSpan={4} kind="loading" message="Loading invitations…" />
+ ) : state === 'error' ? (
+ <TableStateRow colSpan={4} kind="error" message="Invitations unavailable." />
+ ) : (
+ invitationSort.sortedRows.map(invitation => (
+ <tr key={invitation.id}>
+ <td>{invitation.email}</td>
+ <td>{invitation.teams.map(team => team.name).join(', ')}</td>
+ <td>{new Date(invitation.expiresAt).toLocaleString()}</td>
+ <td className="eft-table__cell--actions">
+ <RowActionMenu
+ ariaLabel={`Actions for invitation ${invitation.email}`}
+ actions={[
+ {
+ key: 'resend',
+ label: 'Resend invitation',
+ disabled: busy || !invitation.canResend,
+ onSelect: () => void resendInvitation(invitation),
+ },
+ {
+ key: 'cancel',
+ label: 'Cancel invitation',
+ danger: true,
+ disabled: busy || !invitation.canCancel,
+ onSelect: () => void cancelInvitation(invitation),
+ },
+ ]}
+ />
+ </td>
+ </tr>
+ ))
+ )}
+ </tbody>
+ </DataTable>
+ </div>
+ </section>
+ ) : null}
<section className="section members-section">
<div className="eft-table-viewport">
diff --git a/profile-ui/package-lock.json b/profile-ui/package-lock.json
index 68a3a5047..89e4b0028 100644
--- a/profile-ui/package-lock.json
+++ b/profile-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.132",
+ "version": "0.1.133",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-profile-ui",
- "version": "0.1.132",
+ "version": "0.1.133",
"dependencies": {
"@clerum/desktop-app-links": "file:../packages/desktop-app-links",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/profile-ui/package.json b/profile-ui/package.json
index 42fb2cadf..88f8477f1 100644
--- a/profile-ui/package.json
+++ b/profile-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-profile-ui",
- "version": "0.1.132",
+ "version": "0.1.133",
"private": true,
"scripts": {
"dev": "next dev",