import { gettext } from "django"; import { customElement, html, property, TemplateResult } from "lit-element"; import { PBResponse } from "../../api/Client"; import { TablePage } from "../../elements/table/TablePage"; import "../../elements/policies/BoundPoliciesList"; import "../../elements/buttons/ModalButton"; import "../../elements/buttons/SpinnerButton"; import { TableColumn } from "../../elements/table/Table"; import { Trigger } from "../../api/EventTriggers"; @customElement("ak-event-trigger-list") export class TriggerListPage extends TablePage { expandable = true; searchEnabled(): boolean { return true; } pageTitle(): string { return gettext("Notification Triggers"); } pageDescription(): string { return gettext("Send notifications on whenever a specific Event is created and matched by policies."); } pageIcon(): string { return gettext("pf-icon pf-icon-attention-bell"); } @property() order = "name"; apiEndpoint(page: number): Promise> { return Trigger.list({ ordering: this.order, page: page, search: this.search || "", }); } columns(): TableColumn[] { return [ new TableColumn("Name", "name"), new TableColumn("Severity", "severity"), new TableColumn("Sent to group", "group"), new TableColumn(""), ]; } row(item: Trigger): TemplateResult[] { return [ html`${item.name}`, html`${item.severity}`, html`${item.group || gettext("None (trigger disabled)")}`, html` ${gettext("Edit")}
  ${gettext("Delete")}
`, ]; } renderToolbar(): TemplateResult { return html` ${gettext("Create")}
${super.renderToolbar()} `; } renderExpanded(item: Trigger): TemplateResult { return html`
`; } }