Skip to content

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

TypeScript

fix(control-ui): drop redundant bundle fetch and add approvals skeleton

Miguelon Peluchone747e6360f7a
diff --git a/control-ui/components/HostAccessTab/index.tsx b/control-ui/components/HostAccessTab/index.tsx
index 0cedb3a38..710a76626 100644
--- a/control-ui/components/HostAccessTab/index.tsx
+++ b/control-ui/components/HostAccessTab/index.tsx
@@ -10,10 +10,11 @@ import { IconX } from '@components/icons'
import { CONTROL_ROUTES } from '@constants/routes'
import {
getAdminTeamAgents,
+ getAdminTeams,
getAdminUserAgents,
+ getAdminUsers,
getAgentTeams,
getAgentUsers,
- getHostDetailBundle,
updateAdminTeamAgents,
updateAdminUserAgents,
} from '@lib/api'
@@ -63,12 +64,20 @@ export function HostAccessTab({ hostName }: HostAccessTabProps) {
setInitialLoading(true)
setError('')
try {
- const detail = await getHostDetailBundle(hostName)
+ // Four lightweight endpoints instead of the full host detail bundle —
+ // page.tsx already loads the bundle on mount, so reusing it here would
+ // fetch the whole payload twice.
+ const [usersResult, teamsResult, agentUsersResult, agentTeamsResult] = await Promise.all([
+ getAdminUsers(),
+ getAdminTeams(),
+ getAgentUsers(hostName),
+ getAgentTeams(hostName),
+ ])
if (!mountedRef.current || requestId !== loadRequestId.current) return
- setAllUsers(Array.isArray(detail.users) ? detail.users : [])
- setAllTeams(Array.isArray(detail.teams) ? detail.teams : [])
- setUsersWithAccess(Array.isArray(detail.agentUsers) ? detail.agentUsers : [])
- setTeamsWithAccess(Array.isArray(detail.agentTeams) ? detail.agentTeams : [])
+ setAllUsers(Array.isArray(usersResult.items) ? usersResult.items : [])
+ setAllTeams(Array.isArray(teamsResult.items) ? teamsResult.items : [])
+ setUsersWithAccess(Array.isArray(agentUsersResult.items) ? agentUsersResult.items : [])
+ setTeamsWithAccess(Array.isArray(agentTeamsResult.items) ? agentTeamsResult.items : [])
} catch (e) {
if (!mountedRef.current || requestId !== loadRequestId.current) return
const message = e instanceof Error ? e.message : 'Failed to load access data'
diff --git a/control-ui/components/HostAdvancedTab/index.tsx b/control-ui/components/HostAdvancedTab/index.tsx
index 0d268359a..a70c79b2d 100644
--- a/control-ui/components/HostAdvancedTab/index.tsx
+++ b/control-ui/components/HostAdvancedTab/index.tsx
@@ -32,7 +32,36 @@ export function HostAdvancedTab({
<div className="cu-advanced-section">
{subTab === 'approvals' ? (
- initialLoading ? null : (
+ initialLoading ? (
+ <div
+ className="cu-table-wrap"
+ role="status"
+ aria-label="Loading approval tools"
+ >
+ <table className="cu-table cu-table--header-band cu-table--static-rows">
+ <thead>
+ <tr>
+ <th>Tool</th>
+ <th>Default</th>
+ <th className="cu-table__col-actions">Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ {[1, 2, 3, 4].map(i => (
+ <tr key={i}>
+ <td>
+ <div className="cu-skeleton cu-skeleton--cell" style={{ width: '8rem' }} />
+ </td>
+ <td>
+ <div className="cu-skeleton cu-skeleton--cell" style={{ width: '6rem' }} />
+ </td>
+ <td />
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ ) : (
<HostApprovalSection
busy={busy}
canWrite