@bindu-dashing/dam-solution-v2 5.8.109 → 5.8.112
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.
- package/build/MyDrive/AddDrive.js +7 -3
- package/build/MyDrive/AddFolder.js +5 -21
- package/build/MyDrive/FileMenuOptions.js +13 -12
- package/build/MyDrive/fileDetails/FileViewer.js +1 -1
- package/build/MyDrive/files/MapFile.d.ts +1 -1
- package/build/MyDrive/files/MapFile.js +3 -3
- package/package.json +1 -1
|
@@ -58,8 +58,9 @@ const AddDrive = ({ parentFolderId }) => {
|
|
|
58
58
|
showGenerateThumbnails: false,
|
|
59
59
|
});
|
|
60
60
|
const { openFolderModal, openMapFile, uploading, filesList, showUploadStatus, uploadStatusList, openBlukUploadModal, showGenerateThumbnails, } = state;
|
|
61
|
-
const toggleOpenMapFile = (files = []) => {
|
|
62
|
-
|
|
61
|
+
const toggleOpenMapFile = (files = [], shouldDelete = false) => {
|
|
62
|
+
var _a;
|
|
63
|
+
if (openMapFile && shouldDelete && ((_a = filesList === null || filesList === void 0 ? void 0 : filesList[0]) === null || _a === void 0 ? void 0 : _a.filePath)) {
|
|
63
64
|
try {
|
|
64
65
|
api.delete(DELETE_S3_FILE_URL.replace(":path", filesList === null || filesList === void 0 ? void 0 : filesList[0].filePath));
|
|
65
66
|
}
|
|
@@ -69,6 +70,9 @@ const AddDrive = ({ parentFolderId }) => {
|
|
|
69
70
|
}
|
|
70
71
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { openMapFile: !prevState.openMapFile, filesList: files, showUploadStatus: false })));
|
|
71
72
|
};
|
|
73
|
+
const handleMapFileCancel = (shouldDelete = false) => {
|
|
74
|
+
toggleOpenMapFile([], shouldDelete);
|
|
75
|
+
};
|
|
72
76
|
const toggleFolderModal = () => {
|
|
73
77
|
setState((prevState) => (Object.assign(Object.assign({}, prevState), { openFolderModal: !prevState.openFolderModal })));
|
|
74
78
|
};
|
|
@@ -166,6 +170,6 @@ const AddDrive = ({ parentFolderId }) => {
|
|
|
166
170
|
},
|
|
167
171
|
];
|
|
168
172
|
const toggleGenerateThumbnails = () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showGenerateThumbnails: !prevState.showGenerateThumbnails })));
|
|
169
|
-
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-flex md-lib-gap-3", children: [_jsx(CustomButton, { label: "Generate Thumbnails", icon: _jsx(RiGalleryLineIcon, {}), size: "large", onClick: toggleGenerateThumbnails }), _jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsxs(Button, { icon: _jsx(GoPlusIcon, { size: 16 }), type: "primary", size: "large", children: ["Add ", _jsx(MdKeyboardArrowDownIconIcon, {})] }) })] }), _jsx("input", { ref: fileInputRef, type: "file", style: { display: 'none' }, onChange: handleNativeFileUpload }), openFolderModal && (_jsx(AddFolder, { open: openFolderModal, handleCancel: toggleFolderModal, parentFolderId: currentFolderId })), openMapFile && (_jsx(MapFile, { open: openMapFile, handleCancel:
|
|
173
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "md-lib-flex md-lib-gap-3", children: [_jsx(CustomButton, { label: "Generate Thumbnails", icon: _jsx(RiGalleryLineIcon, {}), size: "large", onClick: toggleGenerateThumbnails }), _jsx(Dropdown, { menu: { items }, trigger: ["click"], placement: "bottomRight", children: _jsxs(Button, { icon: _jsx(GoPlusIcon, { size: 16 }), type: "primary", size: "large", children: ["Add ", _jsx(MdKeyboardArrowDownIconIcon, {})] }) })] }), _jsx("input", { ref: fileInputRef, type: "file", multiple: true, style: { display: 'none' }, onChange: handleNativeFileUpload }), openFolderModal && (_jsx(AddFolder, { open: openFolderModal, handleCancel: toggleFolderModal, parentFolderId: currentFolderId })), openMapFile && (_jsx(MapFile, { open: openMapFile, handleCancel: handleMapFileCancel, filesList: filesList, fromUpload: true, parentFolderId: currentFolderId })), showUploadStatus && (_jsx(UploadStatusModal, { open: showUploadStatus, statusList: uploadStatusList, onClose: () => setState((prevState) => (Object.assign(Object.assign({}, prevState), { showUploadStatus: false }))) })), openBlukUploadModal && (_jsx(BulkUploadModal, { toggleUpload: toggleFolderBulkModal, folderId: currentFolderId })), showGenerateThumbnails && (_jsx(BulkUploadModal, { toggleUpload: toggleGenerateThumbnails, thumbnailsOnly: true, folderId: currentFolderId }))] }));
|
|
170
174
|
};
|
|
171
175
|
export default AddDrive;
|
|
@@ -46,19 +46,11 @@ function AddFolder({ open, handleCancel, folder, file, onCloseSelection, fileMod
|
|
|
46
46
|
: yield api.post(FETCH_FOLDERS_URL, Object.assign(Object.assign({}, values), { teamIds: [], parentId: currentFolderId }));
|
|
47
47
|
if (folder || file) {
|
|
48
48
|
// ✅ update case
|
|
49
|
-
const
|
|
50
|
-
? get(response, "data.updatedFolder",
|
|
49
|
+
const updatedFolder = folder
|
|
50
|
+
? get(response, "data.updatedFolder", {})
|
|
51
51
|
: file
|
|
52
|
-
? get(response, "data.file", get(
|
|
52
|
+
? get(response, "data.file", Object.assign(Object.assign({}, file), { name: get(values, "name") }))
|
|
53
53
|
: {};
|
|
54
|
-
// Merge existing file/folder data with response data to preserve all fields
|
|
55
|
-
// This ensures we don't lose any properties if the API response is minimal
|
|
56
|
-
const existingEntity = folder || file || {};
|
|
57
|
-
const updatedFolder = Object.assign(Object.assign(Object.assign({}, existingEntity), responseData), {
|
|
58
|
-
// Ensure name is updated from form values
|
|
59
|
-
name: get(values, "name", get(responseData, "name", get(existingEntity, "name"))),
|
|
60
|
-
// Ensure _id is always set
|
|
61
|
-
_id: get(responseData, "_id", get(existingEntity, "_id")) });
|
|
62
54
|
setFolders((prevFolders) => {
|
|
63
55
|
if (globalSearch) {
|
|
64
56
|
// Only update the matching folder (flat update)
|
|
@@ -82,16 +74,8 @@ function AddFolder({ open, handleCancel, folder, file, onCloseSelection, fileMod
|
|
|
82
74
|
return updateOrAddRecursively(prevFolders);
|
|
83
75
|
}
|
|
84
76
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
updateFoldersCacheOnUpdateFolder(queryClient, currentFolderId, updatedFolder, generateFoldersQueryKey(type));
|
|
88
|
-
// Invalidate file query cache
|
|
89
|
-
if (file) {
|
|
90
|
-
invalidateData(queryClient, QueryKeys.FILE, get(file, "_id"));
|
|
91
|
-
}
|
|
92
|
-
// Also invalidate the folders query cache to ensure UI updates immediately
|
|
93
|
-
// This ensures the list view refreshes with the updated name
|
|
94
|
-
invalidateData(queryClient, generateFoldersQueryKey(type), currentFolderId);
|
|
77
|
+
updateFoldersCacheOnUpdateFolder(queryClient, folderId ? folderId : rootFolderId, updatedFolder, generateFoldersQueryKey(type));
|
|
78
|
+
invalidateData(queryClient, QueryKeys.FILE, get(file, "_id"));
|
|
95
79
|
}
|
|
96
80
|
else {
|
|
97
81
|
// ✅ create case → take folder from response
|
|
@@ -187,8 +187,13 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
187
187
|
},
|
|
188
188
|
});
|
|
189
189
|
const onDuplicateFile = () => {
|
|
190
|
+
const fileToUse = effectiveFile;
|
|
191
|
+
if (!fileToUse || !get(fileToUse, "_id")) {
|
|
192
|
+
onFailure("File not found");
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
190
195
|
duplicateFileMutation.mutate({
|
|
191
|
-
fileIds: [get(
|
|
196
|
+
fileIds: [get(fileToUse, "_id")],
|
|
192
197
|
api,
|
|
193
198
|
});
|
|
194
199
|
};
|
|
@@ -302,17 +307,13 @@ function FileMenuOptions({ file, folderIds = [], fileIds = [], folder, onCloseSe
|
|
|
302
307
|
onClick: () => toggleDisplayUpdateName(),
|
|
303
308
|
disabled: isMultiSelection || !isAdmin,
|
|
304
309
|
},
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
// ),
|
|
313
|
-
// onClick: () => onDuplicateFile(),
|
|
314
|
-
// disabled: isMultiSelection || !isAdmin,
|
|
315
|
-
// },
|
|
310
|
+
{
|
|
311
|
+
key: FileActionsList.DUPLICATE,
|
|
312
|
+
label: "Duplicate",
|
|
313
|
+
icon: duplicateFileMutation.isLoading ? (_jsx(CustomLoader, {})) : (_jsx(IoDuplicateOutlineIcon, {})),
|
|
314
|
+
onClick: () => onDuplicateFile(),
|
|
315
|
+
disabled: isMultiSelection || !isAdmin,
|
|
316
|
+
},
|
|
316
317
|
{
|
|
317
318
|
key: FileActionsList.DELETE,
|
|
318
319
|
label: "Delete",
|
|
@@ -26,6 +26,6 @@ const FileViewer = ({ file, onNext, onPrev, hasNext, hasPrev, handleClose, }) =>
|
|
|
26
26
|
// children: <Compliance />,
|
|
27
27
|
// },
|
|
28
28
|
];
|
|
29
|
-
return (_jsx(Layout, { children: _jsxs(Content, { className: "md-lib-grid md-lib-grid-cols-3 md-lib-gap-2", children: [_jsx("div", { className: "md-lib-col-span-1 md:md-lib-col-span-2 md-lib-imageBg md-lib-bg-cover md-lib-bg-center md-lib-min-h-full md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor", children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev }) }), _jsx(MapFile, { fromUpload: false, filesList: file ? [file] : [], handleCancel: handleClose })] }) }));
|
|
29
|
+
return (_jsx(Layout, { children: _jsxs(Content, { className: "md-lib-grid md-lib-grid-cols-3 md-lib-gap-2", children: [_jsx("div", { className: "md-lib-col-span-1 md:md-lib-col-span-2 md-lib-imageBg md-lib-bg-cover md-lib-bg-center md-lib-min-h-full md-lib-flex md-lib-items-center md-lib-justify-center md-lib-relative md-lib-bg-textColorActive dark:md-lib-bg-darkSecondaryColor", children: _jsx(PreviewDetails, { file: file, hasNext: hasNext, hasPrev: hasPrev, onNext: onNext, onPrev: onPrev }) }), _jsx(MapFile, { fromUpload: false, filesList: file ? [file] : [], handleCancel: handleClose ? () => handleClose() : undefined })] }) }));
|
|
30
30
|
};
|
|
31
31
|
export default FileViewer;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FileEntity, ResponseFile } from "../../utilities/constants/interface";
|
|
2
2
|
declare function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, }: {
|
|
3
3
|
open?: boolean;
|
|
4
|
-
handleCancel?: () => void;
|
|
4
|
+
handleCancel?: (shouldDelete?: boolean) => void;
|
|
5
5
|
filesList: ResponseFile[] | FileEntity[];
|
|
6
6
|
fromUpload?: boolean;
|
|
7
7
|
parentFolderId?: string;
|
|
@@ -131,7 +131,7 @@ function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, })
|
|
|
131
131
|
return fileData;
|
|
132
132
|
}) }));
|
|
133
133
|
showNotification(get(response, "data.message", CREATE_SUCCESS), NotificationStatus.SUCCESS);
|
|
134
|
-
handleCancel && handleCancel();
|
|
134
|
+
handleCancel && handleCancel(false);
|
|
135
135
|
}
|
|
136
136
|
catch (error) {
|
|
137
137
|
showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
|
|
@@ -205,7 +205,7 @@ function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, })
|
|
|
205
205
|
};
|
|
206
206
|
const getMetadataForm = (_jsxs(Form, { layout: "vertical", form: form, scrollToFirstError: true, onFinish: fromUpload ? handleSubmit : handleUpdate, className: "md-lib-m-2", children: [_jsx(AssetSelectionFormItem, { handleAssetTemplateChange: handleAssetTemplateChange, assetOptions: assetOptions, assetsLoading: assetsLoading }), selectedAssetTemplate && (_jsxs(_Fragment, { children: [_jsx(Form.Item, { name: "teamIds", label: "Teams", children: _jsx(Select, { options: teamOptions, placeholder: "Select teams", mode: "multiple", onChange: (val) => onChangeTeams(val), style: { width: "100%" }, showSearch: true, optionFilterProp: "key" }) }), _jsx(Form.Item, { name: "expiryDate", label: "Expiry Date", children: _jsx(DatePicker, { placeholder: "Expiry Date", style: { width: "100%" } }) }), _jsx(Metadata, { asset: selectedAssetTemplate, form: form, file: (filesList === null || filesList === void 0 ? void 0 : filesList[0]) || null })] })), _jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-justify-end md-lib-gap-3", children: [_jsx(Button, { onClick: () => {
|
|
207
207
|
if (handleCancel) {
|
|
208
|
-
handleCancel();
|
|
208
|
+
handleCancel(true);
|
|
209
209
|
}
|
|
210
210
|
else if (navigate) {
|
|
211
211
|
// Navigate back if navigate function is available
|
|
@@ -214,6 +214,6 @@ function MapFile({ open, handleCancel, filesList, fromUpload, parentFolderId, })
|
|
|
214
214
|
}, children: "Cancel" }), _jsx(Button, { disabled: !selectedAssetTemplate, type: "primary",
|
|
215
215
|
// onClick={handleSubmit}
|
|
216
216
|
loading: loading || updateFileMutation.isLoading, htmlType: "submit", children: "Save" })] })] }));
|
|
217
|
-
return (_jsx(_Fragment, { children: fromUpload ? (_jsx(Drawer, { title: "Metadata", open: open, onClose: handleCancel, maskClosable: false, children: getMetadataForm })) : (_jsxs("div", { className: "md-lib-p-2 md-lib-overflow-y-scroll md-lib-max-h-[calc(100vh-65px)]", children: [_jsx("p", { className: "md-lib-text-lg md-lib-font-semibold", children: "Metadata" }), getMetadataForm] })) }));
|
|
217
|
+
return (_jsx(_Fragment, { children: fromUpload ? (_jsx(Drawer, { title: "Metadata", open: open, onClose: () => handleCancel && handleCancel(true), maskClosable: false, children: getMetadataForm })) : (_jsxs("div", { className: "md-lib-p-2 md-lib-overflow-y-scroll md-lib-max-h-[calc(100vh-65px)]", children: [_jsx("p", { className: "md-lib-text-lg md-lib-font-semibold", children: "Metadata" }), getMetadataForm] })) }));
|
|
218
218
|
}
|
|
219
219
|
export default MapFile;
|