From 8427ea208bc65b40666fed85bf56b68ee0eb4145 Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Wed, 2 Jun 2021 10:48:01 -0700 Subject: [PATCH] IO-1169 Download only images. --- .../jobs-document-gallery.download.component.jsx | 10 +++------- .../jobs-documents-gallery.component.jsx | 7 +++++-- client/src/translations/en_us/common.json | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx b/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx index b172e0806..a1be3e834 100644 --- a/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-document-gallery.download.component.jsx @@ -14,11 +14,11 @@ export default function JobsDocumentsDownloadButton({ const [download, setDownload] = useState(null); const imagesToDownload = [ ...galleryImages.images.filter((image) => image.isSelected), - ...galleryImages.other.filter((image) => image.isSelected), + // ...galleryImages.other.filter((image) => image.isSelected), ]; + const handleDownload = () => { logImEXEvent("jobs_documents_download"); - axios .post("/media/download", { ids: imagesToDownload.map((_) => _.key), @@ -27,12 +27,8 @@ export default function JobsDocumentsDownloadButton({ // window.open(r.data); downloadAs( r.data, - `${identifier || "images"}.zip`, + `${identifier || "documents"}.zip`, (progressEvent) => { - const percentage = Math.round( - (progressEvent.loaded * 100) / progressEvent.total - ); - console.log(progressEvent, percentage); setDownload((currentDownloadState) => { return { downloaded: progressEvent.loaded || 0, diff --git a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx index 2b29a7b3c..500874293 100644 --- a/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx +++ b/client/src/components/jobs-documents-gallery/jobs-documents-gallery.component.jsx @@ -56,6 +56,7 @@ function JobsDocumentsComponent({ isSelected: false, key: value.key, extension: value.extension, + id: value.id, type: value.type, size: value.size, @@ -74,7 +75,8 @@ function JobsDocumentsComponent({ const fileName = value.key.split("/").pop(); acc.other.push({ - src: GenerateSrcUrl(value), + source: GenerateSrcUrl(value), + src: "", thumbnail: thumb, tags: [ { @@ -100,6 +102,7 @@ function JobsDocumentsComponent({ thumbnailHeight: 225, thumbnailWidth: 225, isSelected: false, + extension: value.extension, key: value.key, id: value.id, @@ -211,7 +214,7 @@ function JobsDocumentsComponent({ }} onClickThumbnail={(index) => { window.open( - galleryImages.other[index].src, + galleryImages.other[index].source, "_blank", "toolbar=0,location=0,menubar=0" ); diff --git a/client/src/translations/en_us/common.json b/client/src/translations/en_us/common.json index 999241966..c2da016f2 100644 --- a/client/src/translations/en_us/common.json +++ b/client/src/translations/en_us/common.json @@ -677,7 +677,7 @@ "documents": { "actions": { "delete": "Delete Selected Documents", - "download": "Download Selected Documents", + "download": "Download Selected Images", "reassign": "Reassign to another Job", "selectallimages": "Select All Images", "selectallotherdocuments": "Select All Other Documents"