import { gettext } from "django"; import { customElement, html, property, TemplateResult } from "lit-element"; import { AKResponse } 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 { Rule } from "../../api/EventRules"; @customElement("ak-event-rule-list") export class RuleListPage extends TablePage { expandable = true; searchEnabled(): boolean { return true; } pageTitle(): string { return gettext("Notification Rules"); } pageDescription(): string { return gettext("Send notifications 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 Rule.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: Rule): TemplateResult[] { return [ html`${item.name}`, html`${item.severity}`, html`${item.group?.name || gettext("None (rule disabled)")}`, html` ${gettext("Edit")}
${gettext("Delete")}
`, ]; } renderToolbar(): TemplateResult { return html` ${gettext("Create")}
${super.renderToolbar()} `; } renderExpanded(item: Rule): TemplateResult { return html`
`; } }