import { CoreApi, EventsApi, NotificationRule, NotificationRuleSeverityEnum } from "authentik-api"; import { gettext } from "django"; 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 gettext("Successfully updated rule."); } else { return gettext("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`

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

${gettext("Hold control/command to select multiple items.")}

`; } }