import { gettext } from "django"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; import { until } from "lit-html/directives/until"; import { Provider } from "../../api/Providers"; import { SAMLProvider } from "../../api/providers/SAML"; import { COMMON_STYLES } from "../../common/styles"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import "../../elements/CodeMirror"; import "../../elements/Tabs"; import { Page } from "../../elements/Page"; @customElement("ak-provider-saml-view") export class SAMLProviderViewPage extends Page { pageTitle(): string { return gettext(`SAML Provider ${this.provider?.name}`); } pageDescription(): string | undefined { return; } pageIcon(): string { return "pf-icon pf-icon-integration"; } @property() set args(value: { [key: string]: number }) { this.providerID = value.id; } @property({type: Number}) set providerID(value: number) { SAMLProvider.get(value).then((app) => (this.provider = app)); } @property({ attribute: false }) provider?: SAMLProvider; static get styles(): CSSResult[] { return COMMON_STYLES; } constructor() { super(); this.addEventListener("ak-refresh", () => { if (!this.provider?.pk) return; this.providerID = this.provider?.pk; }); } renderContent(): TemplateResult { if (!this.provider) { return html``; } return html`
${gettext("Name")}
${this.provider.name}
${gettext("Assigned to application")}
${gettext("ACS URL")}
${this.provider.acs_url}
${gettext("Audience")}
${this.provider.audience}
${gettext("Issuer")}
${this.provider.issuer}
${until( SAMLProvider.getMetadata(this.provider.pk).then(m => { return html``; }) )}
`; } }