IO-2086 Improved local media image display.
This commit is contained in:
@@ -13704,6 +13704,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>optimizedimage</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>reassign_limitexceeded</name>
|
<name>reassign_limitexceeded</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { SyncOutlined, FileExcelFilled } from "@ant-design/icons";
|
import { SyncOutlined, FileExcelFilled } from "@ant-design/icons";
|
||||||
import { Button, Card, Space } from "antd";
|
import { Alert, Button, Card, Space } from "antd";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import Gallery from "react-grid-gallery";
|
import Gallery from "react-grid-gallery";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -58,7 +58,7 @@ export function JobsDocumentsLocalGallery({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [job, invoice_number, getJobMedia, getBillMedia]);
|
}, [job, invoice_number, getJobMedia, getBillMedia]);
|
||||||
|
let optimized;
|
||||||
const jobMedia =
|
const jobMedia =
|
||||||
allMedia && allMedia[job.id]
|
allMedia && allMedia[job.id]
|
||||||
? allMedia[job.id].reduce(
|
? allMedia[job.id].reduce(
|
||||||
@@ -68,7 +68,11 @@ export function JobsDocumentsLocalGallery({
|
|||||||
val.type.mime &&
|
val.type.mime &&
|
||||||
val.type.mime.startsWith("image")
|
val.type.mime.startsWith("image")
|
||||||
) {
|
) {
|
||||||
acc.images.push(val);
|
acc.images.push({
|
||||||
|
...val,
|
||||||
|
...(val.optimized && { src: val.optimized, fullsize: val.src }),
|
||||||
|
});
|
||||||
|
if (val.optimized) optimized = true;
|
||||||
} else {
|
} else {
|
||||||
acc.other.push({
|
acc.other.push({
|
||||||
...val,
|
...val,
|
||||||
@@ -80,6 +84,11 @@ export function JobsDocumentsLocalGallery({
|
|||||||
{ images: [], other: [] }
|
{ images: [], other: [] }
|
||||||
)
|
)
|
||||||
: { images: [], other: [] };
|
: { images: [], other: [] };
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: jobs-documents-local-gallery.container.jsx ~ line 63 ~ jobMedia",
|
||||||
|
jobMedia
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
@@ -119,9 +128,22 @@ export function JobsDocumentsLocalGallery({
|
|||||||
onSelectImage={(index, image) => {
|
onSelectImage={(index, image) => {
|
||||||
toggleMediaSelected({ jobid: job.id, filename: image.filename });
|
toggleMediaSelected({ jobid: job.id, filename: image.filename });
|
||||||
}}
|
}}
|
||||||
|
{...(optimized && {
|
||||||
|
customControls: [
|
||||||
|
<Alert
|
||||||
|
style={{ margin: "4px" }}
|
||||||
|
message={t("documents.labels.optimizedimage")}
|
||||||
|
type="success"
|
||||||
|
/>,
|
||||||
|
],
|
||||||
|
})}
|
||||||
onClickImage={(props) => {
|
onClickImage={(props) => {
|
||||||
|
const media = allMedia[job.id].find(
|
||||||
|
(m) => m.optimized === props.target.src
|
||||||
|
);
|
||||||
|
|
||||||
window.open(
|
window.open(
|
||||||
props.target.src,
|
media ? media.src : props.target.src,
|
||||||
"_blank",
|
"_blank",
|
||||||
"toolbar=0,location=0,menubar=0"
|
"toolbar=0,location=0,menubar=0"
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ export function* getJobMedia({ payload: jobid }) {
|
|||||||
thumbnail: normalizeUrl(
|
thumbnail: normalizeUrl(
|
||||||
`${localmediaserverhttp}/${d.thumbnail}`
|
`${localmediaserverhttp}/${d.thumbnail}`
|
||||||
),
|
),
|
||||||
|
...(d.optimized && {
|
||||||
|
optimized: normalizeUrl(
|
||||||
|
`${localmediaserverhttp}/${d.optimized}`
|
||||||
|
),
|
||||||
|
}),
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
key: idx,
|
key: idx,
|
||||||
};
|
};
|
||||||
@@ -50,6 +55,7 @@ export function* getJobMedia({ payload: jobid }) {
|
|||||||
thumbnail: normalizeUrl(
|
thumbnail: normalizeUrl(
|
||||||
`${localmediaserverhttp}/${d.thumbnail}`
|
`${localmediaserverhttp}/${d.thumbnail}`
|
||||||
),
|
),
|
||||||
|
|
||||||
isSelected: false,
|
isSelected: false,
|
||||||
key: idx,
|
key: idx,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -849,6 +849,7 @@
|
|||||||
"doctype": "Document Type",
|
"doctype": "Document Type",
|
||||||
"newjobid": "Assign to Job",
|
"newjobid": "Assign to Job",
|
||||||
"openinexplorer": "Open in Explorer",
|
"openinexplorer": "Open in Explorer",
|
||||||
|
"optimizedimage": "The below image is optimized. Click on the picture below to open in a new window and view it full size, or open it in explorer.",
|
||||||
"reassign_limitexceeded": "Reassigning all selected documents will exceed the job storage limit for your shop. ",
|
"reassign_limitexceeded": "Reassigning all selected documents will exceed the job storage limit for your shop. ",
|
||||||
"reassign_limitexceeded_title": "Unable to reassign document(s)",
|
"reassign_limitexceeded_title": "Unable to reassign document(s)",
|
||||||
"storageexceeded": "You've exceeded your storage limit for this job. Please remove documents, or increase your storage plan.",
|
"storageexceeded": "You've exceeded your storage limit for this job. Please remove documents, or increase your storage plan.",
|
||||||
|
|||||||
@@ -849,6 +849,7 @@
|
|||||||
"doctype": "",
|
"doctype": "",
|
||||||
"newjobid": "",
|
"newjobid": "",
|
||||||
"openinexplorer": "",
|
"openinexplorer": "",
|
||||||
|
"optimizedimage": "",
|
||||||
"reassign_limitexceeded": "",
|
"reassign_limitexceeded": "",
|
||||||
"reassign_limitexceeded_title": "",
|
"reassign_limitexceeded_title": "",
|
||||||
"storageexceeded": "",
|
"storageexceeded": "",
|
||||||
|
|||||||
@@ -849,6 +849,7 @@
|
|||||||
"doctype": "",
|
"doctype": "",
|
||||||
"newjobid": "",
|
"newjobid": "",
|
||||||
"openinexplorer": "",
|
"openinexplorer": "",
|
||||||
|
"optimizedimage": "",
|
||||||
"reassign_limitexceeded": "",
|
"reassign_limitexceeded": "",
|
||||||
"reassign_limitexceeded_title": "",
|
"reassign_limitexceeded_title": "",
|
||||||
"storageexceeded": "",
|
"storageexceeded": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user