import { t } from "@lingui/macro"; import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import "../../elements/Tabs"; import "../../elements/charts/ApplicationAuthorizeChart"; import "../../elements/buttons/SpinnerButton"; import "../../elements/EmptyState"; import "../../elements/events/ObjectChangelog"; import "../policies/BoundPoliciesList"; import "./ApplicationForm"; import "./ApplicationCheckAccessForm"; import "../../elements/PageHeader"; import { Application, CoreApi } from "authentik-api"; import { DEFAULT_CONFIG } from "../../api/Config"; import PFPage from "@patternfly/patternfly/components/Page/page.css"; import PFContent from "@patternfly/patternfly/components/Content/content.css"; import PFGallery from "@patternfly/patternfly/layouts/Gallery/gallery.css"; import PFCard from "@patternfly/patternfly/components/Card/card.css"; import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css"; import AKGlobal from "../../authentik.css"; import { ifDefined } from "lit-html/directives/if-defined"; @customElement("ak-application-view") export class ApplicationViewPage extends LitElement { @property() set applicationSlug(value: string) { new CoreApi(DEFAULT_CONFIG) .coreApplicationsRetrieve({ slug: value, }) .then((app) => { this.application = app; }); } @property({ attribute: false }) application!: Application; static get styles(): CSSResult[] { return [ PFBase, PFPage, PFContent, PFButton, PFDescriptionList, PFGallery, PFCard, AKGlobal, ]; } render(): TemplateResult { return html` ${this.renderApp()}`; } renderApp(): TemplateResult { if (!this.application) { return html` `; } return html` ${t`Related`} ${this.application.providerObj ? html` ${t`Provider`} ${this.application.providerObj?.name} ` : html``} ${t`Policy engine mode`} ${this.application.policyEngineMode?.toUpperCase()} ${t`Edit`} ${t`Update`} ${t`Update Application`} ${t`Edit`} ${t`Check access`} ${t`Check`} ${t`Check Application access`} ${t`Test`} ${this.application.launchUrl ? html` ${t`Launch`} ${t`Launch`} ` : html``} ${t`Logins over the last 24 hours`} ${this.application && html` `} ${t`Changelog`} ${t`These policies control which users can access this application.`} `; } }