@bindu-dashing/dam-solution-v2 5.8.98 → 5.8.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -39,6 +39,8 @@ const TbStarIcon = TbStar;
|
|
|
39
39
|
const BsThreeDotsVerticalIcon = BsThreeDotsVertical;
|
|
40
40
|
const AiOutlineHistoryIcon = AiOutlineHistory;
|
|
41
41
|
function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSelection, readOnly = false, fileModal = false, }) {
|
|
42
|
+
// Debug: log props to trace where file becomes undefined
|
|
43
|
+
console.log("## FileMenuOptions render - file:", file, "fileIds:", fileIds, "folderIds:", folderIds);
|
|
42
44
|
const damConfig = useDamConfig();
|
|
43
45
|
const { rootFolderId, appType, isAdmin } = damConfig;
|
|
44
46
|
const { folderId, type } = useAppParams();
|
|
@@ -194,12 +196,24 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
194
196
|
},
|
|
195
197
|
});
|
|
196
198
|
const onDownloadFile = () => {
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
// Debug logging
|
|
200
|
+
// Build fileIds list - use file._id if file exists, otherwise use fileIds prop
|
|
201
|
+
const fileIdsList = file && get(file, "_id") ? [get(file, "_id")] : fileIds;
|
|
202
|
+
const downloadUrl = get(file, "downloadUrl") || get(file, "s3Url") || get(file, "thumbnailUrl");
|
|
203
|
+
const isSingleFile = get(fileIdsList, "length", 0) === 1 && get(folderIds, "length", 0) === 0;
|
|
204
|
+
console.log("## onDownloadFile - downloadUrl:", downloadUrl, "isSingleFile:", isSingleFile, "fileIdsList:", fileIdsList);
|
|
205
|
+
// If single file with downloadUrl available, open directly in new tab
|
|
206
|
+
if (isSingleFile && downloadUrl) {
|
|
207
|
+
window.open(downloadUrl, "_blank");
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
// For multiple files/folders or when downloadUrl is not available, use API
|
|
211
|
+
downloadFileMutation.mutate({
|
|
212
|
+
fileIds: fileIdsList,
|
|
213
|
+
folderIds: folderIds,
|
|
214
|
+
api,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
203
217
|
};
|
|
204
218
|
const onFavSuccess = (message) => {
|
|
205
219
|
invalidateData(queryClient, generateFoldersQueryKey(type), folderId ? folderId : rootFolderId);
|
|
@@ -15,10 +15,12 @@ const FileDetailsHeader = ({ handleClose, file, onCloseSelection, }) => {
|
|
|
15
15
|
const damConfig = useDamConfig();
|
|
16
16
|
const { isAdmin } = damConfig;
|
|
17
17
|
const { id, type } = useAppParams();
|
|
18
|
-
return (_jsxs("div", { className: "md-lib-bg-white dark:md-lib-bg-darkPrimaryHoverColor md-lib-py-3 md-lib-px-5 md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex md-lib-justify-between md-lib-items-center", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-5", children: [!id && type !== DriveModes.FILE && (_jsx(IoIosCloseIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-cursor-pointer", size: 24, onClick: handleClose })), !!file && (_jsx("h4", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-truncate md-lib-max-w-[calc(100vw-180px)]", title: get(file, "name", "N/A"), children: get(file, "name", "N/A") }))] }), !!file && (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4", children: [_jsx(FileMenuOptions, { file: file, onCloseSelection: onCloseSelection, fileModal: true }), _jsx(Button, { size: "large", className: "md-lib-bg-secondaryColor dark:md-lib-bg-darkSecondaryColor hover:md-lib-bg-secondaryHoverColor dark:hover:md-lib-bg-darkSecondaryColor md-lib-border-none", onClick: () => {
|
|
19
|
-
const url = get(file, "downloadUrl");
|
|
20
|
-
if (!url)
|
|
18
|
+
return (_jsxs("div", { className: "md-lib-bg-white dark:md-lib-bg-darkPrimaryHoverColor md-lib-py-3 md-lib-px-5 md-lib-border-b md-lib-border-borderColor dark:md-lib-border-darkBorderColor md-lib-flex md-lib-justify-between md-lib-items-center", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-5", children: [!id && type !== DriveModes.FILE && (_jsx(IoIosCloseIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-cursor-pointer", size: 24, onClick: handleClose })), !!file && (_jsx("h4", { className: "md-lib-font-semibold md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-text-base md-lib-truncate md-lib-max-w-[calc(100vw-180px)]", title: get(file, "name", "N/A"), children: get(file, "name", "N/A") }))] }), !!file && (_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-4", children: [_jsx(FileMenuOptions, { file: file, fileIds: get(file, "_id") ? [get(file, "_id")] : [], onCloseSelection: onCloseSelection, fileModal: true }), _jsx(Button, { size: "large", className: "md-lib-bg-secondaryColor dark:md-lib-bg-darkSecondaryColor hover:md-lib-bg-secondaryHoverColor dark:hover:md-lib-bg-darkSecondaryColor md-lib-border-none", onClick: () => {
|
|
19
|
+
const url = get(file, "downloadUrl") || get(file, "s3Url") || get(file, "thumbnailUrl");
|
|
20
|
+
if (!url) {
|
|
21
21
|
showNotification(INVALID_URL, NotificationStatus.ERROR);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
22
24
|
window.open(url, "_blank");
|
|
23
25
|
}, children: _jsx(BsDownloadIcon, { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor", size: 24 }) })] }))] }));
|
|
24
26
|
};
|