-
-
+
+
+
-
-
+
+
+
diff --git a/src/app/components/downloads/downloads.component.scss b/src/app/components/downloads/downloads.component.scss
index a6df223..e81f2d7 100644
--- a/src/app/components/downloads/downloads.component.scss
+++ b/src/app/components/downloads/downloads.component.scss
@@ -6,4 +6,10 @@ mat-header-cell, mat-cell {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
+}
+
+.icon-button-spinner {
+ position: absolute;
+ top: 7px;
+ left: 6px;
}
\ No newline at end of file
diff --git a/src/app/components/downloads/downloads.component.ts b/src/app/components/downloads/downloads.component.ts
index 643c21b..ba0eee5 100644
--- a/src/app/components/downloads/downloads.component.ts
+++ b/src/app/components/downloads/downloads.component.ts
@@ -48,7 +48,8 @@ export class DownloadsComponent implements OnInit, OnDestroy {
STEP_INDEX_TO_LABEL = {
0: 'Creating download',
1: 'Getting info',
- 2: 'Downloading file'
+ 2: 'Downloading file',
+ 3: 'Complete'
}
displayedColumns: string[] = ['date', 'title', 'stage', 'progress', 'actions'];
@@ -57,25 +58,33 @@ export class DownloadsComponent implements OnInit, OnDestroy {
@ViewChild(MatPaginator) paginator: MatPaginator;
sort_downloads = (a, b) => {
- const result = b.value.timestamp_start - a.value.timestamp_start;
+ const result = b.timestamp_start - a.timestamp_start;
return result;
}
constructor(public postsService: PostsService, private router: Router) { }
ngOnInit(): void {
+ if (this.postsService.initialized) {
+ this.getCurrentDownloadsRecurring();
+ } else {
+ this.postsService.service_initialized.subscribe(init => {
+ if (init) {
+ this.getCurrentDownloadsRecurring();
+ }
+ });
+ }
+ }
+
+ getCurrentDownloadsRecurring() {
+ if (!this.postsService.config['Extra']['enable_downloads_manager']) {
+ this.router.navigate(['/home']);
+ return;
+ }
this.getCurrentDownloads();
this.interval_id = setInterval(() => {
this.getCurrentDownloads();
}, this.downloads_check_interval);
-
- this.postsService.service_initialized.subscribe(init => {
- if (init) {
- if (!this.postsService.config['Extra']['enable_downloads_manager']) {
- this.router.navigate(['/home']);
- }
- }
- });
}
ngOnDestroy(): void {
@@ -88,6 +97,7 @@ export class DownloadsComponent implements OnInit, OnDestroy {
&& res['downloads'] !== undefined
&& JSON.stringify(this.downloads) !== JSON.stringify(res['downloads'])) {
this.downloads = res['downloads'];
+ this.downloads.sort(this.sort_downloads);
this.dataSource = new MatTableDataSource