web/admin: fix Transport Form not loading mode correctly on edit
closes #1453 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
5df60e4d87
commit
40a62ac1e5
|
@ -20,9 +20,14 @@ import { first } from "../../utils";
|
|||
@customElement("ak-event-transport-form")
|
||||
export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||
loadInstance(pk: string): Promise<NotificationTransport> {
|
||||
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<NotificationTransport, string> {
|
|||
`;
|
||||
}
|
||||
|
||||
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<NotificationTransport, string> {
|
|||
?hidden=${!this.showWebhook}
|
||||
label=${t`Webhook URL`}
|
||||
name="webhookUrl"
|
||||
?required=${true}
|
||||
>
|
||||
<input
|
||||
type="text"
|
||||
|
|
Reference in a new issue