import { CoreApi, EventsApi, NotificationRule, SeverityEnum } from "authentik-api"; import { t } from "@lingui/macro"; import { customElement } from "lit-element"; import { html, TemplateResult } from "lit-html"; import { DEFAULT_CONFIG } from "../../api/Config"; import { ifDefined } from "lit-html/directives/if-defined"; import "../../elements/forms/HorizontalFormElement"; import { until } from "lit-html/directives/until"; import { ModelForm } from "../../elements/forms/ModelForm"; @customElement("ak-event-rule-form") export class RuleForm extends ModelForm { loadInstance(pk: string): Promise { return new EventsApi(DEFAULT_CONFIG).eventsRulesRetrieve({ pbmUuid: pk, }); } getSuccessMessage(): string { if (this.instance) { return t`Successfully updated rule.`; } else { return t`Successfully created rule.`; } } send = (data: NotificationRule): Promise => { if (this.instance) { return new EventsApi(DEFAULT_CONFIG).eventsRulesUpdate({ pbmUuid: this.instance.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.`}

`; } }