2021-04-03 17:26:43 +00:00
|
|
|
import { t } from "@lingui/macro";
|
2021-04-11 17:38:24 +00:00
|
|
|
import { CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element";
|
2020-11-27 17:37:56 +00:00
|
|
|
|
2020-12-02 14:44:40 +00:00
|
|
|
import "../../elements/Tabs";
|
2021-03-08 10:14:00 +00:00
|
|
|
import "../../elements/charts/ApplicationAuthorizeChart";
|
2020-12-12 18:39:09 +00:00
|
|
|
import "../../elements/buttons/SpinnerButton";
|
2021-03-17 16:11:39 +00:00
|
|
|
import "../../elements/EmptyState";
|
2021-03-18 17:12:04 +00:00
|
|
|
import "../../elements/events/ObjectChangelog";
|
2021-04-03 12:32:19 +00:00
|
|
|
import "../policies/BoundPoliciesList";
|
2021-04-04 11:44:57 +00:00
|
|
|
import "./ApplicationForm";
|
2021-04-10 15:06:54 +00:00
|
|
|
import "../../elements/PageHeader";
|
2021-03-16 20:32:39 +00:00
|
|
|
import { Application, CoreApi } from "authentik-api";
|
2021-03-08 10:14:00 +00:00
|
|
|
import { DEFAULT_CONFIG } from "../../api/Config";
|
2021-03-17 16:11:39 +00:00
|
|
|
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";
|
2021-03-17 18:28:36 +00:00
|
|
|
import PFCard from "@patternfly/patternfly/components/Card/card.css";
|
|
|
|
import PFBase from "@patternfly/patternfly/patternfly-base.css";
|
2021-04-04 11:44:57 +00:00
|
|
|
import PFButton from "@patternfly/patternfly/components/Button/button.css";
|
2021-04-11 17:43:10 +00:00
|
|
|
import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css";
|
|
|
|
import AKGlobal from "../../authentik.css";
|
2021-04-10 15:06:54 +00:00
|
|
|
import { ifDefined } from "lit-html/directives/if-defined";
|
2021-03-17 16:11:39 +00:00
|
|
|
|
2020-12-05 21:08:42 +00:00
|
|
|
@customElement("ak-application-view")
|
2020-11-26 14:55:01 +00:00
|
|
|
export class ApplicationViewPage extends LitElement {
|
|
|
|
|
|
|
|
@property()
|
|
|
|
set applicationSlug(value: string) {
|
2021-05-16 12:43:42 +00:00
|
|
|
new CoreApi(DEFAULT_CONFIG).coreApplicationsRetrieve({
|
2021-03-08 10:14:00 +00:00
|
|
|
slug: value
|
|
|
|
}).then((app) => {
|
|
|
|
this.application = app;
|
|
|
|
});
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
|
2020-12-02 14:44:40 +00:00
|
|
|
@property({attribute: false})
|
2021-03-08 10:14:00 +00:00
|
|
|
application!: Application;
|
2020-11-26 14:55:01 +00:00
|
|
|
|
2020-12-01 16:27:19 +00:00
|
|
|
static get styles(): CSSResult[] {
|
2021-04-11 17:43:10 +00:00
|
|
|
return [PFBase, PFPage, PFContent, PFButton, PFDescriptionList, PFGallery, PFCard, AKGlobal];
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
|
2020-12-01 08:15:41 +00:00
|
|
|
render(): TemplateResult {
|
2021-04-10 15:06:54 +00:00
|
|
|
return html`<ak-page-header
|
|
|
|
icon=${this.application?.metaIcon || ""}
|
2021-04-18 16:57:56 +00:00
|
|
|
header=${this.application?.name || t`Loading`}
|
2021-04-10 15:06:54 +00:00
|
|
|
description=${ifDefined(this.application?.metaPublisher)}
|
|
|
|
.iconImage=${true}>
|
|
|
|
</ak-page-header>
|
|
|
|
${this.renderApp()}`;
|
|
|
|
}
|
|
|
|
|
|
|
|
renderApp(): TemplateResult {
|
2020-11-27 17:37:56 +00:00
|
|
|
if (!this.application) {
|
2021-04-10 15:06:54 +00:00
|
|
|
return html`<ak-empty-state
|
2021-03-17 16:11:39 +00:00
|
|
|
?loading="${true}"
|
2021-04-03 17:26:43 +00:00
|
|
|
header=${t`Loading`}>
|
2021-03-17 16:11:39 +00:00
|
|
|
</ak-empty-state>`;
|
2020-11-27 17:37:56 +00:00
|
|
|
}
|
2021-04-10 15:06:54 +00:00
|
|
|
return html`
|
2020-12-05 21:08:42 +00:00
|
|
|
<ak-tabs>
|
2021-04-11 16:40:01 +00:00
|
|
|
<section slot="page-overview" data-tab-title="${t`Overview`}" class="pf-c-page__main-section pf-m-no-padding-mobile">
|
2020-11-27 17:37:56 +00:00
|
|
|
<div class="pf-l-gallery pf-m-gutter">
|
2021-03-23 15:06:08 +00:00
|
|
|
<div class="pf-c-card pf-l-gallery__item">
|
2021-04-03 17:26:43 +00:00
|
|
|
<div class="pf-c-card__title">${t`Related`}</div>
|
2021-02-16 19:34:15 +00:00
|
|
|
<div class="pf-c-card__body">
|
2021-03-01 16:23:00 +00:00
|
|
|
<dl class="pf-c-description-list">
|
2021-04-11 11:33:35 +00:00
|
|
|
${this.application.providerObj ?
|
2021-02-16 19:34:15 +00:00
|
|
|
html`<div class="pf-c-description-list__group">
|
|
|
|
<dt class="pf-c-description-list__term">
|
2021-04-03 17:26:43 +00:00
|
|
|
<span class="pf-c-description-list__text">${t`Provider`}</span>
|
2021-02-16 19:34:15 +00:00
|
|
|
</dt>
|
|
|
|
<dd class="pf-c-description-list__description">
|
|
|
|
<div class="pf-c-description-list__text">
|
2021-04-11 11:33:35 +00:00
|
|
|
<a href="#/core/providers/${this.application.providerObj?.pk}">
|
|
|
|
${this.application.providerObj?.name}
|
2021-02-16 19:34:15 +00:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</dd>
|
|
|
|
</div>`:
|
|
|
|
html``}
|
2021-04-11 17:43:10 +00:00
|
|
|
<div class="pf-c-description-list__group">
|
|
|
|
<dt class="pf-c-description-list__term">
|
|
|
|
<span class="pf-c-description-list__text">${t`Policy engine mode`}</span>
|
|
|
|
</dt>
|
|
|
|
<dd class="pf-c-description-list__description">
|
|
|
|
<div class="pf-c-description-list__text">
|
|
|
|
${this.application.policyEngineMode?.toUpperCase()}
|
|
|
|
</div>
|
|
|
|
</dd>
|
|
|
|
</div>
|
2021-04-04 11:44:57 +00:00
|
|
|
<div class="pf-c-description-list__group">
|
|
|
|
<dt class="pf-c-description-list__term">
|
|
|
|
<span class="pf-c-description-list__text">${t`Edit`}</span>
|
|
|
|
</dt>
|
|
|
|
<dd class="pf-c-description-list__description">
|
|
|
|
<div class="pf-c-description-list__text">
|
|
|
|
<ak-forms-modal>
|
|
|
|
<span slot="submit">
|
|
|
|
${t`Update`}
|
|
|
|
</span>
|
|
|
|
<span slot="header">
|
|
|
|
${t`Update Application`}
|
|
|
|
</span>
|
2021-05-11 10:12:31 +00:00
|
|
|
<ak-application-form slot="form" .instancePk=${this.application.slug}>
|
2021-04-04 11:44:57 +00:00
|
|
|
</ak-application-form>
|
|
|
|
<button slot="trigger" class="pf-c-button pf-m-secondary">
|
|
|
|
${t`Edit`}
|
|
|
|
</button>
|
|
|
|
</ak-forms-modal>
|
|
|
|
</div>
|
|
|
|
</dd>
|
|
|
|
</div>
|
2021-05-04 15:08:46 +00:00
|
|
|
${this.application.launchUrl ?
|
|
|
|
html`<div class="pf-c-description-list__group">
|
|
|
|
<dt class="pf-c-description-list__term">
|
|
|
|
<span class="pf-c-description-list__text">${t`Launch`}</span>
|
|
|
|
</dt>
|
|
|
|
<dd class="pf-c-description-list__description">
|
|
|
|
<div class="pf-c-description-list__text">
|
|
|
|
<a target="_blank" href=${this.application.launchUrl} slot="trigger" class="pf-c-button pf-m-secondary">
|
|
|
|
${t`Launch`}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</dd>
|
|
|
|
</div>`: html``}
|
2021-02-16 19:34:15 +00:00
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-04-11 17:43:10 +00:00
|
|
|
<div class="pf-c-card pf-l-gallery__item" style="grid-column-end: span 4;grid-row-end: span 2;">
|
|
|
|
<div class="pf-c-card__title">${t`Logins over the last 24 hours`}</div>
|
|
|
|
<div class="pf-c-card__body">
|
|
|
|
${this.application && html`
|
|
|
|
<ak-charts-application-authorize applicationSlug=${this.application.slug}>
|
|
|
|
</ak-charts-application-authorize>`}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pf-c-card pf-l-gallery__item" style="grid-column-end: span 5;grid-row-end: span 3;">
|
2021-04-03 17:26:43 +00:00
|
|
|
<div class="pf-c-card__title">${t`Changelog`}</div>
|
2021-03-18 17:12:04 +00:00
|
|
|
<div class="pf-c-card__body">
|
|
|
|
<ak-object-changelog
|
|
|
|
targetModelPk=${this.application.pk || ""}
|
|
|
|
targetModelApp="authentik_core"
|
|
|
|
targetModelName="application">
|
|
|
|
</ak-object-changelog>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-26 14:55:01 +00:00
|
|
|
</div>
|
2020-11-26 22:35:59 +00:00
|
|
|
</section>
|
2021-04-20 21:16:17 +00:00
|
|
|
<div slot="page-policy-bindings" data-tab-title="${t`Policy / Group / User Bindings`}" class="pf-c-page__main-section pf-m-no-padding-mobile">
|
2020-11-29 11:01:06 +00:00
|
|
|
<div class="pf-c-card">
|
2021-04-03 17:26:43 +00:00
|
|
|
<div class="pf-c-card__title">${t`These policies control which users can access this application.`}</div>
|
2020-12-12 18:39:09 +00:00
|
|
|
<ak-bound-policies-list .target=${this.application.pk}>
|
|
|
|
</ak-bound-policies-list>
|
2020-11-27 17:37:56 +00:00
|
|
|
</div>
|
2020-11-26 14:55:01 +00:00
|
|
|
</div>
|
2020-12-05 21:08:42 +00:00
|
|
|
</ak-tabs>`;
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
}
|