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")
|
@customElement("ak-event-transport-form")
|
||||||
export class TransportForm extends ModelForm<NotificationTransport, string> {
|
export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||||
loadInstance(pk: string): Promise<NotificationTransport> {
|
loadInstance(pk: string): Promise<NotificationTransport> {
|
||||||
return new EventsApi(DEFAULT_CONFIG).eventsTransportsRetrieve({
|
return new EventsApi(DEFAULT_CONFIG)
|
||||||
uuid: pk,
|
.eventsTransportsRetrieve({
|
||||||
});
|
uuid: pk,
|
||||||
|
})
|
||||||
|
.then((transport) => {
|
||||||
|
this.onModeChange(transport.mode);
|
||||||
|
return transport;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@property({ type: Boolean })
|
@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 {
|
onModeChange(mode: string): void {
|
||||||
if (
|
if (
|
||||||
mode === NotificationTransportModeEnum.Webhook ||
|
mode === NotificationTransportModeEnum.Webhook ||
|
||||||
|
@ -114,6 +113,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
|
||||||
?hidden=${!this.showWebhook}
|
?hidden=${!this.showWebhook}
|
||||||
label=${t`Webhook URL`}
|
label=${t`Webhook URL`}
|
||||||
name="webhookUrl"
|
name="webhookUrl"
|
||||||
|
?required=${true}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
Reference in a new issue