Downloads restarted from home page now persist after restarting rather than disappearing

This commit is contained in:
Isaac Abadi
2023-03-27 19:15:14 -04:00
parent 07a0ea6d18
commit 0bdac15ef1
7 changed files with 30 additions and 8 deletions

View File

@@ -90,6 +90,7 @@ export { NotificationType } from './models/NotificationType';
export type { Playlist } from './models/Playlist';
export type { RegisterRequest } from './models/RegisterRequest';
export type { RegisterResponse } from './models/RegisterResponse';
export type { RestartDownloadResponse } from './models/RestartDownloadResponse';
export type { RestoreDBBackupRequest } from './models/RestoreDBBackupRequest';
export { Schedule } from './models/Schedule';
export type { SetConfigRequest } from './models/SetConfigRequest';

View File

@@ -0,0 +1,9 @@
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { SuccessObject } from './SuccessObject';
export type RestartDownloadResponse = (SuccessObject & {
new_download_uid?: string;
});

View File

@@ -41,7 +41,7 @@ import { Download } from 'api-types';
})
export class DownloadsComponent implements OnInit, OnDestroy {
@Input() uids = null;
@Input() uids: string[] = null;
downloads_check_interval = 1000;
downloads = [];
@@ -200,6 +200,10 @@ export class DownloadsComponent implements OnInit, OnDestroy {
this.postsService.restartDownload(download_uid).subscribe(res => {
if (!res['success']) {
this.postsService.openSnackBar($localize`Failed to restart download! See server logs for more info.`);
} else {
if (this.uids && res['new_download_uid']) {
this.uids.push(res['new_download_uid']);
}
}
});
}

View File

@@ -112,7 +112,8 @@ import {
GetArchivesResponse,
ImportArchiveRequest,
Archive,
Subscription
Subscription,
RestartDownloadResponse
} from '../api-types';
import { isoLangs } from './settings/locales_list';
import { Title } from '@angular/platform-browser';
@@ -621,7 +622,7 @@ export class PostsService implements CanActivate {
restartDownload(download_uid: string) {
const body: GetDownloadRequest = {download_uid: download_uid};
return this.http.post<SuccessObject>(this.path + 'restartDownload', body, this.httpOptions);
return this.http.post<RestartDownloadResponse>(this.path + 'restartDownload', body, this.httpOptions);
}
cancelDownload(download_uid: string) {