Feat:Added the isUploading in the useEffect for re-rendering file table when new file/folder is uploaded
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import PropTypes from "prop-types";
|
import PropTypes from "prop-types";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
import { setCurrentPath } from "../store/pathSlice";
|
import { setCurrentPath } from "../store/pathSlice";
|
||||||
import {
|
import {
|
||||||
FileText,
|
FileText,
|
||||||
@@ -26,7 +26,7 @@ const FileTable = ({ initialPath }) => {
|
|||||||
const [currentPath, setCurrentPathState] = useState(initialPath || "/");
|
const [currentPath, setCurrentPathState] = useState(initialPath || "/");
|
||||||
const [files, setFiles] = useState([]);
|
const [files, setFiles] = useState([]);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const isUploading = useSelector((state) => state.upload.isUploading);
|
||||||
const getType = (entry) =>
|
const getType = (entry) =>
|
||||||
entry.trim().startsWith("📁") ? "Folder" : "File";
|
entry.trim().startsWith("📁") ? "Folder" : "File";
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ const FileTable = ({ initialPath }) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(setCurrentPath(currentPath));
|
dispatch(setCurrentPath(currentPath));
|
||||||
fetchFiles();
|
fetchFiles();
|
||||||
}, [currentPath]);
|
}, [currentPath, dispatch, isUploading]);
|
||||||
|
|
||||||
const handleOpenFolder = (folderName) => {
|
const handleOpenFolder = (folderName) => {
|
||||||
const newPath =
|
const newPath =
|
||||||
@@ -164,7 +164,10 @@ const FileTable = ({ initialPath }) => {
|
|||||||
);
|
);
|
||||||
if (match) downloadedFileName = match[1];
|
if (match) downloadedFileName = match[1];
|
||||||
}
|
}
|
||||||
|
console.log(
|
||||||
|
`${API_URL}/api/hdfs/downloadFile?hdfsEncPath=${hdfsPath}&localPath=${name}&username=${username}`,
|
||||||
|
authToken
|
||||||
|
);
|
||||||
const blob = await response.blob();
|
const blob = await response.blob();
|
||||||
const blobUrl = window.URL.createObjectURL(blob);
|
const blobUrl = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement("a");
|
const link = document.createElement("a");
|
||||||
|
|||||||
Reference in New Issue
Block a user