import { DEFAULT_CONFIG } from "@goauthentik/common/api/config"; import { docLink } from "@goauthentik/common/global"; import "@goauthentik/elements/CodeMirror"; import { CodeMirrorMode } from "@goauthentik/elements/CodeMirror"; import "@goauthentik/elements/forms/HorizontalFormElement"; import { ModelForm } from "@goauthentik/elements/forms/ModelForm"; import { msg } from "@lit/localize"; import { TemplateResult, html } from "lit"; import { customElement } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { NotificationWebhookMapping, PropertymappingsApi } from "@goauthentik/api"; @customElement("ak-property-mapping-notification-form") export class PropertyMappingNotification extends ModelForm { loadInstance(pk: string): Promise { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationRetrieve({ pmUuid: pk, }); } getSuccessMessage(): string { return this.instance ? msg("Successfully updated mapping.") : msg("Successfully created mapping."); } async send(data: NotificationWebhookMapping): Promise { if (this.instance) { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationUpdate({ pmUuid: this.instance.pk || "", notificationWebhookMappingRequest: data, }); } else { return new PropertymappingsApi(DEFAULT_CONFIG).propertymappingsNotificationCreate({ notificationWebhookMappingRequest: data, }); } } renderForm(): TemplateResult { return html`

${msg("Expression using Python.")} ${msg("See documentation for a list of all variables.")}

`; } }