import { gettext } from "django"; import { CSSResult, customElement, html, property, TemplateResult } from "lit-element"; 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"; import { OAuthSource } from "../../api/sources/OAuth"; import { Source } from "../../api/Sources"; @customElement("ak-source-oauth-view") export class OAuthSourceViewPage extends Page { pageTitle(): string { return gettext(`OAuth Source ${this.source?.name || ""}`); } pageDescription(): string | undefined { return; } pageIcon(): string { return "pf-icon pf-icon-middleware"; } @property({ type: String }) set sourceSlug(value: string) { OAuthSource.get(value).then((s) => this.source = s); } @property({ attribute: false }) source?: OAuthSource; static get styles(): CSSResult[] { return COMMON_STYLES; } constructor() { super(); this.addEventListener("ak-refresh", () => { if (!this.source?.pk) return; this.sourceSlug = this.source?.slug; }); } renderContent(): TemplateResult { if (!this.source) { return html``; } return html`
${gettext("Name")}
${this.source.name}
${gettext("Provider Type")}
${this.source.provider_type}
${gettext("Callback URL")}
${this.source.callback_url}
${gettext("Access Key")}
${this.source.consumer_key}
${gettext("Authorization URL")}
${this.source.authorization_url}
${gettext("Token URL")}
${this.source.access_token_url}
`; } }