Fix pause button

This commit is contained in:
simon987 2019-02-24 14:26:38 -05:00
parent ce5344d9c7
commit c736cc3d98
2 changed files with 20 additions and 4 deletions

View File

@ -64,10 +64,18 @@
color="primary" color="primary"
(click)="pauseProject()" (click)="pauseProject()"
*ngIf="!project.paused" *ngIf="!project.paused"
[title]="'dashboard.pause_hint'|translate">{{"dashboard.pause"|translate}}</button> [title]="'dashboard.pause_hint'|translate">
<button mat-raised-button color="primary" (click)="pauseProject()">
<mat-icon>pause</mat-icon> <mat-icon>pause</mat-icon>
{{"dashboard.pause"|translate}}</button> {{"dashboard.pause"|translate}}
</button>
<button mat-raised-button
color="primary"
(click)="resumeProject()"
*ngIf="project.paused"
[title]="'dashboard.resume_hint'|translate">
<mat-icon>play_arrow</mat-icon>
{{"dashboard.resume"|translate}}
</button>
<button mat-raised-button color="warn" (click)="hardReset()"> <button mat-raised-button color="warn" (click)="hardReset()">
<mat-icon>warning</mat-icon> <mat-icon>warning</mat-icon>
{{"dashboard.hard_reset"|translate}} {{"dashboard.hard_reset"|translate}}

View File

@ -355,11 +355,19 @@ export class ProjectDashboardComponent implements OnInit {
} }
pauseProject() { pauseProject() {
this.setPaused(true)
}
resumeProject() {
this.setPaused(false)
}
private setPaused(paused: boolean) {
this.dialog.open(AreYouSureComponent, { this.dialog.open(AreYouSureComponent, {
width: '250px', width: '250px',
}).afterClosed().subscribe(result => { }).afterClosed().subscribe(result => {
if (result) { if (result) {
this.project.paused = true; this.project.paused = paused;
this.apiService.updateProject(this.project).subscribe(() => { this.apiService.updateProject(this.project).subscribe(() => {
this.translate.get("messenger.acknowledged").subscribe(t => this.translate.get("messenger.acknowledged").subscribe(t =>
this.messenger.show(t)) this.messenger.show(t))