Permalink
Browse files

fix(): fixed progress bar

  • Loading branch information...
Izak88 authored and jkuri committed Aug 30, 2017
1 parent 8fb3325 commit 38cee0e45b89eaabae68a8dd380ddcb9b78b0c01
@@ -83,8 +83,8 @@ <h1 class="bold">
</p>
</div>
<div class="column is-2">
<p *ngIf="status === 'running' && approximatelyRemainingTime">
<span name="time-left">approximately {{ approximatelyRemainingTime }} remaining</span>
<p *ngIf="status === 'running' && previousRuntime && previousRuntime >= (totalTime | timeDurationRaw)">
<span name="time-left">approximately {{ previousRuntime - (totalTime | timeDurationRaw) | date:'mm:ss' }} remaining</span>
</p>
</div>
<div class="column is-1">
@@ -21,7 +21,6 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy {
totalTime: number;
previousRuntime: number;
processingBuild: boolean;
approximatelyRemainingTime: string;
tag: string = null;
updateInterval: any;
subStatus: Subscription;
@@ -114,18 +113,12 @@ export class AppBuildDetailsComponent implements OnInit, OnDestroy {
}

updateJobTimes(): void {
let currentTime = new Date().getTime() - this.socketService.timeSyncDiff;

if (this.status !== 'running') {
this.totalTime = Math.max(...this.build.jobs.map(job => job.end_time - job.start_time));
} else {
this.totalTime = Math.max(...this.build.jobs.map(job => job.start_time));
}

if (this.previousRuntime && this.previousRuntime > this.totalTime) {
this.approximatelyRemainingTime = format(this.previousRuntime - this.totalTime, 'mm:ss');
}

this.build.jobs = this.build.jobs.map(job => {
const lastRun = job.runs && job.runs[job.runs.length - 1].end_time ?
job.runs[job.runs.length - 1] : job.runs[job.runs.length - 2];
@@ -87,9 +87,7 @@ <h2 *ngIf="tag">{{ job?.build?.data?.head_commit?.message }}</h2>
</p>
</div>
<div class="column is-2">
<p *ngIf="jobRun.status === 'running' && previousRuntime">
<progress class="progress-bar is-success is-small" [value]="expectedProgress" max="1">{{ expectedProgress }}%</progress>
</p>
<progress *ngIf="jobRun.status === 'running' && previousRuntime" class="progress-bar is-success is-small" [value]="(jobRun.start_time | timeDurationRaw) / previousRuntime" max="1" min="0"></progress>
</div>
<div class="column is-1">
<p class="total-time">
@@ -31,7 +31,6 @@ export class AppJobComponent implements OnInit, OnDestroy {
processing: boolean;
sshd: string;
vnc: string;
expectedProgress: number;
tag: string = null;
userData: any;
userId: string | null;
@@ -48,7 +47,6 @@ export class AppJobComponent implements OnInit, OnDestroy {
this.loading = true;
this.terminalOptions = { size: 'large' };
this.id = null;
this.expectedProgress = 0;
}

ngOnInit() {
@@ -116,7 +114,6 @@ export class AppJobComponent implements OnInit, OnDestroy {
this.previousRuntime = this.job.lastJob.end_time - this.job.lastJob.start_time;
}

this.updateJobTime();
this.socketService.emit({ type: 'subscribeToJobOutput', data: { jobId: this.id } });
});
});
@@ -135,13 +132,6 @@ export class AppJobComponent implements OnInit, OnDestroy {
this.titleService.setTitle('Abstruse CI');
}

updateJobTime(): void {
if (this.previousRuntime) {
this.expectedProgress =
(new Date().getTime() - this.jobRun.start_time) / this.previousRuntime;
}
}

setFavicon(): void {
let favicon;
switch (this.jobRun.status) {
@@ -36,7 +36,8 @@ export class AppTeamComponent implements OnInit {
this.users = [];
this.user = auth.getData();
this.userForm = {
email: null, fullname: null, password: null, confirmPassword: null, admin: 0 };
email: null, fullname: null, password: null, confirmPassword: null, admin: 0
};
}

ngOnInit() {
@@ -79,7 +80,8 @@ export class AppTeamComponent implements OnInit {
});

this.userForm = {
email: null, fullname: null, password: null, confirmPassword: null, admin: 0 };
email: null, fullname: null, password: null, confirmPassword: null, admin: 0
};
}

goToUser(id: number): void {

0 comments on commit 38cee0e

Please sign in to comment.