Added ability to reset tasks

Refactored youtube-dl updating and added youtube-dl update task
This commit is contained in:
Isaac Abadi
2022-04-21 22:04:45 -04:00
parent d2d125743e
commit b53d9c9710
8 changed files with 298 additions and 194 deletions

View File

@@ -3,6 +3,7 @@ import { MatDialog } from '@angular/material/dialog';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { ConfirmDialogComponent } from 'app/dialogs/confirm-dialog/confirm-dialog.component';
import { RestoreDbDialogComponent } from 'app/dialogs/restore-db-dialog/restore-db-dialog.component';
import { UpdateTaskScheduleDialogComponent } from 'app/dialogs/update-task-schedule-dialog/update-task-schedule-dialog.component';
import { PostsService } from 'app/posts.services';
@@ -125,6 +126,31 @@ export class TasksComponent implements OnInit {
})
}
resetTasks(): void {
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
data: {
dialogTitle: $localize`Reset tasks`,
dialogText: $localize`Would you like to reset your tasks? All your schedules will be removed as well.`,
submitText: $localize`Reset`,
warnSubmitColor: true
}
});
dialogRef.afterClosed().subscribe(confirmed => {
if (confirmed) {
this.postsService.resetTasks().subscribe(res => {
if (res['success']) {
this.postsService.openSnackBar($localize`Tasks successfully reset!`);
} else {
this.postsService.openSnackBar($localize`Failed to reset tasks!`);
}
}, err => {
this.postsService.openSnackBar($localize`Failed to reset tasks!`);
console.error(err);
});
}
});
}
}
export interface Task {