
* web: Fix issues surrounding availability of controllers during init. web: Fix edgecase where flow does not have brand. * web: Fix import path. * web: Clean up mixin/controller paths. * web: Prepare for consistent import styling. - Prep for Storybook fixes. * web: Update MDX types. * web: Fix issues surrounding async imports, MDX typing, relative paths. * web: Format. Clarify. * web: Group module types.
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { WithBrandConfig } from "#elements/mixins/branding";
|
|
import "@goauthentik/admin/common/ak-crypto-certificate-search";
|
|
import "@goauthentik/admin/common/ak-flow-search/ak-branded-flow-search";
|
|
import { BaseProviderForm } from "@goauthentik/admin/providers/BaseProviderForm";
|
|
import { DEFAULT_CONFIG } from "@goauthentik/common/api/config";
|
|
|
|
import { customElement } from "lit/decorators.js";
|
|
|
|
import { LDAPProvider, ProvidersApi } from "@goauthentik/api";
|
|
|
|
import { renderForm } from "./LDAPProviderFormForm.js";
|
|
|
|
@customElement("ak-provider-ldap-form")
|
|
export class LDAPProviderFormPage extends WithBrandConfig(BaseProviderForm<LDAPProvider>) {
|
|
async loadInstance(pk: number): Promise<LDAPProvider> {
|
|
return new ProvidersApi(DEFAULT_CONFIG).providersLdapRetrieve({
|
|
id: pk,
|
|
});
|
|
}
|
|
|
|
async send(data: LDAPProvider): Promise<LDAPProvider> {
|
|
if (this.instance) {
|
|
return new ProvidersApi(DEFAULT_CONFIG).providersLdapUpdate({
|
|
id: this.instance.pk,
|
|
lDAPProviderRequest: data,
|
|
});
|
|
}
|
|
return new ProvidersApi(DEFAULT_CONFIG).providersLdapCreate({
|
|
lDAPProviderRequest: data,
|
|
});
|
|
}
|
|
|
|
renderForm() {
|
|
return renderForm(this.instance ?? {}, [], this.brand);
|
|
}
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
"ak-provider-ldap-form": LDAPProviderFormPage;
|
|
}
|
|
}
|