Reset failed tasks

This commit is contained in:
simon987
2019-02-27 20:53:09 -05:00
parent 09dd911dc1
commit 67c67090cf
17 changed files with 118 additions and 32 deletions

View File

@@ -99,19 +99,23 @@ export class ApiService {
}
getSecret(pid: number) {
return this.http.get(this.url + `/project/secret/${pid}`,)
return this.http.get(this.url + `/project/secret/${pid}`, this.options)
}
setSecret(pid: number, secret: string) {
return this.http.post(this.url + `/project/secret/${pid}`, {"secret": secret})
return this.http.post(this.url + `/project/secret/${pid}`, {"secret": secret}, this.options)
}
getWebhookSecret(pid: number) {
return this.http.get(this.url + `/project/webhook_secret/${pid}`,)
return this.http.get(this.url + `/project/webhook_secret/${pid}`, this.options)
}
setWebhookSecret(pid: number, secret: string) {
return this.http.post(this.url + `/project/webhook_secret/${pid}`, {"webhook_secret": secret})
return this.http.post(this.url + `/project/webhook_secret/${pid}`, {"webhook_secret": secret}, this.options)
}
resetFailedTasks(pid: number) {
return this.http.post(this.url + `/project/reset_failed_tasks/${pid}`, null, this.options)
}
}

View File

@@ -10,4 +10,6 @@ export interface Project {
chain: number;
hidden: boolean;
paused: boolean;
assign_rate: number;
submit_rate: number;
}

View File

@@ -84,7 +84,7 @@
</mat-card-content>
<mat-card-actions>
<button mat-raised-button [routerLink]="'/projects'">Back</button>
<button mat-raised-button [routerLink]="'../'">{{"nav.back"|translate}}</button>
<button mat-raised-button color="primary" *ngIf="project && auth.logged"
[routerLink]="'/project/' + project.id + '/update'">{{"project.update" | translate}}</button>
<button mat-raised-button color="primary" *ngIf="project && auth.logged"

View File

@@ -349,7 +349,16 @@ export class ProjectDashboardComponent implements OnInit {
width: '250px',
}).afterClosed().subscribe(result => {
if (result) {
alert("yes")
this.apiService.resetFailedTasks(this.projectId).subscribe(
data => {
this.translate.get("project.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

@@ -70,7 +70,7 @@
</mat-card-content>
<mat-card-actions>
<button mat-raised-button [routerLink]="'../'">Back</button>
<button mat-raised-button [routerLink]="'../'">{{"nav.back"|translate}}</button>
</mat-card-actions>
</mat-card>
</div>

View File

@@ -39,7 +39,7 @@
</mat-card-content>
<mat-card-actions>
<button mat-raised-button [routerLink]="'../'">Back</button>
<button mat-raised-button [routerLink]="'../'">{{"nav.back"|translate}}</button>
<button mat-raised-button color="primary"
(click)="onWebhookUpdate()">{{"secret.update" | translate}}</button>
</mat-card-actions>

View File

@@ -38,10 +38,18 @@
<mat-hint align="start">{{'project.git_repo_hint'|translate}}</mat-hint>
</mat-form-field>
<project-select [(project)]="selectedProject"></project-select>
<mat-form-field appearance="outline">
<mat-label>{{"project.assign_rate"|translate}}</mat-label>
<input matInput [(ngModel)]="project.assign_rate" name="assign_rate" type="number">
</mat-form-field>
<mat-form-field appearance="outline">
<mat-label>{{"project.submit_rate"|translate}}</mat-label>
<input matInput [(ngModel)]="project.submit_rate" name="submit_rate" type="number">
</mat-form-field>
</form>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button [routerLink]="'../'">Back</button>
<button mat-raised-button [routerLink]="'../'">{{"nav.back"|translate}}</button>
<button type="submit" form="uf" mat-raised-button color="primary">{{"project.update" | translate}}</button>
</mat-card-actions>
</mat-card>

View File

@@ -9,7 +9,7 @@
"worker_dashboard": "Workers",
"account": "Account",
"manager_list": "Managers",
"back": "back"
"back": "Back"
},
"logs": {
"title": "Logs",
@@ -69,7 +69,11 @@
"chain": "Chain tasks to",
"manager_select": "Give access to manager",
"version": "Git version (commit hash)",
"secret": "Secret"
"secret": "Secret",
"reset_response": "Reset failed tasks: ",
"assign_rate": "Task assign rate limit",
"submit_rate": "Task submit rate limit",
"rate": "per second"
},
"dashboard": {
"title": "Dashboard for",

View File

@@ -9,7 +9,7 @@
"worker_dashboard": "Workers",
"account": "Compte",
"manager_list": "Managers",
"back": "Arrière"
"back": "Retour"
},
"logs": {
"title": "Journaux",
@@ -69,7 +69,11 @@
"perms": "Permissions",
"chain": "Enchainer les tâches vers",
"manager_select": "Donner accès à",
"version": "Version git (hash du commit)"
"version": "Version git (hash du commit)",
"reset_response": "Réinitialisé les tâches en échec: ",
"assign_rate": "Taux d'assignation de tâches",
"submit_rate": "Taux de soumission de tâches",
"rate": "par seconde"
},
"dashboard": {
"title": "Tableau de bord pour ",