Implement hard reset button

This commit is contained in:
simon987
2019-03-16 10:25:13 -04:00
parent 9b8184e414
commit 687ecdbbce
8 changed files with 84 additions and 9 deletions

View File

@@ -118,4 +118,8 @@ export class ApiService {
return this.http.post(this.url + `/project/reset_failed_tasks/${pid}`, null, this.options);
}
hardReset(pid: number) {
return this.http.post(this.url + `/project/hard_reset/${pid}`, null, this.options);
}
}

View File

@@ -414,18 +414,32 @@ export class ProjectDashboardComponent implements OnInit {
this.dialog.open(AreYouSureComponent, {
width: '250px',
}).afterClosed().subscribe(result => {
this.project.paused = paused;
this.apiService.updateProject(this.project).subscribe(() => {
this.translate.get('messenger.acknowledged').subscribe(t =>
this.messenger.show(t));
}, error => {
this.translate.get('messenger.unauthorized').subscribe(t =>
this.messenger.show(t));
});
if (result) {
this.project.paused = paused;
this.apiService.updateProject(this.project).subscribe(() => {
this.translate.get('messenger.acknowledged').subscribe(t =>
this.messenger.show(t));
}, error => {
this.translate.get('messenger.unauthorized').subscribe(t =>
this.messenger.show(t));
});
}
});
}
hardReset() {
this.dialog.open(AreYouSureComponent, {
width: '250px',
}).afterClosed().subscribe(result => {
if (result) {
this.apiService.hardReset(this.project.id).subscribe(data => {
this.translate.get('project.hard_reset_response').subscribe(t =>
this.messenger.show(t + data['content']['affected_tasks']));
}, error => {
this.translate.get('messenger.unauthorized').subscribe(t =>
this.messenger.show(t));
});
}
});
}
}

View File

@@ -71,6 +71,7 @@
"version": "Git version (commit hash)",
"secret": "Secret",
"reset_response": "Reset failed tasks: ",
"hard_reset_response": "Deleted tasks: ",
"assign_rate": "Task assign rate limit",
"submit_rate": "Task submit rate limit",
"rate": "per second",

View File

@@ -71,6 +71,7 @@
"manager_select": "Donner accès à",
"version": "Version git (hash du commit)",
"reset_response": "Réinitialisé les tâches en échec: ",
"hard_reset_response": "Supprimé toutes les tâches: ",
"assign_rate": "Taux d'assignation de tâches",
"submit_rate": "Taux de soumission de tâches",
"rate": "par seconde",