mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-18 10:40:57 +03:00
Confirm dialog can now optionally use warn colors (used for deletion or breaking changes)
Category re-ordering is fixed Category deletion in settings is now functional
This commit is contained in:
@@ -82,7 +82,11 @@ export class SettingsComponent implements OnInit {
|
||||
|
||||
dropCategory(event: CdkDragDrop<string[]>) {
|
||||
moveItemInArray(this.postsService.categories, event.previousIndex, event.currentIndex);
|
||||
this.postsService.updateCategories(this.postsService.categories);
|
||||
this.postsService.updateCategories(this.postsService.categories).subscribe(res => {
|
||||
|
||||
}, err => {
|
||||
this.postsService.openSnackBar('Failed to update categories!');
|
||||
});
|
||||
}
|
||||
|
||||
openAddCategoryDialog() {
|
||||
@@ -113,6 +117,29 @@ export class SettingsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
deleteCategory(category) {
|
||||
const dialogRef = this.dialog.open(ConfirmDialogComponent, {
|
||||
data: {
|
||||
dialogTitle: 'Delete category',
|
||||
dialogText: `Would you like to delete ${category['name']}?`,
|
||||
submitText: 'Delete',
|
||||
warnSubmitColor: true
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().subscribe(confirmed => {
|
||||
if (confirmed) {
|
||||
this.postsService.deleteCategory(category['uid']).subscribe(res => {
|
||||
if (res['success']) {
|
||||
this.postsService.openSnackBar(`Successfully deleted ${category['name']}!`);
|
||||
this.postsService.reloadCategories();
|
||||
}
|
||||
}, err => {
|
||||
this.postsService.openSnackBar(`Failed to delete ${category['name']}!`);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openEditCategoryDialog(category) {
|
||||
this.dialog.open(EditCategoryDialogComponent, {
|
||||
data: {
|
||||
@@ -206,7 +233,8 @@ export class SettingsComponent implements OnInit {
|
||||
dialogTitle: 'Kill downloads',
|
||||
dialogText: 'Are you sure you want to kill all downloads? Any subscription and non-subscription downloads will end immediately, though this operation may take a minute or so to complete.',
|
||||
submitText: 'Kill all downloads',
|
||||
doneEmitter: done
|
||||
doneEmitter: done,
|
||||
warnSubmitColor: true
|
||||
}
|
||||
});
|
||||
done.subscribe(confirmed => {
|
||||
|
||||
Reference in New Issue
Block a user