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

Merge branch '151-the-remove-bulk-domain-deployment-option-does-not-work' into 'develop'

151 the remove bulk domain deployment option does not work

See merge request !3
parents 0895989e 8a4d7a92
Branches
Tags
2 merge requests!32Resolve "Improve sorting in the application list view",!3151 the remove bulk domain deployment option does not work
import {Injectable} from '@angular/core'; import {Injectable} from '@angular/core';
import {ApplicationBase} from '../../model/application-base'; import {ApplicationBase} from '../../model/application-base';
import {HttpClient} from '@angular/common/http'; import {HttpClient, HttpParams} from '@angular/common/http';
import {AppConfigService} from '../../service'; import {AppConfigService} from '../../service';
import {BulkResponse} from '../../model/bulk-response'; import {BulkResponse} from '../../model/bulk-response';
import {Observable} from 'rxjs'; import {Observable} from 'rxjs';
...@@ -94,4 +94,9 @@ export class AppdeploymentService { ...@@ -94,4 +94,9 @@ export class AppdeploymentService {
} }
public removeBulkDeployment(id: number, removeAll: boolean): Observable<void> {
let params = new HttpParams()
params = params.append('removeAll', removeAll)
return this.http.delete<void>(this.getUrl() + `${id}`, {params})
}
} }
<app-bulk-list [header]="'BULK.APP.HEADER'" [bulks]="bulks" [mode]="mode"></app-bulk-list> <app-bulk-list [header]="'BULK.APP.HEADER'"
[bulks]="bulks"
[mode]="mode"
(reloadBulks)="retrieveBulks()"
></app-bulk-list>
...@@ -20,6 +20,10 @@ export class BulkAppListComponent implements OnInit { ...@@ -20,6 +20,10 @@ export class BulkAppListComponent implements OnInit {
} }
ngOnInit(): void { ngOnInit(): void {
this.retrieveBulks();
}
public retrieveBulks() {
if (this.authService.getRoles().find(value => value === 'ROLE_VL_MANAGER') !== undefined) { if (this.authService.getRoles().find(value => value === 'ROLE_VL_MANAGER') !== undefined) {
this.deployService.getBulksAppDeploymentsOwner().subscribe(data => { this.deployService.getBulksAppDeploymentsOwner().subscribe(data => {
data = data.sort((a, b) => new Date(b.creationDate).getTime() - new Date(a.creationDate).getTime()) data = data.sort((a, b) => new Date(b.creationDate).getTime() - new Date(a.creationDate).getTime())
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<a (click)="getAppBulkDetails(bulk?.id)"> {{"BULK.APP.DOWNLOAD_CSV" | translate}}</a> <a (click)="getAppBulkDetails(bulk?.id)"> {{"BULK.APP.DOWNLOAD_CSV" | translate}}</a>
</li> </li>
<li *ngIf="mode === bulkTypeApp"> <li *ngIf="mode === bulkTypeApp">
<a (click)="modal.show()">{{ 'BULK.LIST.REMOVE' | translate }}</a> <a (click)="modal.show(); setBulkToDelete(bulk)">{{ 'BULK.LIST.REMOVE' | translate }}</a>
</li> </li>
</ul> </ul>
</span> </span>
...@@ -130,9 +130,12 @@ ...@@ -130,9 +130,12 @@
<p-checkbox [(ngModel)]="removeAll" binary="true"></p-checkbox> <p-checkbox [(ngModel)]="removeAll" binary="true"></p-checkbox>
</div> </div>
</div> </div>
<div *ngIf="errorMessage !== ''" style="margin-top: 2rem; display: flex; justify-content: start; color: indianred">
<p>{{ 'BULK.REMOVE.ERROR' | translate}} {{errorMessage}}</p>
</div>
</div> </div>
<div class="nmaas-modal-footer"> <div class="nmaas-modal-footer">
<button type="button" class="btn btn-secondary" (click)="modal.hide()">{{'APP_CHANGE_STATE_MODAL.CANCEL_BUTTON' | translate}}</button> <button type="button" class="btn btn-secondary" (click)="modal.hide()">{{'APP_CHANGE_STATE_MODAL.CANCEL_BUTTON' | translate}}</button>
<button type="button" class="btn btn-primary" [disabled]="false">{{'BULK.REMOVE.REMOVE' | translate}}</button> <button type="button" class="btn btn-primary" (click)="removeBulkDeployment()" [disabled]="false">{{'BULK.REMOVE.REMOVE' | translate}}</button>
</div> </div>
</nmaas-modal> </nmaas-modal>
import {Component, Input, QueryList, ViewChild, ViewChildren} from '@angular/core'; import {Component, EventEmitter, Input, Output, QueryList, ViewChild, ViewChildren} from '@angular/core';
import {BulkDeployment} from '../../../model/bulk-deployment'; import {BulkDeployment} from '../../../model/bulk-deployment';
import {BulkType} from '../../../model/bulk-response'; import {BulkType} from '../../../model/bulk-response';
import {SortableHeaderDirective} from '../../../service/sort-domain.directive'; import {SortableHeaderDirective} from '../../../service/sort-domain.directive';
...@@ -42,6 +42,12 @@ export class BulkListComponent { ...@@ -42,6 +42,12 @@ export class BulkListComponent {
public searchValue = ''; public searchValue = '';
public removeAll = false; public removeAll = false;
public bulkToDelete;
public errorMessage = '';
@Output()
public reloadBulks = new EventEmitter<void>();
constructor(private appDeploy: AppdeploymentService, constructor(private appDeploy: AppdeploymentService,
private sanitizer: DomSanitizer) { private sanitizer: DomSanitizer) {
...@@ -147,4 +153,25 @@ export class BulkListComponent { ...@@ -147,4 +153,25 @@ export class BulkListComponent {
} }
return null return null
} }
public removeBulkDeployment() {
this.appDeploy.removeBulkDeployment(this.bulkToDelete.id, this.removeAll)
.subscribe({
next: (_) => {
this.reloadData()
this.modal.hide()
},
error: err => {
this.errorMessage = err.error.message
}
})
}
public setBulkToDelete(bulk: BulkDeployment) {
this.bulkToDelete = bulk
}
private reloadData() {
this.reloadBulks.emit()
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment