Skip to content
Snippets Groups Projects
Commit a2495b1d authored by Lukasz Lopatowski's avatar Lukasz Lopatowski
Browse files

Merge branch 'fix-webhooks' into 'develop'

update webhooks & clusters

See merge request !191
parents 805389b4 ddde283f
No related branches found
No related tags found
1 merge request!191update webhooks & clusters
......@@ -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>
......
......@@ -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;
}
} )
})
}
......
......@@ -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>
......
......@@ -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>
......
......@@ -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
......@@ -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>
......
......@@ -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() {
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment