From 40a62ac1e5c0f7aad89b67934085f5ce46e720d8 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Thu, 23 Sep 2021 16:16:38 +0200 Subject: [PATCH] web/admin: fix Transport Form not loading mode correctly on edit closes #1453 Signed-off-by: Jens Langhammer --- web/src/pages/events/TransportForm.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/web/src/pages/events/TransportForm.ts b/web/src/pages/events/TransportForm.ts index de238c1e3..d378a8b1d 100644 --- a/web/src/pages/events/TransportForm.ts +++ b/web/src/pages/events/TransportForm.ts @@ -20,9 +20,14 @@ import { first } from "../../utils"; @customElement("ak-event-transport-form") export class TransportForm extends ModelForm { loadInstance(pk: string): Promise { - return new EventsApi(DEFAULT_CONFIG).eventsTransportsRetrieve({ - uuid: pk, - }); + return new EventsApi(DEFAULT_CONFIG) + .eventsTransportsRetrieve({ + uuid: pk, + }) + .then((transport) => { + this.onModeChange(transport.mode); + return transport; + }); } @property({ type: Boolean }) @@ -72,12 +77,6 @@ export class TransportForm extends ModelForm { `; } - firstUpdated(): void { - if (this.instance) { - this.onModeChange(this.instance.mode); - } - } - onModeChange(mode: string): void { if ( mode === NotificationTransportModeEnum.Webhook || @@ -114,6 +113,7 @@ export class TransportForm extends ModelForm { ?hidden=${!this.showWebhook} label=${t`Webhook URL`} name="webhookUrl" + ?required=${true} >