import { gettext } from "django"; import { customElement, html, property, TemplateResult } from "lit-element"; import { PBResponse } from "../../api/client"; import { PolicyBinding } from "../../api/policy"; import { Table } from "../../elements/table/Table"; import "../../elements/Tabs"; import "../../elements/AdminLoginsChart"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; @customElement("ak-bound-policies-list") export class BoundPoliciesList extends Table { @property() target?: string; apiEndpoint(page: number): Promise> { return PolicyBinding.list({ target: this.target || "", ordering: "order", page: page, }); } columns(): string[] { return ["Policy", "Enabled", "Order", "Timeout", ""]; } row(item: PolicyBinding): TemplateResult[] { return [ html`${item.policy_obj.name}`, html`${item.enabled ? "Yes" : "No"}`, html`${item.order}`, html`${item.timeout}`, html` Edit
Delete
`, ]; } renderEmpty(): TemplateResult { return super.renderEmpty(html`
${gettext("No policies are currently bound to this object.")}
${gettext("Bind Policy")}
`); } renderToolbar(): TemplateResult { return html` ${gettext("Bind Policy")}
${super.renderToolbar()} `; } }