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

48 lines
1.6 KiB
TypeScript
Raw Normal View History

import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
2021-02-04 08:54:00 +00:00
import { Provider } from "../../api/Providers";
2021-02-06 16:55:41 +00:00
import { COMMON_STYLES } from "../../common/styles";
2021-02-04 08:54:00 +00:00
import "../../elements/buttons/ModalButton";
import "../../elements/buttons/SpinnerButton";
2021-02-16 21:52:54 +00:00
import "../../elements/utils/LoadingState";
2021-02-06 16:55:41 +00:00
import "./SAMLProviderViewPage";
2021-02-06 17:35:55 +00:00
import "./OAuth2ProviderViewPage";
2021-02-06 17:57:25 +00:00
import "./ProxyProviderViewPage";
2021-02-04 08:54:00 +00:00
@customElement("ak-provider-view")
export class ProviderViewPage extends LitElement {
2021-02-04 09:22:14 +00:00
@property({type: Number})
2021-02-04 08:54:00 +00:00
set providerID(value: number) {
Provider.get(value).then((app) => (this.provider = app));
}
@property({ attribute: false })
provider?: Provider;
2021-02-06 16:55:41 +00:00
static get styles(): CSSResult[] {
return COMMON_STYLES.concat(css`
* {
height: 100%;
}
`);
2021-02-06 16:55:41 +00:00
}
render(): TemplateResult {
if (!this.provider) {
2021-02-16 21:35:55 +00:00
return html`<ak-loading-state></ak-loading-state>`;
2021-02-06 16:55:41 +00:00
}
switch (this.provider?.object_type) {
case "saml":
return html`<ak-provider-saml-view providerID=${this.provider.pk}></ak-provider-saml-view>`;
2021-02-06 17:35:55 +00:00
case "oauth2":
return html`<ak-provider-oauth2-view providerID=${this.provider.pk}></ak-provider-oauth2-view>`;
2021-02-06 17:57:25 +00:00
case "proxy":
return html`<ak-provider-proxy-view providerID=${this.provider.pk}></ak-provider-proxy-view>`;
2021-02-06 16:55:41 +00:00
default:
return html`<p>Invalid provider type ${this.provider?.object_type}</p>`;
}
}
2021-02-04 08:54:00 +00:00
}