import { CoreApi, EventsApi, NotificationRule, NotificationRuleSeverityEnum } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement, property } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { Form } from "../../elements/forms/Form"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import { until } from "lit-html/directives/until"; @customElement("ak-event-rule-form") export class RuleForm extends Form { @property({attribute: false}) rule?: NotificationRule; getSuccessMessage(): string { if (this.rule) { return t`Successfully updated rule.`; } else { return t`Successfully created rule.`; } } send = (data: NotificationRule): Promise => { if (this.rule) { return new EventsApi(DEFAULT_CONFIG).eventsRulesUpdate({ pbmUuid: this.rule.pk || "", data: data }); } else { return new EventsApi(DEFAULT_CONFIG).eventsRulesCreate({ data: data }); } }; renderSeverity(): TemplateResult { return html` `; } renderForm(): TemplateResult { return html`

${t`Select which transports should be used to notify the user. If none are selected, the notification will only be shown in the authentik UI.`}

${t`Hold control/command to select multiple items.`}

`; } }