This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
authentik/web/src/pages/providers/ProviderViewPage.ts
Jens Langhammer d2bbf2965d web: fix source pages
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-03-17 19:03:53 +01:00

51 lines
1.7 KiB
TypeScript

import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
import "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton";
import "../../elements/EmptyState";
import "./SAMLProviderViewPage";
import "./OAuth2ProviderViewPage";
import "./ProxyProviderViewPage";
import { Provider, ProvidersApi } from "authentik-api";
import { DEFAULT_CONFIG } from "../../api/Config";
import { ifDefined } from "lit-html/directives/if-defined";
@customElement("ak-provider-view")
export class ProviderViewPage extends LitElement {
@property({type: Number})
set providerID(value: number) {
new ProvidersApi(DEFAULT_CONFIG).providersAllRead({
id: value,
}).then((prov) => (this.provider = prov));
}
@property({ attribute: false })
provider?: Provider;
static get styles(): CSSResult[] {
return [css`
* {
height: 100%;
}
`];
}
render(): TemplateResult {
if (!this.provider) {
return html`<ak-empty-state ?loading=${true} ?fullHeight=${true}></ak-empty-state>`;
}
switch (this.provider?.objectType) {
case "saml":
return html`<ak-provider-saml-view providerID=${ifDefined(this.provider.pk)}></ak-provider-saml-view>`;
case "oauth2":
return html`<ak-provider-oauth2-view providerID=${ifDefined(this.provider.pk)}></ak-provider-oauth2-view>`;
case "proxy":
return html`<ak-provider-proxy-view providerID=${ifDefined(this.provider.pk)}></ak-provider-proxy-view>`;
default:
return html`<p>Invalid provider type ${this.provider?.objectType}</p>`;
}
}
}