Skip to content
Snippets Groups Projects
Commit c1715197 authored by Simon Künzel's avatar Simon Künzel
Browse files

Show download status after finished downloading and fix download links

parent e2b372a0
Branches
Tags
No related merge requests found
Pipeline #7541 failed
...@@ -181,7 +181,7 @@ async function downloadWithDownloadAPI( ...@@ -181,7 +181,7 @@ async function downloadWithDownloadAPI(
): Promise<boolean> { ): Promise<boolean> {
showWarningToast( showWarningToast(
"Unable to store files in directory automatically. Using basic download API which might require" + "Unable to store files in directory automatically. Using basic download API which might require" +
" you to selected the destination location for every file.", " you to select the destination location for every file.",
); );
for (const toDownload of filesToDownload) { for (const toDownload of filesToDownload) {
try { try {
...@@ -211,7 +211,6 @@ async function downloadWithDownloadAPI( ...@@ -211,7 +211,6 @@ async function downloadWithDownloadAPI(
} }
async function downloadMedia( async function downloadMedia(
downloadStatus: Map<int, DownloadStatus> | undefined,
setDownloadStatus: ( setDownloadStatus: (
fn: (old?: Map<int, DownloadStatus> | undefined) => Map<int, DownloadStatus> | undefined, fn: (old?: Map<int, DownloadStatus> | undefined) => Map<int, DownloadStatus> | undefined,
) => void, ) => void,
...@@ -287,9 +286,6 @@ async function downloadMedia( ...@@ -287,9 +286,6 @@ async function downloadMedia(
return false; return false;
}); });
console.log(`Download finished. Success: ${success}`); console.log(`Download finished. Success: ${success}`);
if (success) {
showInfoToast("Download finished");
}
} }
function DownloadAllLectureListItem({ function DownloadAllLectureListItem({
...@@ -310,7 +306,7 @@ function DownloadAllLectureListItem({ ...@@ -310,7 +306,7 @@ function DownloadAllLectureListItem({
const media = getSortedDownloadablePublishMedia(lecture.publish_media!); const media = getSortedDownloadablePublishMedia(lecture.publish_media!);
let displayedProgress; let displayedProgress;
if (isDownloading && selectedMediumId !== undefined) { if ((isDownloading || downloadStatus !== undefined) && selectedMediumId !== undefined) {
// Lecture needs to be downloaded // Lecture needs to be downloaded
if (downloadStatus === undefined) { if (downloadStatus === undefined) {
// Not yet started // Not yet started
...@@ -495,7 +491,6 @@ export default function DownloadAllModal({ course }: { course: course }) { ...@@ -495,7 +491,6 @@ export default function DownloadAllModal({ course }: { course: course }) {
const startDownloads = async () => { const startDownloads = async () => {
if (isDownloading) return; if (isDownloading) return;
downloadMedia( downloadMedia(
downloadStatus,
setDownloadStatus, setDownloadStatus,
course, course,
chosenMediumIdByLectureId, chosenMediumIdByLectureId,
......
...@@ -87,7 +87,7 @@ export function PublishMediumList({ publish_media }: { publish_media: publish_me ...@@ -87,7 +87,7 @@ export function PublishMediumList({ publish_media }: { publish_media: publish_me
} }
> >
<span className="bi bi-download" /> <span className="bi bi-download" />
<a href={medium.download_url} className="mx-1"> <a href={medium.download_url} download target="_blank" className="mx-1">
{name} {name}
</a> </a>
{editMode && ( {editMode && (
...@@ -147,7 +147,7 @@ export function PublishMediumDownloadButton({ ...@@ -147,7 +147,7 @@ export function PublishMediumDownloadButton({
return ( return (
<div key={medium.id} className={"d-flex align-items-center " + bgColor}> <div key={medium.id} className={"d-flex align-items-center " + bgColor}>
<Dropdown.Item href={medium.download_url} download> <Dropdown.Item href={medium.download_url} download target="_blank">
{name} {name}
</Dropdown.Item> </Dropdown.Item>
{editMode && ( {editMode && (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment