Skip to content
Snippets Groups Projects
Commit 2f5f7617 authored by kbeyro's avatar kbeyro
Browse files

update bulk fields

parent ed749bac
Branches
Tags
2 merge requests!108Develop,!78update bulk fields
...@@ -187,6 +187,15 @@ ...@@ -187,6 +187,15 @@
</div> </div>
</div> </div>
<div class="" style="padding-bottom: 5rem">
<label for="completionDate"
class="col-sm-2 control-label text-right mt-2">{{ 'BULK.LIST.COMPLETION_DATE' | translate }}</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="completionDate" name="completionDate" [disabled]="true"
placeholder="{{completionDate}}">
</div>
</div>
<div class="" style="padding-bottom: 5rem;"> <div class="" style="padding-bottom: 5rem;">
<label for="id" class="col-sm-2 control-label text-right mt-2">{{ 'BULK.LIST.APP_NAME' | translate }}</label> <label for="id" class="col-sm-2 control-label text-right mt-2">{{ 'BULK.LIST.APP_NAME' | translate }}</label>
<div class="col-sm-10"> <div class="col-sm-10">
......
...@@ -7,6 +7,7 @@ import {timer} from 'rxjs'; ...@@ -7,6 +7,7 @@ import {timer} from 'rxjs';
import {map} from 'rxjs/operators'; import {map} from 'rxjs/operators';
import {AppImagesService} from '../../../service'; import {AppImagesService} from '../../../service';
import { BulkQueueDetails } from '../../../model/bulk-queue-details'; import { BulkQueueDetails } from '../../../model/bulk-queue-details';
import { DatePipe } from '@angular/common';
@Component({ @Component({
selector: 'app-bulk-view', selector: 'app-bulk-view',
...@@ -27,11 +28,13 @@ export class BulkViewComponent implements OnInit, OnDestroy { ...@@ -27,11 +28,13 @@ export class BulkViewComponent implements OnInit, OnDestroy {
public queueDetails :BulkQueueDetails; public queueDetails :BulkQueueDetails;
public jobDone = false; public jobDone = false;
public completionDate = "";
constructor(public deployService: AppdeploymentService, constructor(public deployService: AppdeploymentService,
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
public appImagesService: AppImagesService, public appImagesService: AppImagesService,
private datePipe: DatePipe
) { ) {
} }
...@@ -45,6 +48,7 @@ export class BulkViewComponent implements OnInit, OnDestroy { ...@@ -45,6 +48,7 @@ export class BulkViewComponent implements OnInit, OnDestroy {
this.bulk = bulk; this.bulk = bulk;
this.bulkType = bulk.type; this.bulkType = bulk.type;
this.getQueueDetails(); this.getQueueDetails();
this.setCompletionDate(bulk);
if (this.bulkType === BulkType.APPLICATION) { if (this.bulkType === BulkType.APPLICATION) {
this.update(); this.update();
} }
...@@ -101,6 +105,7 @@ export class BulkViewComponent implements OnInit, OnDestroy { ...@@ -101,6 +105,7 @@ export class BulkViewComponent implements OnInit, OnDestroy {
this.refresh = timer(0, 20000).pipe(map(() => { this.refresh = timer(0, 20000).pipe(map(() => {
this.deployService.getBulkDeployment(this.bulk.id).subscribe(bulk => { this.deployService.getBulkDeployment(this.bulk.id).subscribe(bulk => {
this.bulk = bulk; this.bulk = bulk;
this.setCompletionDate(bulk);
if(bulk.state === 'REMOVED') this.refresh.unsubscribe(); if(bulk.state === 'REMOVED') this.refresh.unsubscribe();
if(bulk.state === 'PROCESSING' && this.queueDetails.jobInProcessId === bulk.id) { if(bulk.state === 'PROCESSING' && this.queueDetails.jobInProcessId === bulk.id) {
this.progressBarMode = "determinate" this.progressBarMode = "determinate"
...@@ -125,7 +130,7 @@ export class BulkViewComponent implements OnInit, OnDestroy { ...@@ -125,7 +130,7 @@ export class BulkViewComponent implements OnInit, OnDestroy {
public getAppBulkDetails(id: number) { public getAppBulkDetails(id: number) {
this.deployService.getAppBulkDetails(id).subscribe( (data: Blob) => { this.deployService.getAppBulkDetails(id).subscribe( (data: Blob) => {
console.warn(data) console.log(data)
const blob = new Blob([data], { type: 'text/csv' }); const blob = new Blob([data], { type: 'text/csv' });
const url = window.URL.createObjectURL(blob); const url = window.URL.createObjectURL(blob);
const a = document.createElement('a'); const a = document.createElement('a');
...@@ -141,18 +146,25 @@ export class BulkViewComponent implements OnInit, OnDestroy { ...@@ -141,18 +146,25 @@ export class BulkViewComponent implements OnInit, OnDestroy {
public refreshStates() { public refreshStates() {
this.deployService.refreshStatesInBulkDeployment(this.bulkId).subscribe( deply => { this.deployService.refreshStatesInBulkDeployment(this.bulkId).subscribe( deply => {
this.bulk = deply; this.bulk = deply;
this.setCompletionDate(deply);
this.getQueueDetails(); this.getQueueDetails();
console.log("Updated states of bulks")
}) })
} }
public setCompletionDate( deployment: BulkDeployment) {
if(this.bulk.completionDate !== undefined && this.bulk.completionDate !== null && deployment.state === 'COMPLETED') {
this.completionDate = this.datePipe.transform(this.bulk.completionDate,'dd-MM-yyyy HH:mm' )
} else {
this.completionDate = " - "
}
}
public setBarValue() { public setBarValue() {
this.getQueueDetails(); this.getQueueDetails();
} }
public getQueueDetails(): void { public getQueueDetails(): void {
this.deployService.getQueueDetails(this.bulkId).subscribe(queue => { this.deployService.getQueueDetails(this.bulkId).subscribe(queue => {
console.log(queue);
this.queueDetails = queue; this.queueDetails = queue;
if(queue.jobDone === this.bulk.entries.length) { if(queue.jobDone === this.bulk.entries.length) {
this.progressBarValue = 100; this.progressBarValue = 100;
......
...@@ -11,6 +11,7 @@ export class BulkDeployment { ...@@ -11,6 +11,7 @@ export class BulkDeployment {
public details: Map<string, string>; public details: Map<string, string>;
public parallelDeploymentsLimit: number; public parallelDeploymentsLimit: number;
public deleted: boolean; public deleted: boolean;
public completionDate: Date;
} }
export enum BulkDeploymentState { export enum BulkDeploymentState {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment