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"
(click)="pauseProject()"
*ngIf="!project.paused"
[title]="'dashboard.pause_hint'|translate">{{"dashboard.pause"|translate}}</button>
<button mat-raised-button color="primary" (click)="pauseProject()">
[title]="'dashboard.pause_hint'|translate">
<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()">
<mat-icon>warning</mat-icon>
{{"dashboard.hard_reset"|translate}}

View File

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