import { useAtomValue } from "@effect/atom-react"; import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; import { useScope } from "@executor-js/react/api/scope-context"; import { Badge } from "@executor-js/react/components/badge"; import { Button } from "@executor-js/react/components/button"; import { googleDiscoverySourceAtom } from "./atoms"; import GoogleDiscoverySignInButton from "./GoogleDiscoverySignInButton"; export default function EditGoogleDiscoverySource({ sourceId, onSave, }: { readonly sourceId: string; readonly onSave: () => void; }) { const scopeId = useScope(); const sourceResult = useAtomValue(googleDiscoverySourceAtom(scopeId, sourceId)); const source = AsyncResult.isSuccess(sourceResult) ? sourceResult.value : null; const config = source?.config; const authKind = config?.auth.kind ?? "none"; return (
View configuration for this Google API source. To change authentication, remove and re-add the source with updated OAuth credentials.
{source?.name ?? sourceId}
{config?.discoveryUrl && ({config.discoveryUrl}
)}Service
{config.service}
Version
{config.version}
Authentication
{authKind === "oauth2" ? "OAuth 2.0" : authKind}
{authKind === "oauth2" &&