Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/plugins/graphql/src/react/GraphqlSourceSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
import { connectionsAtom } from "@executor-js/react/api/atoms";
import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context";
import {
SourceCredentialLoadingBadge,
SourceCredentialNotice,
SourceCredentialStatusBadge,
missingSourceCredentialLabels,
Expand Down Expand Up @@ -53,9 +54,7 @@ export default function GraphqlSourceSummary(props: {
const slots = sourceCredentialSlots(source as StoredGraphqlSource);
if (slots.length === 0) return null;
if (!AsyncResult.isSuccess(bindingsResult) || !AsyncResult.isSuccess(connectionsResult)) {
return props.variant === "panel" ? null : (
<SourceCredentialStatusBadge missing={["credentials"]} />
);
return props.variant === "panel" ? null : <SourceCredentialLoadingBadge />;
}

const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));
Expand Down
5 changes: 2 additions & 3 deletions packages/plugins/mcp/src/react/McpSourceSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as AsyncResult from "effect/unstable/reactivity/AsyncResult";
import { connectionsAtom } from "@executor-js/react/api/atoms";
import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context";
import {
SourceCredentialLoadingBadge,
SourceCredentialNotice,
SourceCredentialStatusBadge,
missingSourceCredentialLabels,
Expand Down Expand Up @@ -70,9 +71,7 @@ export default function McpSourceSummary(props: {
const slots = sourceCredentialSlots(source as McpStoredSourceSchemaType);
if (slots.length === 0) return null;
if (!AsyncResult.isSuccess(bindingsResult) || !AsyncResult.isSuccess(connectionsResult)) {
return props.variant === "panel" ? null : (
<SourceCredentialStatusBadge missing={["credentials"]} />
);
return props.variant === "panel" ? null : <SourceCredentialLoadingBadge />;
}

const scopeRanks = new Map(scopeStack.map((scope, index) => [scope.id, index] as const));
Expand Down
16 changes: 3 additions & 13 deletions packages/plugins/openapi/src/react/OpenApiSourceSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Badge } from "@executor-js/react/components/badge";
import { useScope, useScopeStack, useUserScope } from "@executor-js/react/api/scope-context";
import { ScopeId } from "@executor-js/sdk/core";
import {
SourceCredentialLoadingBadge,
SourceCredentialNotice,
SourceCredentialStatusBadge,
missingSourceCredentialLabels,
Expand All @@ -20,17 +21,6 @@ function OAuthBadge() {
return <Badge variant="secondary">OAuth</Badge>;
}

function CheckingCredentialsBadge() {
return (
<Badge
variant="outline"
className="border-border bg-muted/50 text-[10px] text-muted-foreground"
>
Checking credentials
</Badge>
);
}

const effectiveClientSecretSlot = (oauth2: {
readonly securitySchemeName: string;
readonly clientSecretSlot: string | null;
Expand Down Expand Up @@ -92,12 +82,12 @@ export default function OpenApiSourceSummary(props: {
const bindingsLoaded = AsyncResult.isSuccess(bindingsResult);
const connectionsLoaded = AsyncResult.isSuccess(connectionsResult);
if (!bindingsLoaded) {
return props.variant === "panel" ? null : <CheckingCredentialsBadge />;
return props.variant === "panel" ? null : <SourceCredentialLoadingBadge />;
}

const bindings = AsyncResult.isSuccess(bindingsResult) ? bindingsResult.value : [];
if (oauth2 && !connectionsLoaded) {
return props.variant === "panel" ? null : <CheckingCredentialsBadge />;
return props.variant === "panel" ? null : <SourceCredentialLoadingBadge />;
}
const connections = AsyncResult.isSuccess(connectionsResult) ? connectionsResult.value : [];
const liveConnectionIds = new Set(connections.map((connection) => connection.id));
Expand Down
11 changes: 11 additions & 0 deletions packages/react/src/plugins/source-credential-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ export {
type SourceCredentialSlot,
} from "./source-credential-status-core";

export function SourceCredentialLoadingBadge() {
return (
<Badge
variant="outline"
className="animate-pulse border-border bg-muted/40 text-[10px] text-muted-foreground"
>
loading
</Badge>
);
}

export function SourceCredentialStatusBadge(props: { readonly missing: readonly string[] }) {
if (props.missing.length === 0) {
return (
Expand Down
Loading