MCPcopy Create free account
hub / github.com/ShipSecAI/studio / ProviderConfigDialog

Function ProviderConfigDialog

frontend/src/pages/IntegrationsManager.tsx:596–865  ·  view source on GitHub ↗
({ provider, open, onClose, onCompleted }: ProviderConfigDialogProps)

Source from the content-addressed store, hash-verified

594}
595
596function ProviderConfigDialog({ provider, open, onClose, onCompleted }: ProviderConfigDialogProps) {
597 const [loading, setLoading] = useState(false);
598 const [saving, setSaving] = useState(false);
599 const [clientId, setClientId] = useState('');
600 const [clientSecret, setClientSecret] = useState('');
601 const [hasStoredSecret, setHasStoredSecret] = useState(false);
602 const [configuredBy, setConfiguredBy] = useState<'environment' | 'user'>('user');
603 const [updatedAt, setUpdatedAt] = useState<string | null>(null);
604 const [error, setError] = useState<string | null>(null);
605 const [copiedRedirect, setCopiedRedirect] = useState(false);
606
607 const callbackUrl = provider
608 ? `${window.location.origin}/integrations/callback/${provider.id}`
609 : '';
610
611 useEffect(() => {
612 if (!open) {
613 setClientSecret('');
614 setError(null);
615 setCopiedRedirect(false);
616 return;
617 }
618
619 if (!provider) {
620 return;
621 }
622
623 let cancelled = false;
624 setLoading(true);
625 setError(null);
626 setClientId('');
627 setClientSecret('');
628 setHasStoredSecret(false);
629 setConfiguredBy('user');
630 setUpdatedAt(null);
631
632 api.integrations
633 .getProviderConfig(provider.id)
634 .then((config) => {
635 if (cancelled) {
636 return;
637 }
638 setClientId(config.clientId ?? '');
639 setHasStoredSecret(config.hasClientSecret);
640 setConfiguredBy(config.configuredBy);
641 setUpdatedAt(config.updatedAt ?? null);
642 })
643 .catch((err) => {
644 if (cancelled) {
645 return;
646 }
647 const message =
648 err instanceof Error ? err.message : 'Failed to load provider configuration.';
649 setError(message);
650 })
651 .finally(() => {
652 if (!cancelled) {
653 setLoading(false);

Callers

nothing calls this directly

Calls 1

formatTimestampFunction · 0.70

Tested by

no test coverage detected