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 6508c441faf6d04a075bd21e4de0d841d5868c29..bd62085c711fbf003a0e378516ccae08cd409f6b 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 @@ -42,27 +42,33 @@ <div class="col-sm-10"> <div class="col-sm-10"> <input type="text" class="form-control" id="clusterDescription" name="clusterDescription" - placeholder="{{webhook.eventType | translate}}" [disabled]="true"> + placeholder="{{'WEBHOOKS.' +webhook.eventType | translate}}" [disabled]="true"> </div> </div> </div> - <div class="form-group"> + <label for="assignDomain" class="col-sm-2 control-label">Auth required</label> + <div class="col-sm-10"> + <input class="ml-5 mt-2" type="checkbox" [(ngModel)]="authRequired" [ngModelOptions]="{standalone: true}" id="authRequired"/> + </div> + </div> + + <div *ngIf="authRequired" class="form-group"> <label for="token" class="col-sm-2 control-label">{{ 'WEBHOOKS.TOKEN' | translate }}</label> <div class="col-sm-10"> <div class="col-sm-10"> - <input type="text" class="form-control" id="token" name="token" + <input type="text" class="form-control" id="token" name="token" [ngModelOptions]="{standalone: true}" [(ngModel)]="webhook.tokenValue" [disabled]="false"> </div> </div> </div> - <div class="form-group"> + <div *ngIf="authRequired" class="form-group"> <label for="auth" class="col-sm-2 control-label">{{ 'WEBHOOKS.AUTH' | translate }}</label> <div class="col-sm-10"> <div class="col-sm-10"> - <input type="text" class="form-control" id="auth" name="auth" + <input type="text" class="form-control" id="auth" name="auth" [ngModelOptions]="{standalone: true}" [(ngModel)]="webhook.authorizationHeader" [disabled]="false"> </div> </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 ef3ae89e81d00a607683d2c4178c02861fd2ba6f..9c64e1dbfcd9a9d6da75f5c135e04158c0014cd5 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 @@ -13,6 +13,7 @@ export class WebhookDetailsComponent extends BaseComponent implements OnInit { public webhooksId: number; public webhook: Webhook; + public authRequired: boolean = false; constructor(private service: WebhookService, public router: Router, @@ -28,6 +29,9 @@ export class WebhookDetailsComponent extends BaseComponent implements OnInit { this.service.getOne(this.webhooksId).subscribe(result => { console.log(result); this.webhook = result; + if(this.webhook.tokenValue !== null ) { + this.authRequired = true; + } } ) }) } diff --git a/src/app/appmarket/admin/webhook/webhook-list/webhook-list.component.html b/src/app/appmarket/admin/webhook/webhook-list/webhook-list.component.html index 39080066002c1b24b9069ac5d1f72a99fdebc0c0..6f59c32bce19eb322433692517bd9ef81d56761e 100644 --- a/src/app/appmarket/admin/webhook/webhook-list/webhook-list.component.html +++ b/src/app/appmarket/admin/webhook/webhook-list/webhook-list.component.html @@ -108,7 +108,7 @@ </div> <div class="nmaas-modal-footer"> <button type="button" class="btn btn-primary" [disabled]=" addedWebhook?.name === null "(click)="closeModalAndSaveWebhook()" - pTooltip="Upload file is required before save" showDelay="2000" >{{'CLUSTERS.SAVE' | translate}}</button> + pTooltip="Upload file is required before save" showDelay="2000" >{{'WEBHOOKS.SAVE' | translate}}</button> <button type="button" class="btn btn-secondary" (click)="this.modal.hide()">{{'UNDEPLOY_MODAL.CANCEL_BUTTON' | translate}}</button> diff --git a/src/app/appmarket/domains/domain/domain.component.html b/src/app/appmarket/domains/domain/domain.component.html index c2a9838660c4332d4237edfcb336bc4748e94e2c..6064793e4a7fed80d8596d5e0533b4da11efdcff 100644 --- a/src/app/appmarket/domains/domain/domain.component.html +++ b/src/app/appmarket/domains/domain/domain.component.html @@ -270,50 +270,58 @@ <!-- CLUSTER CONFIGURATION READ ONLY PRESENTATION --> - <div class="background-section" *ngIf="isInMode(ComponentMode.VIEW) && !authService.hasRole('ROLE_OPERATOR')"> + <div class="background-section" *ngIf="isInMode(ComponentMode.VIEW) && !authService.hasRole('ROLE_OPERATOR')"> <h4 style="font-size:15px; font-weight: bold">{{ 'CLUSTERS.CONFIGURATION' | translate }}</h4> <div class="panel-body" *ngIf="domain.clusters.length === 0" > <p>None</p> </div> <div class="form-group panel-body" *ngIf="domain.clusters.length >0"> - <label for="clusterId" class="col-sm-2 control-label">{{ 'CLUSTERS.ID' | translate }}</label> - <div class="col-sm-10"> - <input type="text" class="form-control" [disabled]="true" id="clusterId " - name="clusterId " [(ngModel)]="cluster.id"> - </div> - </div> + <p-table + [value]="domain.clusters" + [paginator]="true" + [rows]="10" + [responsiveLayout]="'scroll'"> + <ng-template pTemplate="header"> + <tr> + <th pSortableColumn="id" id="id"> {{ 'CLUSTERS.ID' | translate }} + <p-sortIcon field="id"></p-sortIcon> + </th> + <th pSortableColumn="name" id="name"> {{ 'CLUSTERS.NAME' | translate }} + <p-sortIcon field="name"></p-sortIcon> + </th> + <th pSortableColumn="codename" id="codename"> {{ 'CLUSTERS.CODENAME' | translate }} + <p-sortIcon field="codename"></p-sortIcon> + </th> + <th pSortableColumn="state" id="state"> {{ 'CLUSTERS.STATE' | translate }} + <p-sortIcon field="state"></p-sortIcon> + </th> + <th pSortableColumn="creationDate" id="creationDate"> {{ 'CLUSTERS.CREATION_DATE' | translate }} + <p-sortIcon field="creationDate"></p-sortIcon> + </th> + <th pSortableColumn="modificationDate" id="modificationDate"> {{ 'CLUSTERS.MODIFICATION_DATE' | translate }} + <p-sortIcon field="modificationDate"></p-sortIcon> + </th> + </tr> + </ng-template> + <ng-template pTemplate="body" let-cluster> + <tr> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{cluster.id}}</td> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{cluster.name}}</td> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{cluster.codename}}</td> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{('CLUSTERS.'+cluster.state.toString().toUpperCase() ) | translate}}</td> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{cluster.creationDate | date: 'dd-MM-yyyy HH:mm'}}</td> + <td [routerLink]="['/admin/manage/clusters/',cluster.id]">{{cluster.modificationDate | date: 'dd-MM-yyyy HH:mm'}}</td> + + </tr> + </ng-template> + </p-table> - <div class="form-group panel-body" *ngIf="domain.clusters.length >0"> - <label for="clusterName" class="col-sm-2 control-label">{{ 'CLUSTERS.NAME' | translate }}</label> - <div class="col-sm-10"> - <input type="text" class="form-control" [disabled]="true" id="clusterName " - name="clusterName " [(ngModel)]="cluster.name"> - </div> - </div> - <div class="form-group panel-body" *ngIf="domain.clusters.length >0"> - <label for="clusterCodeName" class="col-sm-2 control-label">{{ 'CLUSTERS.CODENAME' | translate }}</label> - <div class="col-sm-10"> - <input type="text" class="form-control" [disabled]="true" id="clusterCodeName " - name="clusterCodeName " [(ngModel)]="cluster.codename"> </div> - </div> - - <div class="form-group panel-body" *ngIf="domain.clusters.length >0"> - <label for="clusterDescription" class="col-sm-2 control-label">{{ 'CLUSTERS.DESCRIPTION' | translate }}</label> - <div class="col-sm-10"> - <input type="text" class="form-control" [disabled]="true" id="clusterDescription " - name="clusterDescription " [(ngModel)]="cluster.description"> </div> - </div> - - - - - - </div> + <div class="flex justify-content-end"> <button *ngIf="!isInMode(ComponentMode.VIEW)" type="submit" class="btn btn-primary" [disabled]="!domainForm.form.valid">{{ 'DOMAIN_DETAILS.SUBMIT_BUTTON' | translate }}</button> </div> diff --git a/src/app/service/cluster-manager.service.ts b/src/app/service/cluster-manager.service.ts index a298dfe92ec77fd4fb80cdd8d4ecc6248b5f3c70..1a6c6b8994d81a80648d0dd7065cb81f37b3c39d 100644 --- a/src/app/service/cluster-manager.service.ts +++ b/src/app/service/cluster-manager.service.ts @@ -36,4 +36,8 @@ export class ClusterManagerService { return this.http.put<ClusterManager>(`${this.url}/${cluster.id}`, cluster); } + public deleteCluster(id: number): Observable<void> { + return this.http.delete<void>(this.url + '/' + id); + } + } \ No newline at end of file diff --git a/src/app/shared/admin/clusters/manager/manager.component.html b/src/app/shared/admin/clusters/manager/manager.component.html index fbced4c7777792ce92c21edf168687483bd954cd..785c7ebb96573cfb100f3b889556f554dca83c16 100644 --- a/src/app/shared/admin/clusters/manager/manager.component.html +++ b/src/app/shared/admin/clusters/manager/manager.component.html @@ -61,7 +61,11 @@ <li><a [routerLink]="[ cluster.id]" class=""> {{ 'CLUSTERS.DETAILS' | translate }}</a> </li> + <li><a (click)="deleteCluster(cluster)" class=""> + {{ 'CLUSTERS.REMOVE' | translate }}</a> + </li> </ul> + </span> </td> </tr> diff --git a/src/app/shared/admin/clusters/manager/manager.component.ts b/src/app/shared/admin/clusters/manager/manager.component.ts index 1e8c8938bca5d9ab01c66b444b5aad8142e7e4c7..f077af8c780e65cb88798b4c7117ca5fe1c0a24c 100644 --- a/src/app/shared/admin/clusters/manager/manager.component.ts +++ b/src/app/shared/admin/clusters/manager/manager.component.ts @@ -72,8 +72,19 @@ public openModal() { this.modal.show(); } +public deleteCluster(cluster: ClusterManager) { + this.clusterService.deleteCluster(cluster.id).subscribe(() => { + console.log('Cluster deleted successfully'); + this.getAllClusters(); + }, error => { + console.error('Error deleting cluster:', error); + } + ); +} + public onDomainChange(event: any) { -console.log(event); + console.log(event); + this.addedCluster.domainNames = [this.domains[0].name]; } filterClusters() { diff --git a/src/app/shared/modal/appinstall/appinstallmodal.component.html b/src/app/shared/modal/appinstall/appinstallmodal.component.html index 83c1876cfb2ad85ebd587339af208617f9fb02e5..47e02a01cb8199d50435cd6a39d5f7a26909b408 100644 --- a/src/app/shared/modal/appinstall/appinstallmodal.component.html +++ b/src/app/shared/modal/appinstall/appinstallmodal.component.html @@ -27,7 +27,7 @@ <p><strong>{{'INSTALL_MODAL.DOMAIN' | translate}}: </strong>{{domainName}}</p> </div> - <div class="form-group" style="padding-top: 15px"> + <div *ngIf="isRemoteClusterAvailable" class="form-group" style="padding-top: 15px"> <label for="showCluster" style="padding-left: 0px" class="col-sm-10 control-label">{{ 'INSTALL_MODAL.REMOTE_CLUSTER' | translate }}:</label> <div class="col-sm-2"> <input type="checkbox" id="showCluster" name="showCluster"