diff --git a/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.html b/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.html index 371001ac3c47ef7974ba8b79a539e3f5ed043eb5..d8860c3d471270b67b7d7caa08485df8496fdcf1 100644 --- a/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.html +++ b/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.html @@ -58,7 +58,7 @@ <div class="col-sm-10"> <div class="col-sm-10"> <input type="text" class="form-control" id="token" name="token" [ngModelOptions]="{standalone: true}" - [(ngModel)]="webhook.tokenValue" [disabled]="false" > + [(ngModel)]="webhook.tokenValue" [disabled]="false" [required]="authRequired" > </div> </div> </div> @@ -69,13 +69,13 @@ <div class="col-sm-10"> <div class="col-sm-10"> <input type="text" class="form-control" id="auth" name="auth" [ngModelOptions]="{standalone: true}" - [(ngModel)]="webhook.authorizationHeader" [disabled]="false"> + [(ngModel)]="webhook.authorizationHeader" [disabled]="false" [required]="authRequired"> </div> </div> </div> <div class="flex justify-content-end"> - <button [disabled]="!webhookForm.form.valid" type="submit" class="btn btn-primary" + <button [disabled]="!webhookForm.form.valid || !isFormValid()" type="submit" class="btn btn-primary" type="submit">{{ 'PORTAL_CONFIGURATION.SUBMIT_BUTTON' | translate }}</button> </div> diff --git a/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.ts b/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.ts index 6cf5451cbf9a815d76efbd9f8445518dffe4c108..5d4d504f90868a45c0b500a10297772f4a3c434c 100644 --- a/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.ts +++ b/src/app/appmarket/admin/webhook/webhook-details/webhook-details.component.ts @@ -69,4 +69,13 @@ export class WebhookDetailsComponent extends BaseComponent implements OnInit { this.webhook.authorizationHeader = this.authorizationHeader; } } + + public isFormValid(): boolean { + if(this.authRequired) { + return this.webhook.tokenValue !== null && this.webhook.tokenValue !== "" && + this.webhook.authorizationHeader !== null && this.webhook.authorizationHeader !== ""; + } else { + return true; + } + } }