import "@goauthentik/admin/sources/ldap/LDAPSourceForm"; import "@goauthentik/admin/sources/oauth/OAuthSourceForm"; import "@goauthentik/admin/sources/plex/PlexSourceForm"; import "@goauthentik/admin/sources/saml/SAMLSourceForm"; import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { AKElement } from "@goauthentik/elements/Base"; import "@goauthentik/elements/forms/ProxyForm"; import "@goauthentik/elements/wizard/FormWizardPage"; import "@goauthentik/elements/wizard/Wizard"; import { WizardPage } from "@goauthentik/elements/wizard/WizardPage"; import { t } from "@lingui/macro"; import { customElement } from "@lit/reactive-element/decorators/custom-element.js"; import { CSSResult, TemplateResult, html } from "lit"; import { property } from "lit/decorators.js"; 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 { SourcesApi, TypeCreate } from "@goauthentik/api"; @customElement("ak-source-wizard-initial") export class InitialSourceWizardPage extends WizardPage { @property({ attribute: false }) sourceTypes: TypeCreate[] = []; static get styles(): CSSResult[] { return [PFBase, PFForm, PFButton, PFRadio]; } sidebarLabel = () => t`Select type`; activeCallback: () => Promise = async () => { this.host.isValid = false; this.shadowRoot ?.querySelectorAll("input[type=radio]") .forEach((radio) => { if (radio.checked) { radio.dispatchEvent(new CustomEvent("change")); } }); }; render(): TemplateResult { return html`
${this.sourceTypes.map((type) => { return html`
{ this.host.steps = [ "initial", `type-${type.component}-${type.modelName}`, ]; this.host.isValid = true; }} /> ${type.description}
`; })}
`; } } @customElement("ak-source-wizard") export class SourceWizard extends AKElement { static get styles(): CSSResult[] { return [PFBase, PFButton, PFRadio]; } @property({ attribute: false }) sourceTypes: TypeCreate[] = []; firstUpdated(): void { new SourcesApi(DEFAULT_CONFIG).sourcesAllTypesList().then((types) => { this.sourceTypes = types; }); } render(): TemplateResult { return html` ${this.sourceTypes.map((type) => { return html` t`Create ${type.name}`} > `; })} `; } }