🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.
TypeScript analyticsautogenevaluationlangchainlarge-language-modelsllama-indexllmllm-evaluationllm-observabilityllmopsmonitoringobservabilityopen-sourceopenaiplaygroundprompt-engineeringprompt-managementself-hostedycombinator
import { useState } from "react";
import { ConfirmationDialogController } from "@/src/components/design-system/ConfirmationDialogController/ConfirmationDialogController";
import { showErrorToast } from "@/src/features/notifications/showErrorToast";
import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";
import { api } from "@/src/utils/api";
import { classifyTrpcToastError } from "@/src/utils/trpcErrorClassification";
export function DeleteSsoConfigDialogController({
orgId,
children,
}: {
orgId: string;
children: (control: {
openDialog: (domain: string) => void;
}) => React.ReactNode;
}) {
const [selectedDomain, setSelectedDomain] = useState<string | null>(null);
const utils = api.useUtils();
const deleteMutation = api.ssoConfig.delete.useMutation({
onSuccess: () => {
utils.ssoConfig.get.invalidate({ orgId });
showSuccessToast({
operation: "sso.disable",
title: "SSO disabled",
description: `SSO for @${selectedDomain} has been removed.`,
});
},
onError: (err) => {
showErrorToast(
"Failed to remove SSO",
err.message,
classifyTrpcToastError(err, "sso.disable"),
);
},
});
return (
<ConfirmationDialogController
title={`Remove SSO for @${selectedDomain ?? "this domain"}?`}
text="Users at this domain will be able to sign in with any enabled method again. Active sessions are not invalidated."
confirmLabel="Remove"
variant="destructive"
loading={deleteMutation.isPending}
onConfirm={async () => {
if (!selectedDomain) return;
await deleteMutation.mutateAsync({ orgId, domain: selectedDomain });
}}
>
{({ openDialog }) =>
children({
openDialog: (domain) => {
setSelectedDomain(domain);
openDialog();
},
})
}
</ConfirmationDialogController>
);
}