mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-21 04:00:57 +03:00
Added progress bar to file downloads
Added two new API calls, to update the server to a particular version and to get the updater status You can now update through the UI, and a status dialog displays after
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
|
||||
@Component({
|
||||
selector: 'app-update-progress-dialog',
|
||||
templateUrl: './update-progress-dialog.component.html',
|
||||
styleUrls: ['./update-progress-dialog.component.scss']
|
||||
})
|
||||
export class UpdateProgressDialogComponent implements OnInit {
|
||||
|
||||
updateStatus = null;
|
||||
updateInterval = 250;
|
||||
errored = false;
|
||||
|
||||
constructor(private postsService: PostsService, private snackBar: MatSnackBar) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getUpdateProgress();
|
||||
setInterval(() => {
|
||||
this.getUpdateProgress();
|
||||
}, 250);
|
||||
}
|
||||
|
||||
getUpdateProgress() {
|
||||
this.postsService.getUpdaterStatus().subscribe(res => {
|
||||
this.updateStatus = res;
|
||||
if (!this.updateStatus) {
|
||||
// update complete?
|
||||
console.log('Update complete? or not started');
|
||||
}
|
||||
if (this.updateStatus && this.updateStatus['error']) {
|
||||
this.openSnackBar('Update failed. Check logs for more details.');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public openSnackBar(message: string, action: string = '') {
|
||||
this.snackBar.open(message, action, {
|
||||
duration: 2000,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user