2020-11-27 17:37:56 +00:00
|
|
|
import { css, customElement, html, LitElement, property, TemplateResult } from "lit-element";
|
2020-11-26 14:55:01 +00:00
|
|
|
import { Application } from "../../api/application";
|
2020-11-27 17:37:56 +00:00
|
|
|
import { DefaultClient } from "../../api/client";
|
2020-11-26 14:55:01 +00:00
|
|
|
import { COMMON_STYLES } from "../../common/styles";
|
2020-11-27 17:37:56 +00:00
|
|
|
import { Table } from "../../elements/Table";
|
|
|
|
|
|
|
|
@customElement("pb-bound-policies-list")
|
|
|
|
export class BoundPoliciesList extends Table {
|
|
|
|
@property()
|
|
|
|
target?: string;
|
|
|
|
|
|
|
|
apiEndpoint(): string[] {
|
|
|
|
return ["policies", "bindings", `?target=${this.target}`];
|
|
|
|
}
|
|
|
|
|
|
|
|
columns(): string[] {
|
|
|
|
return ["Foo"];
|
|
|
|
}
|
|
|
|
|
|
|
|
row(item: any): TemplateResult[] {
|
|
|
|
return [html`${item}`];
|
|
|
|
}
|
|
|
|
}
|
2020-11-26 14:55:01 +00:00
|
|
|
|
|
|
|
@customElement("pb-application-view")
|
|
|
|
export class ApplicationViewPage extends LitElement {
|
|
|
|
@property()
|
2020-11-26 14:58:05 +00:00
|
|
|
set args(value: { [key: string]: string }) {
|
2020-11-26 14:55:01 +00:00
|
|
|
this.applicationSlug = value.slug;
|
|
|
|
}
|
|
|
|
|
|
|
|
@property()
|
|
|
|
set applicationSlug(value: string) {
|
2020-11-26 14:58:05 +00:00
|
|
|
Application.get(value).then((app) => (this.application = app));
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@property()
|
|
|
|
application?: Application;
|
|
|
|
|
|
|
|
static get styles() {
|
2020-11-26 22:31:56 +00:00
|
|
|
return COMMON_STYLES.concat(
|
|
|
|
css`
|
|
|
|
img.pf-icon {
|
|
|
|
max-height: 24px;
|
|
|
|
}
|
|
|
|
`
|
|
|
|
);
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2020-11-27 17:37:56 +00:00
|
|
|
if (!this.application) {
|
|
|
|
return html``;
|
|
|
|
}
|
2020-11-26 14:55:01 +00:00
|
|
|
return html`<section class="pf-c-page__main-section pf-m-light">
|
|
|
|
<div class="pf-c-content">
|
|
|
|
<h1>
|
2020-11-26 22:35:59 +00:00
|
|
|
<img class="pf-icon" src="${this.application?.meta_icon || ""}" />
|
2020-11-26 14:55:01 +00:00
|
|
|
${this.application?.name}
|
|
|
|
</h1>
|
2020-11-26 22:31:56 +00:00
|
|
|
<p>${this.application?.meta_publisher}</p>
|
2020-11-26 14:55:01 +00:00
|
|
|
</div>
|
|
|
|
</section>
|
2020-11-26 22:35:59 +00:00
|
|
|
<pb-tabs>
|
2020-11-27 17:37:56 +00:00
|
|
|
<section
|
|
|
|
slot="page-1"
|
|
|
|
tab-title="Users"
|
|
|
|
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
|
|
|
>
|
|
|
|
<div class="pf-l-gallery pf-m-gutter">
|
|
|
|
<div
|
|
|
|
class="pf-c-card pf-c-card-aggregate pf-l-gallery__item pf-m-4-col"
|
|
|
|
style="grid-column-end: span 3;grid-row-end: span 2;"
|
|
|
|
>
|
|
|
|
<div class="pf-c-card__header">
|
|
|
|
<div class="pf-c-card__header-main">
|
|
|
|
<i class="pf-icon pf-icon-server"></i> Logins over the last 24
|
|
|
|
hours
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="pf-c-card__body">
|
|
|
|
<pb-admin-logins-chart
|
|
|
|
url="${DefaultClient.makeUrl(
|
|
|
|
"core",
|
|
|
|
"applications",
|
|
|
|
this.application?.slug!,
|
|
|
|
"metrics"
|
|
|
|
)}"
|
|
|
|
></pb-admin-logins-chart>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-26 14:55:01 +00:00
|
|
|
</div>
|
2020-11-26 22:35:59 +00:00
|
|
|
</section>
|
2020-11-27 17:37:56 +00:00
|
|
|
<div
|
|
|
|
slot="page-2"
|
|
|
|
tab-title="Policy Bindings"
|
|
|
|
class="pf-c-page__main-section pf-m-no-padding-mobile"
|
|
|
|
>
|
|
|
|
<div class="pf-l-gallery pf-m-gutter">
|
|
|
|
<div
|
|
|
|
class="pf-c-card pf-c-card-aggregate pf-l-gallery__item pf-m-4-col"
|
|
|
|
style="grid-column-end: span 3;grid-row-end: span 2;"
|
|
|
|
>
|
|
|
|
<pb-bound-policies-list
|
|
|
|
.target=${this.application.pk}
|
|
|
|
></pb-bound-policies-list>
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-26 14:55:01 +00:00
|
|
|
</div>
|
2020-11-26 22:35:59 +00:00
|
|
|
</pb-tabs>`;
|
2020-11-26 14:55:01 +00:00
|
|
|
}
|
|
|
|
}
|