(null);
const [isMetaDataLoaded, setIsMetaDataLoaded] = useState(false);
const isVersioningApplied = isVersionedMode(versioningConfig.status);
- const bucketName = params.bucketName || "";
+ const bucketName = params.bucketName || "";
const pathSegment = location.pathname.split(`/browser/${bucketName}/`);
const internalPaths = pathSegment.length === 2 ? pathSegment[1] : "";
@@ -399,12 +322,6 @@ const ListObjects = () => {
}
}, [bucketName, selectedObjects, fetchMetadata]);
- useEffect(() => {
- dispatch(setSearchObjects(""));
- dispatch(setLoadingObjects(true));
- dispatch(setSelectedObjects([]));
- }, [simplePath, dispatch]);
-
useEffect(() => {
if (rewindEnabled) {
if (bucketToRewind !== bucketName) {
@@ -414,8 +331,6 @@ const ListObjects = () => {
}
}, [rewindEnabled, bucketToRewind, bucketName, dispatch]);
- // END OF WS HANDLERS
-
useEffect(() => {
if (folderUpload.current !== null) {
folderUpload.current.setAttribute("directory", "");
@@ -477,11 +392,11 @@ const ListObjects = () => {
if (
selectedObjects.length === 0 &&
selectedInternalPaths === null &&
- !loadingObjects
+ !requestInProgress
) {
dispatch(setObjectDetailsView(false));
}
- }, [selectedObjects, selectedInternalPaths, dispatch, loadingObjects]);
+ }, [selectedObjects, selectedInternalPaths, dispatch, requestInProgress]);
useEffect(() => {
if (!iniLoad) {
@@ -492,20 +407,19 @@ const ListObjects = () => {
// bucket info
useEffect(() => {
- if ((loadingObjects || loadingBucket) && !anonymousMode) {
+ if ((requestInProgress || loadingBucket) && !anonymousMode) {
api.buckets
.bucketInfo(bucketName)
.then((res) => {
dispatch(setBucketDetailsLoad(false));
dispatch(setBucketInfo(res.data));
- dispatch(setSelectedBucket(bucketName));
})
.catch((err) => {
dispatch(setBucketDetailsLoad(false));
dispatch(setErrorSnackMessage(errorToHandler(err)));
});
}
- }, [bucketName, loadingBucket, dispatch, anonymousMode, loadingObjects]);
+ }, [bucketName, loadingBucket, dispatch, anonymousMode, requestInProgress]);
// Load retention Config
@@ -528,7 +442,7 @@ const ListObjects = () => {
if (refresh) {
dispatch(setSnackBarMessage(`Objects deleted successfully.`));
dispatch(setSelectedObjects([]));
- dispatch(setLoadingObjects(true));
+ dispatch(setReloadObjectsList(true));
}
};
@@ -544,7 +458,7 @@ const ListObjects = () => {
e.preventDefault();
var newFiles: File[] = [];
- for (var i = 0; i < e.target.files.length; i++) {
+ for (let i = 0; i < e.target.files.length; i++) {
newFiles.push(e.target.files[i]);
}
uploadObject(newFiles, "");
@@ -637,7 +551,7 @@ const ListObjects = () => {
};
xhr.withCredentials = false;
- xhr.onload = function (event) {
+ xhr.onload = function () {
// resolve promise only when HTTP code is ok
if (xhr.status >= 200 && xhr.status < 300) {
dispatch(completeObject(identity));
@@ -669,7 +583,7 @@ const ListObjects = () => {
}
};
- xhr.upload.addEventListener("error", (event) => {
+ xhr.upload.addEventListener("error", () => {
reject(errorMessage);
dispatch(
failObject({
@@ -703,7 +617,7 @@ const ListObjects = () => {
};
xhr.onloadend = () => {
if (files.length === 0) {
- dispatch(setLoadingObjects(true));
+ dispatch(setReloadObjectsList(true));
}
};
xhr.onabort = () => {
@@ -756,8 +670,7 @@ const ListObjects = () => {
dispatch(setErrorSnackMessage(err));
}
// We force objects list reload after all promises were handled
- dispatch(setLoadingObjects(true));
- dispatch(setSelectedObjects([]));
+ dispatch(setReloadObjectsList(true));
});
};
@@ -771,14 +684,13 @@ const ListObjects = () => {
if (acceptedFiles && acceptedFiles.length > 0 && canUpload) {
let newFolderPath: string = acceptedFiles[0].path;
//Should we filter by allowed file extensions if any?.
- let allowedFiles = [];
+ let allowedFiles = acceptedFiles;
+
if (allowedFileExtensions.length > 0) {
allowedFiles = acceptedFiles.filter((file) => {
const fileExtn = extractFileExtn(file.name);
return allowedFileExtensions.includes(fileExtn);
});
- } else {
- allowedFiles = acceptedFiles;
}
if (allowedFiles.length) {
@@ -885,10 +797,9 @@ const ListObjects = () => {
}
dispatch(setObjectDetailsView(false));
- dispatch(setSelectedObjects([]));
if (forceRefresh) {
- dispatch(setLoadingObjects(true));
+ dispatch(setReloadObjectsList(true));
}
};
@@ -1049,7 +960,7 @@ const ListObjects = () => {
)}
-
+
@@ -1059,9 +970,18 @@ const ListObjects = () => {
title={bucketName}
subTitle={
!anonymousMode ? (
-
-
- Created on:
+
+
+ Created on:
{bucketInfo?.creation_date
? createdTime.toFormat(
@@ -1070,13 +990,13 @@ const ListObjects = () => {
: ""}
-
- Access:
+
+ Access:
{bucketInfo?.access || ""}
{bucketInfo && (
-
+
{bucketInfo.size && (
{niceBytesInt(bucketInfo.size)}
)}
@@ -1098,7 +1018,7 @@ const ListObjects = () => {
)}
-
+
) : null
}
actions={
@@ -1114,7 +1034,7 @@ const ListObjects = () => {
color="secondary"
variant="dot"
invisible={!rewindEnabled}
- className={classes.badgeOverlap}
+ className={""}
sx={{ height: 16 }}
>
{
dispatch(setLoadingVersions(true));
} else {
dispatch(resetMessages());
- dispatch(setLoadingRecords(true));
- dispatch(setLoadingObjects(true));
+ dispatch(setReloadObjectsList(true));
}
}}
disabled={
@@ -1204,17 +1123,24 @@ const ListObjects = () => {
}
bottomBorder={false}
/>
-
+
-
{versionsMode ? (
@@ -1237,37 +1163,52 @@ const ListObjects = () => {
{!anonymousMode && (
-
+
-
-
+
)
}
hidePathButton={false}
/>
)}
-
+
)}
@@ -1285,7 +1226,7 @@ const ListObjects = () => {
closePanel={() => {
onClosePanel(false);
}}
- className={`${versionsMode ? classes.hideListOnSmall : ""}`}
+ className={`${versionsMode ? "hideListOnSmall" : ""}`}
>
{selectedObjects.length > 0 && (
{
)}
-
+