import { gettext } from "django"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } from "../../api/Client"; import { Table, TableColumn } from "../../elements/table/Table"; import { PolicyBinding } from "../../api/PolicyBindings"; 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(): TableColumn[] { return [ new TableColumn("Policy"), new TableColumn("Enabled", "enabled"), new TableColumn("Order", "order"), new TableColumn("Timeout", "timeout"), new TableColumn(""), ]; } row(item: PolicyBinding): TemplateResult[] { return [ html`${item.policy_obj.name}`, html`${item.enabled ? "Yes" : "No"}`, html`${item.order}`, html`${item.timeout}`, html` ${gettext("Edit")}
  ${gettext("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()} `; } }