IO-1169 Download only images.
This commit is contained in:
@@ -14,11 +14,11 @@ export default function JobsDocumentsDownloadButton({
|
|||||||
const [download, setDownload] = useState(null);
|
const [download, setDownload] = useState(null);
|
||||||
const imagesToDownload = [
|
const imagesToDownload = [
|
||||||
...galleryImages.images.filter((image) => image.isSelected),
|
...galleryImages.images.filter((image) => image.isSelected),
|
||||||
...galleryImages.other.filter((image) => image.isSelected),
|
// ...galleryImages.other.filter((image) => image.isSelected),
|
||||||
];
|
];
|
||||||
|
|
||||||
const handleDownload = () => {
|
const handleDownload = () => {
|
||||||
logImEXEvent("jobs_documents_download");
|
logImEXEvent("jobs_documents_download");
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post("/media/download", {
|
.post("/media/download", {
|
||||||
ids: imagesToDownload.map((_) => _.key),
|
ids: imagesToDownload.map((_) => _.key),
|
||||||
@@ -27,12 +27,8 @@ export default function JobsDocumentsDownloadButton({
|
|||||||
// window.open(r.data);
|
// window.open(r.data);
|
||||||
downloadAs(
|
downloadAs(
|
||||||
r.data,
|
r.data,
|
||||||
`${identifier || "images"}.zip`,
|
`${identifier || "documents"}.zip`,
|
||||||
(progressEvent) => {
|
(progressEvent) => {
|
||||||
const percentage = Math.round(
|
|
||||||
(progressEvent.loaded * 100) / progressEvent.total
|
|
||||||
);
|
|
||||||
console.log(progressEvent, percentage);
|
|
||||||
setDownload((currentDownloadState) => {
|
setDownload((currentDownloadState) => {
|
||||||
return {
|
return {
|
||||||
downloaded: progressEvent.loaded || 0,
|
downloaded: progressEvent.loaded || 0,
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ function JobsDocumentsComponent({
|
|||||||
isSelected: false,
|
isSelected: false,
|
||||||
key: value.key,
|
key: value.key,
|
||||||
extension: value.extension,
|
extension: value.extension,
|
||||||
|
|
||||||
id: value.id,
|
id: value.id,
|
||||||
type: value.type,
|
type: value.type,
|
||||||
size: value.size,
|
size: value.size,
|
||||||
@@ -74,7 +75,8 @@ function JobsDocumentsComponent({
|
|||||||
|
|
||||||
const fileName = value.key.split("/").pop();
|
const fileName = value.key.split("/").pop();
|
||||||
acc.other.push({
|
acc.other.push({
|
||||||
src: GenerateSrcUrl(value),
|
source: GenerateSrcUrl(value),
|
||||||
|
src: "",
|
||||||
thumbnail: thumb,
|
thumbnail: thumb,
|
||||||
tags: [
|
tags: [
|
||||||
{
|
{
|
||||||
@@ -100,6 +102,7 @@ function JobsDocumentsComponent({
|
|||||||
thumbnailHeight: 225,
|
thumbnailHeight: 225,
|
||||||
thumbnailWidth: 225,
|
thumbnailWidth: 225,
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
|
|
||||||
extension: value.extension,
|
extension: value.extension,
|
||||||
key: value.key,
|
key: value.key,
|
||||||
id: value.id,
|
id: value.id,
|
||||||
@@ -211,7 +214,7 @@ function JobsDocumentsComponent({
|
|||||||
}}
|
}}
|
||||||
onClickThumbnail={(index) => {
|
onClickThumbnail={(index) => {
|
||||||
window.open(
|
window.open(
|
||||||
galleryImages.other[index].src,
|
galleryImages.other[index].source,
|
||||||
"_blank",
|
"_blank",
|
||||||
"toolbar=0,location=0,menubar=0"
|
"toolbar=0,location=0,menubar=0"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -677,7 +677,7 @@
|
|||||||
"documents": {
|
"documents": {
|
||||||
"actions": {
|
"actions": {
|
||||||
"delete": "Delete Selected Documents",
|
"delete": "Delete Selected Documents",
|
||||||
"download": "Download Selected Documents",
|
"download": "Download Selected Images",
|
||||||
"reassign": "Reassign to another Job",
|
"reassign": "Reassign to another Job",
|
||||||
"selectallimages": "Select All Images",
|
"selectallimages": "Select All Images",
|
||||||
"selectallotherdocuments": "Select All Other Documents"
|
"selectallotherdocuments": "Select All Other Documents"
|
||||||
|
|||||||
Reference in New Issue
Block a user