@@ -66,15 +66,15 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
66
66
}
67
67
68
68
renderForm ( ) : TemplateResult {
69
- return html ` < ak-form-element-horizontal label =${ msg ( "Name" ) } ? required= ${ true } name="name">
69
+ return html ` < ak-form-element-horizontal label =${ msg ( "Name" ) } required name ="name ">
70
70
< input
71
71
type ="text "
72
72
value ="${ ifDefined ( this . instance ?. name ) } "
73
73
class ="pf-c-form-control "
74
74
required
75
75
/>
76
76
</ ak-form-element-horizontal >
77
- < ak-form-element-horizontal label =${ msg ( "Mode" ) } ? required= ${ true } name="mode">
77
+ < ak-form-element-horizontal label =${ msg ( "Mode" ) } required name ="mode ">
78
78
< ak-radio
79
79
@change =${ ( ev : CustomEvent < { value : NotificationTransportModeEnum } > ) => {
80
80
this . onModeChange ( ev . detail . value ) ;
@@ -106,7 +106,7 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
106
106
?hidden =${ ! this . showWebhook }
107
107
label =${ msg ( "Webhook URL" ) }
108
108
name="webhookUrl"
109
- ? required= ${ true }
109
+ required
110
110
>
111
111
< input
112
112
type ="text "
@@ -116,8 +116,8 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
116
116
</ ak-form-element-horizontal >
117
117
< ak-form-element-horizontal
118
118
?hidden =${ ! this . showWebhook }
119
- label =${ msg ( "Webhook Mapping" ) }
120
- name="webhookMapping "
119
+ label =${ msg ( "Webhook Body Mapping" ) }
120
+ name="webhookMappingBody "
121
121
>
122
122
< ak-search-select
123
123
.fetchObjects =${ async (
@@ -141,9 +141,42 @@ export class TransportForm extends ModelForm<NotificationTransport, string> {
141
141
return item ?. pk ;
142
142
} }
143
143
.selected=${ ( item : NotificationWebhookMapping ) : boolean => {
144
- return this . instance ?. webhookMapping === item . pk ;
144
+ return this . instance ?. webhookMappingBody === item . pk ;
145
145
} }
146
- ?blankable=${ true }
146
+ blankable
147
+ >
148
+ </ ak-search-select >
149
+ </ ak-form-element-horizontal >
150
+ < ak-form-element-horizontal
151
+ ?hidden =${ ! this . showWebhook }
152
+ label =${ msg ( "Webhook Header Mapping" ) }
153
+ name="webhookMappingHeaders"
154
+ >
155
+ < ak-search-select
156
+ .fetchObjects =${ async (
157
+ query ?: string ,
158
+ ) : Promise < NotificationWebhookMapping [ ] > => {
159
+ const args : PropertymappingsNotificationListRequest = {
160
+ ordering : "name" ,
161
+ } ;
162
+ if ( query !== undefined ) {
163
+ args . search = query ;
164
+ }
165
+ const items = await new PropertymappingsApi (
166
+ DEFAULT_CONFIG ,
167
+ ) . propertymappingsNotificationList ( args ) ;
168
+ return items . results ;
169
+ } }
170
+ .renderElement =${ ( item : NotificationWebhookMapping ) : string => {
171
+ return item . name ;
172
+ } }
173
+ .value=${ ( item : NotificationWebhookMapping | undefined ) : string | undefined => {
174
+ return item ?. pk ;
175
+ } }
176
+ .selected=${ ( item : NotificationWebhookMapping ) : boolean => {
177
+ return this . instance ?. webhookMappingHeaders === item . pk ;
178
+ } }
179
+ blankable
147
180
>
148
181
</ ak-search-select >
149
182
</ ak-form-element-horizontal >
0 commit comments