mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-24 15:25:23 +02:00
[autofix.ci] apply automated fixes
This commit is contained in:
@@ -93,7 +93,10 @@ function parseOidcConfig(oidcConfig: string | null): {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RegisterOidcDialog({ providerId, children }: RegisterOidcDialogProps) {
|
export function RegisterOidcDialog({
|
||||||
|
providerId,
|
||||||
|
children,
|
||||||
|
}: RegisterOidcDialogProps) {
|
||||||
const utils = api.useUtils();
|
const utils = api.useUtils();
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
|
|
||||||
@@ -105,8 +108,12 @@ export function RegisterOidcDialog({ providerId, children }: RegisterOidcDialogP
|
|||||||
const updateMutation = api.sso.update.useMutation();
|
const updateMutation = api.sso.update.useMutation();
|
||||||
|
|
||||||
const isEdit = !!providerId;
|
const isEdit = !!providerId;
|
||||||
const mutateAsync = isEdit ? updateMutation.mutateAsync : registerMutation.mutateAsync;
|
const mutateAsync = isEdit
|
||||||
const isLoading = isEdit ? updateMutation.isLoading : registerMutation.isLoading;
|
? updateMutation.mutateAsync
|
||||||
|
: registerMutation.mutateAsync;
|
||||||
|
const isLoading = isEdit
|
||||||
|
? updateMutation.isLoading
|
||||||
|
: registerMutation.isLoading;
|
||||||
|
|
||||||
const form = useForm<OidcProviderForm>({
|
const form = useForm<OidcProviderForm>({
|
||||||
resolver: zodResolver(oidcProviderSchema),
|
resolver: zodResolver(oidcProviderSchema),
|
||||||
@@ -116,7 +123,10 @@ export function RegisterOidcDialog({ providerId, children }: RegisterOidcDialogP
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data || !open) return;
|
if (!data || !open) return;
|
||||||
const domains = data.domain
|
const domains = data.domain
|
||||||
? data.domain.split(",").map((d) => d.trim()).filter(Boolean)
|
? data.domain
|
||||||
|
.split(",")
|
||||||
|
.map((d) => d.trim())
|
||||||
|
.filter(Boolean)
|
||||||
: [""];
|
: [""];
|
||||||
if (domains.length === 0) domains.push("");
|
if (domains.length === 0) domains.push("");
|
||||||
const oidc = parseOidcConfig(data.oidcConfig);
|
const oidc = parseOidcConfig(data.oidcConfig);
|
||||||
@@ -127,7 +137,9 @@ export function RegisterOidcDialog({ providerId, children }: RegisterOidcDialogP
|
|||||||
clientId: oidc?.clientId ?? "",
|
clientId: oidc?.clientId ?? "",
|
||||||
clientSecret: oidc?.clientSecret ?? "",
|
clientSecret: oidc?.clientSecret ?? "",
|
||||||
scopes:
|
scopes:
|
||||||
oidc?.scopes && oidc.scopes.length > 0 ? oidc.scopes : [...DEFAULT_SCOPES],
|
oidc?.scopes && oidc.scopes.length > 0
|
||||||
|
? oidc.scopes
|
||||||
|
: [...DEFAULT_SCOPES],
|
||||||
});
|
});
|
||||||
}, [data, open, form]);
|
}, [data, open, form]);
|
||||||
|
|
||||||
|
|||||||
@@ -108,8 +108,12 @@ export function RegisterSamlDialog({
|
|||||||
const updateMutation = api.sso.update.useMutation();
|
const updateMutation = api.sso.update.useMutation();
|
||||||
|
|
||||||
const isEdit = !!providerId;
|
const isEdit = !!providerId;
|
||||||
const mutateAsync = isEdit ? updateMutation.mutateAsync : registerMutation.mutateAsync;
|
const mutateAsync = isEdit
|
||||||
const isLoading = isEdit ? updateMutation.isLoading : registerMutation.isLoading;
|
? updateMutation.mutateAsync
|
||||||
|
: registerMutation.mutateAsync;
|
||||||
|
const isLoading = isEdit
|
||||||
|
? updateMutation.isLoading
|
||||||
|
: registerMutation.isLoading;
|
||||||
|
|
||||||
const [baseURL, setBaseURL] = useState("");
|
const [baseURL, setBaseURL] = useState("");
|
||||||
|
|
||||||
@@ -127,7 +131,10 @@ export function RegisterSamlDialog({
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!data || !open) return;
|
if (!data || !open) return;
|
||||||
const domains = data.domain
|
const domains = data.domain
|
||||||
? data.domain.split(",").map((d) => d.trim()).filter(Boolean)
|
? data.domain
|
||||||
|
.split(",")
|
||||||
|
.map((d) => d.trim())
|
||||||
|
.filter(Boolean)
|
||||||
: [""];
|
: [""];
|
||||||
if (domains.length === 0) domains.push("");
|
if (domains.length === 0) domains.push("");
|
||||||
const saml = parseSamlConfig(data.samlConfig);
|
const saml = parseSamlConfig(data.samlConfig);
|
||||||
|
|||||||
@@ -272,9 +272,7 @@ export const SSOSettings = () => {
|
|||||||
View details
|
View details
|
||||||
</Button>
|
</Button>
|
||||||
{isOidc && (
|
{isOidc && (
|
||||||
<RegisterOidcDialog
|
<RegisterOidcDialog providerId={provider.providerId}>
|
||||||
providerId={provider.providerId}
|
|
||||||
>
|
|
||||||
<Button variant="ghost" size="sm">
|
<Button variant="ghost" size="sm">
|
||||||
<Pencil className="mr-1 size-3" />
|
<Pencil className="mr-1 size-3" />
|
||||||
Edit
|
Edit
|
||||||
@@ -282,9 +280,7 @@ export const SSOSettings = () => {
|
|||||||
</RegisterOidcDialog>
|
</RegisterOidcDialog>
|
||||||
)}
|
)}
|
||||||
{isSaml && (
|
{isSaml && (
|
||||||
<RegisterSamlDialog
|
<RegisterSamlDialog providerId={provider.providerId}>
|
||||||
providerId={provider.providerId}
|
|
||||||
>
|
|
||||||
<Button variant="ghost" size="sm">
|
<Button variant="ghost" size="sm">
|
||||||
<Pencil className="mr-1 size-3" />
|
<Pencil className="mr-1 size-3" />
|
||||||
Edit
|
Edit
|
||||||
|
|||||||
Reference in New Issue
Block a user