()
| 153 | const missingOAuthScopes = connection.missingOAuthScopes ?? []; |
| 154 | |
| 155 | const handleCheck = async () => { |
| 156 | if (checking) return; |
| 157 | setChecking(true); |
| 158 | const exit = await runCheck(); |
| 159 | setChecking(false); |
| 160 | if (Exit.isFailure(exit)) { |
| 161 | toast.error(messageFromExit(exit, "Health check failed")); |
| 162 | return; |
| 163 | } |
| 164 | // The hook already folded the fresh probe into the live state. |
| 165 | if (exit.value.status === "healthy") { |
| 166 | toast.success( |
| 167 | exit.value.identity ? `Healthy: ${exit.value.identity}` : "Connection is healthy", |
| 168 | ); |
| 169 | } else if (exit.value.status === "expired") { |
| 170 | toast.error("Connection expired, reconnect to restore access"); |
| 171 | } else if (exit.value.status === "misconfigured") { |
| 172 | // NOT a reconnect prompt: the credential is fine; the upstream API is |
| 173 | // disabled where the OAuth client lives. The detail carries the |
| 174 | // provider's own instruction (with a console link for Google). |
| 175 | toast.warning( |
| 176 | exit.value.detail ?? "An upstream API is disabled for this connection's OAuth client", |
| 177 | ); |
| 178 | } else if (exit.value.status === "degraded") { |
| 179 | toast.warning(exit.value.detail ?? "Connection check returned an error"); |
| 180 | } else { |
| 181 | toast.message("No health check is configured for this integration"); |
| 182 | } |
| 183 | }; |
| 184 | |
| 185 | return ( |
| 186 | <CardStackEntry className="flex-wrap items-start"> |
no test coverage detected