import { DEFAULT_CONFIG } from "@goauthentik/web/api/Config"; import "@goauthentik/web/elements/forms/ProxyForm"; import "@goauthentik/web/elements/wizard/FormWizardPage"; import "@goauthentik/web/elements/wizard/Wizard"; import { WizardPage } from "@goauthentik/web/elements/wizard/WizardPage"; import "@goauthentik/web/pages/providers/ldap/LDAPProviderForm"; import "@goauthentik/web/pages/providers/oauth2/OAuth2ProviderForm"; import "@goauthentik/web/pages/providers/proxy/ProxyProviderForm"; import "@goauthentik/web/pages/providers/saml/SAMLProviderForm"; import "@goauthentik/web/pages/providers/saml/SAMLProviderImportForm"; import { t } from "@lingui/macro"; import { customElement } from "@lit/reactive-element/decorators/custom-element.js"; import { CSSResult, LitElement, TemplateResult, html } from "lit"; import { property } from "lit/decorators.js"; import AKGlobal from "@goauthentik/web/authentik.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFForm from "@patternfly/patternfly/components/Form/form.css"; import PFRadio from "@patternfly/patternfly/components/Radio/radio.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; import { ProvidersApi, TypeCreate } from "@goauthentik/api"; @customElement("ak-provider-wizard-initial") export class InitialProviderWizardPage extends WizardPage { @property({ attribute: false }) providerTypes: TypeCreate[] = []; static get styles(): CSSResult[] { return [PFBase, PFForm, PFButton, AKGlobal, PFRadio]; } render(): TemplateResult { return html`
${this.providerTypes.map((type) => { return html`
{ this.host.setSteps("initial", `type-${type.component}`); this._isValid = true; }} /> ${type.description}
`; })}
`; } } @customElement("ak-provider-wizard") export class ProviderWizard extends LitElement { static get styles(): CSSResult[] { return [PFBase, PFButton, AKGlobal, PFRadio]; } @property() createText = t`Create`; @property({ attribute: false }) providerTypes: TypeCreate[] = []; @property({ attribute: false }) finalHandler: () => Promise = () => { return Promise.resolve(); }; firstUpdated(): void { new ProvidersApi(DEFAULT_CONFIG).providersAllTypesList().then((types) => { this.providerTypes = types; }); } render(): TemplateResult { return html` { return this.finalHandler(); }} > t`Select type`} .providerTypes=${this.providerTypes} > ${this.providerTypes.map((type) => { return html` t`Create ${type.name}`} > `; })} `; } }