()
| 175 | const missingOAuthScopes = connection.missingOAuthScopes ?? []; |
| 176 | |
| 177 | const handleCheck = async () => { |
| 178 | if (checking) return; |
| 179 | setChecking(true); |
| 180 | const exit = await runCheck(); |
| 181 | setChecking(false); |
| 182 | if (Exit.isFailure(exit)) { |
| 183 | toast.error(messageFromExit(exit, "Health check failed")); |
| 184 | return; |
| 185 | } |
| 186 | // The hook already folded the fresh probe into the live state. |
| 187 | if (exit.value.status === "healthy") { |
| 188 | toast.success( |
| 189 | exit.value.identity ? `Healthy: ${exit.value.identity}` : "Connection is healthy", |
| 190 | ); |
| 191 | } else if (exit.value.status === "expired") { |
| 192 | toast.error("Connection expired, reconnect to restore access"); |
| 193 | } else if (exit.value.status === "misconfigured") { |
| 194 | // NOT a reconnect prompt: the credential is fine; the upstream API is |
| 195 | // disabled where the OAuth client lives. The detail carries the |
| 196 | // provider's own instruction (with a console link for Google). |
| 197 | toast.warning( |
| 198 | exit.value.detail ?? "An upstream API is disabled for this connection's OAuth client", |
| 199 | ); |
| 200 | } else if (exit.value.status === "degraded") { |
| 201 | toast.warning(exit.value.detail ?? "Connection check returned an error"); |
| 202 | } else { |
| 203 | toast.message("No health check is configured for this integration"); |
| 204 | } |
| 205 | }; |
| 206 | |
| 207 | return ( |
| 208 | <CardStackEntry className="flex-wrap items-start"> |
no test coverage detected