MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / AccountRow

Function AccountRow

packages/react/src/components/accounts-section.tsx:123–325  ·  view source on GitHub ↗
(props: {
  readonly connection: Connection;
  /** The integration declares scopes this connection was not granted — it must
   *  reconnect to grant the newly-needed access (e.g. after a service was added). */
  readonly needsReconsent: boolean;
  readonly showOwnerLabel: boolean;
  readonly canManage: boolean;
  readonly canReconnect: boolean;
  readonly onEdit: () => void;
  readonly onReconnect: () => void;
  /** Reconnect routing needs the stored client binding; while the client
   *  summaries carry no data the route is unknown, so the action is
   *  disabled rather than guessed (same idiom as "Check now" above). */
  readonly reconnectDisabled: boolean;
  /** The summaries query failed: the Reconnect item stays disabled but says
   *  so (never a silently dead action). Retained stale data never routes — a
   *  binding changed since the snapshot could misroute. Opening the menu
   *  retries the query via `onMenuOpenChange`, so the hint reflects a retry
   *  that just failed, not a permanently stuck state. */
  readonly reconnectFailed: boolean;
  /** Forwarded to the row menu; the owner uses the OPEN transition to retry
   *  a failed client-summaries query. */
  readonly onMenuOpenChange: (open: boolean) => void;
  readonly onRemove: () => void;
})

Source from the content-addressed store, hash-verified

121};
122
123function AccountRow(props: {
124 readonly connection: Connection;
125 /** The integration declares scopes this connection was not granted — it must
126 * reconnect to grant the newly-needed access (e.g. after a service was added). */
127 readonly needsReconsent: boolean;
128 readonly showOwnerLabel: boolean;
129 readonly canManage: boolean;
130 readonly canReconnect: boolean;
131 readonly onEdit: () => void;
132 readonly onReconnect: () => void;
133 /** Reconnect routing needs the stored client binding; while the client
134 * summaries carry no data the route is unknown, so the action is
135 * disabled rather than guessed (same idiom as "Check now" above). */
136 readonly reconnectDisabled: boolean;
137 /** The summaries query failed: the Reconnect item stays disabled but says
138 * so (never a silently dead action). Retained stale data never routes — a
139 * binding changed since the snapshot could misroute. Opening the menu
140 * retries the query via `onMenuOpenChange`, so the hint reflects a retry
141 * that just failed, not a permanently stuck state. */
142 readonly reconnectFailed: boolean;
143 /** Forwarded to the row menu; the owner uses the OPEN transition to retry
144 * a failed client-summaries query. */
145 readonly onMenuOpenChange: (open: boolean) => void;
146 readonly onRemove: () => void;
147}) {
148 const { connection, needsReconsent } = props;
149 const [checking, setChecking] = useState(false);
150
151 // The status renders WITHOUT any clicking: every checkHealth run persists its
152 // verdict on the connection row, so the list answers "has this expired?" at a
153 // glance. A live check from this session takes precedence. We deliberately do
154 // NOT derive expiry from the stored `expiresAt`: that's the access-token
155 // lifetime, which refreshes, so a passive countdown means nothing.
156 //
157 // Health checks are AUTOMATIC: the hook revalidates on mount, stale-while-
158 // revalidate style (shared with the integrations-list summary), and the
159 // persisted verdict renders instantly while the probe corrects it in place.
160 const { probe, status, runCheck } = useConnectionHealth(connection);
161 const indicator = HEALTH_INDICATOR_COLOR[status];
162
163 // Prefer the stored label from the connection row, then a probed identity,
164 // then the connection name. OAuth labels come from the grant's OIDC claims,
165 // while health identities remain useful for non-OAuth probes.
166 const identity =
167 (connection.identityLabel && connection.identityLabel.length > 0
168 ? connection.identityLabel
169 : null) ?? (probe?.identity && probe.identity.length > 0 ? probe.identity : null);
170 const displayLabel = identity ?? String(connection.name);
171
172 const expired = status === "expired";
173 // `misconfigured` is deliberately NOT folded into `needsHealthAttention`: it
174 // gets its own amber "API disabled" badge and its own link-rendered detail
175 // below, because the remediation is a console visit, not a reconnect.
176 const misconfigured = status === "misconfigured";
177 const needsHealthAttention = status === "expired" || status === "degraded";
178 const healthDetail = needsHealthAttention ? probe?.detail : undefined;
179 const missingOAuthScopes = connection.missingOAuthScopes ?? [];
180

Callers

nothing calls this directly

Calls 3

useConnectionHealthFunction · 0.90
ownerLabelFunction · 0.90
handleCheckFunction · 0.70

Tested by

no test coverage detected