import { gettext } from "django"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { Application } from "../../api/application"; import { DefaultClient, PBResponse } from "../../api/client"; import { PolicyBinding } from "../../api/policy_binding"; import { COMMON_STYLES } from "../../common/styles"; import { Table } from "../../elements/table/Table"; @customElement("pb-bound-policies-list") export class BoundPoliciesList extends Table { @property() target?: string; apiEndpoint(page: number): Promise> { return DefaultClient.fetch>(["policies", "bindings"], { target: this.target || "", ordering: "order", page: page, }); } columns(): string[] { return ["Policy", "Enabled", "Order", "Timeout", ""]; } row(item: PolicyBinding): string[] { return [ item.policy_obj.name, item.enabled ? "Yes" : "No", item.order.toString(), item.timeout.toString(), ` Edit
Delete
`, ]; } } @customElement("pb-application-view") export class ApplicationViewPage extends LitElement { @property() set args(value: { [key: string]: string }) { this.applicationSlug = value.slug; } @property() set applicationSlug(value: string) { Application.get(value).then((app) => (this.application = app)); } @property() application?: Application; static get styles(): CSSResult[] { return COMMON_STYLES.concat( css` img.pf-icon { max-height: 24px; } ` ); } render(): TemplateResult { if (!this.application) { return html``; } return html`

${this.application?.name}

${this.application?.meta_publisher}

`; } }