From 992e434b0f52f20311c0fc9d195e5869a927a6ab Mon Sep 17 00:00:00 2001 From: kbeyro <121854496+kbeyro@users.noreply.github.com> Date: Tue, 27 May 2025 14:55:42 +0200 Subject: [PATCH] show error message --- .../webhook/webhook-details/webhook-details.component.html | 3 +++ .../webhook/webhook-details/webhook-details.component.ts | 5 +++++ src/app/shared/admin/clusters/manager/manager.component.ts | 4 ++++ .../clusters/managerdetails/managerdetails.component.html | 4 +++- .../clusters/managerdetails/managerdetails.component.ts | 4 ++++ 5 files changed, 19 insertions(+), 1 deletion(-) 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 bd62085c..96eb2f17 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 @@ -79,6 +79,9 @@ type="submit">{{ 'PORTAL_CONFIGURATION.SUBMIT_BUTTON' | translate }}</button> </div> + <div> + <div *ngIf="errorMessage" class="alert alert-danger mt-2">{{ errorMessage }}</div> + </div> </div> </form> 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 9c64e1db..573ac609 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 @@ -15,6 +15,8 @@ export class WebhookDetailsComponent extends BaseComponent implements OnInit { public webhook: Webhook; public authRequired: boolean = false; + public errorMessage: string = ""; + constructor(private service: WebhookService, public router: Router, private route: ActivatedRoute) { @@ -42,6 +44,9 @@ export class WebhookDetailsComponent extends BaseComponent implements OnInit { this.service.update(this.webhook).subscribe(result => { console.log(result); this.webhook = result; + }, error => { + console.error(error); + this.errorMessage = "Error updating webhook: " + error.message; }); } } diff --git a/src/app/shared/admin/clusters/manager/manager.component.ts b/src/app/shared/admin/clusters/manager/manager.component.ts index f077af8c..13824140 100644 --- a/src/app/shared/admin/clusters/manager/manager.component.ts +++ b/src/app/shared/admin/clusters/manager/manager.component.ts @@ -47,6 +47,10 @@ export class ClusterManagerComponent { } public closeModalAndSaveCluster() { + if(this.addedCluster.domainNames !== undefined && this.addedCluster.domainNames !== null) { + this.addedCluster.domainNames = [null]; + } + console.log(this.addedCluster); this.clusterService.sendCluster(this.updatedFile, this.addedCluster).subscribe(result => { console.log(result); this.getAllClusters(); diff --git a/src/app/shared/admin/clusters/managerdetails/managerdetails.component.html b/src/app/shared/admin/clusters/managerdetails/managerdetails.component.html index 9f7c872a..a87890ce 100644 --- a/src/app/shared/admin/clusters/managerdetails/managerdetails.component.html +++ b/src/app/shared/admin/clusters/managerdetails/managerdetails.component.html @@ -47,12 +47,14 @@ </div> </div> + + <!-- TODO: Fix selector, show value on init when selectedDomain is null/empty --> <div class="form-group"> <label for="clusterCreationDate" class="col-sm-2 control-label">{{ 'CLUSTERS.DOMAIN' | translate }}</label> <div class="col-sm-10"> <div class="col-sm-10"> <select id="domain" #domainSelect class="form-control" (change)="onDomainSelection(domainSelect.value)"> - <option *ngFor="let domain of domains" [selected]="cluster.domainNames[0] === domain.name" [value]="domain.name" + <option *ngFor="let domain of domains" [selected]="selectedDomain" [value]="domain.name" >{{domain.name}} </option> </select> diff --git a/src/app/shared/admin/clusters/managerdetails/managerdetails.component.ts b/src/app/shared/admin/clusters/managerdetails/managerdetails.component.ts index 1f275e02..14fa854a 100644 --- a/src/app/shared/admin/clusters/managerdetails/managerdetails.component.ts +++ b/src/app/shared/admin/clusters/managerdetails/managerdetails.component.ts @@ -17,6 +17,7 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI public cluster: ClusterManager ; public cluterId; public error = ""; + public selectedDomain: string = "" public domains = []; @@ -50,6 +51,9 @@ export class ClusterManagerDetailsComponent extends BaseComponent implements OnI this.clusterService.getClusterDetails(this.cluterId).subscribe(result => { console.log(result); this.cluster = result; + if(this.cluster.domainNames !== undefined && this.cluster.domainNames !== null && this.cluster.domainNames.length > 0) { + this.selectedDomain = this.cluster.domainNames[0]; + } } ) }) } -- GitLab