import { LitElement, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { Source, SourcesApi } from "@goauthentik/api"; import { DEFAULT_CONFIG } from "../../api/Config"; import "../../elements/EmptyState"; import "../../elements/PageHeader"; import "../../elements/buttons/SpinnerButton"; import "./ldap/LDAPSourceViewPage"; import "./oauth/OAuthSourceViewPage"; import "./plex/PlexSourceViewPage"; import "./saml/SAMLSourceViewPage"; @customElement("ak-source-view") export class SourceViewPage extends LitElement { @property({ type: String }) set sourceSlug(slug: string) { new SourcesApi(DEFAULT_CONFIG) .sourcesAllRetrieve({ slug: slug, }) .then((source) => { this.source = source; }); } @property({ attribute: false }) source?: Source; renderSource(): TemplateResult { if (!this.source) { return html``; } switch (this.source?.component) { case "ak-source-ldap-form": return html``; case "ak-source-oauth-form": return html``; case "ak-source-saml-form": return html``; case "ak-source-plex-form": return html``; default: return html`

Invalid source type ${this.source.component}

`; } } render(): TemplateResult { return html` ${this.renderSource()}`; } }