Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions frontend/src/components/datasets/NewMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useSelector } from "react-redux";
import { RootState } from "../../types/data";
import { UploadFile } from "../files/UploadFile";
import { UploadFileMultiple } from "../files/UploadFileMultiple";
import {UploadFileDragAndDrop} from "../files/UploadFileDragAndDrop";
import { UploadFileDragAndDrop } from "../files/UploadFileDragAndDrop";
import UploadIcon from "@mui/icons-material/Upload";
import { Folder } from "@material-ui/icons";

Expand All @@ -30,8 +30,7 @@ export const NewMenu = (props: ActionsMenuProps): JSX.Element => {
const about = useSelector((state: RootState) => state.dataset.about);

const [anchorEl, setAnchorEl] = React.useState<Element | null>(null);
const [dragDropFiles, setDragDropFiles] =
React.useState<boolean>(false);
const [dragDropFiles, setDragDropFiles] = React.useState<boolean>(false);
const [newFolder, setNewFolder] = React.useState<boolean>(false);

const handleCloseNewFolder = () => {
Expand All @@ -55,7 +54,10 @@ export const NewMenu = (props: ActionsMenuProps): JSX.Element => {
maxWidth="lg"
aria-labelledby="form-dialog"
>
<UploadFileDragAndDrop selectedDatasetId={datasetId} folderId={folderId}/>
<UploadFileDragAndDrop
selectedDatasetId={datasetId}
folderId={folderId}
/>
</Dialog>

<CreateFolder
Expand Down
36 changes: 25 additions & 11 deletions frontend/src/components/files/File.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { VersionChip } from "../versions/VersionChip";
import RoleChip from "../auth/RoleChip";
import Typography from "@mui/material/Typography";
import { ClowderSelect } from "../styledComponents/ClowderSelect";
import { AuthWrapper } from "../auth/AuthWrapper";

export const File = (): JSX.Element => {
// path parameter
Expand Down Expand Up @@ -95,6 +96,9 @@ export const File = (): JSX.Element => {
);
const folderPath = useSelector((state: RootState) => state.folder.folderPath);
const fileRole = useSelector((state: RootState) => state.file.fileRole);
const datasetRole = useSelector(
(state: RootState) => state.dataset.datasetRole
);
const storageType = useSelector(
(state: RootState) => state.file.fileSummary.storage_type
);
Expand Down Expand Up @@ -343,14 +347,19 @@ export const File = (): JSX.Element => {
{...a11yProps(2)}
disabled={false}
/>
<Tab
icon={<BuildIcon />}
iconPosition="start"
sx={TabStyle}
label="Analysis"
{...a11yProps(3)}
disabled={false}
/>
<AuthWrapper
currRole={datasetRole.role}
allowedRoles={["owner", "editor"]}
>
<Tab
icon={<BuildIcon />}
iconPosition="start"
sx={TabStyle}
label="Analysis"
{...a11yProps(3)}
disabled={false}
/>
</AuthWrapper>
<Tab
icon={<HistoryIcon />}
iconPosition="start"
Expand Down Expand Up @@ -435,9 +444,14 @@ export const File = (): JSX.Element => {
version={fileSummary.version_num}
/>
</TabPanel>
<TabPanel value={selectedTabIndex} index={3}>
<Listeners fileId={fileId} datasetId={datasetId} />
</TabPanel>
<AuthWrapper
currRole={datasetRole.role}
allowedRoles={["owner", "editor"]}
>
<TabPanel value={selectedTabIndex} index={3}>
<Listeners fileId={fileId} datasetId={datasetId} />
</TabPanel>
</AuthWrapper>
<TabPanel value={selectedTabIndex} index={4}>
<ExtractionHistoryTab fileId={fileId} />
</TabPanel>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/files/FileUploadDrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default function FileUploadDrop(props: FileUploadDropProps) {
multiple
/>
<Typography className={classes.fileDropText}>
<br></br>
<br />
</Typography>
</div>
</FileDrop>
Expand Down
22 changes: 11 additions & 11 deletions frontend/src/components/files/UploadFileDragAndDrop.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useRef, useState} from "react";
import React, { useEffect, useRef, useState } from "react";

import {
Box,
Expand Down Expand Up @@ -35,7 +35,7 @@ type UploadFileDragAndDropProps = {
export const UploadFileDragAndDrop: React.FC<UploadFileDragAndDropProps> = (
props: UploadFileDragAndDropProps
) => {
const { selectedDatasetId, folderId} = props;
const { selectedDatasetId, folderId } = props;
const [selectedFiles, setSelectedFiles] = useState<File[]>([]);
const [metadataRequestForms, setMetadataRequestForms] = useState({});
const [allFilled, setAllFilled] = React.useState<boolean>(false);
Expand Down Expand Up @@ -87,22 +87,22 @@ export const UploadFileDragAndDrop: React.FC<UploadFileDragAndDropProps> = (
};

const onFileInputChange = (event) => {
const fileList : File[] = Array.from(event.target.files);
let newArray = selectedFiles.slice();
fileList.forEach(f => newArray.push(f));
const fileList: File[] = Array.from(event.target.files);
const newArray = selectedFiles.slice();
fileList.forEach((f) => newArray.push(f));
setSelectedFiles(newArray);
};

const onDrop = (fileList) => {
let newFileList : File[] = Array.from(fileList);
let newArray = selectedFiles.slice();
newFileList.forEach(f => newArray.push(f));
const newFileList: File[] = Array.from(fileList);
const newArray = selectedFiles.slice();
newFileList.forEach((f) => newArray.push(f));
setSelectedFiles(newArray);
};

const onDeleteClick = (element) => {
let newFileList : File[] = selectedFiles;
let newArray = newFileList.slice();
const newFileList: File[] = selectedFiles;
const newArray = newFileList.slice();
newArray.pop(element);
setSelectedFiles(newArray);
};
Expand Down Expand Up @@ -204,7 +204,7 @@ export const UploadFileDragAndDrop: React.FC<UploadFileDragAndDropProps> = (
Next
</Button>
</Grid>
<Grid xs={1}></Grid>
<Grid xs={1} />
</Grid>
</StepContent>
</Step>
Expand Down
22 changes: 11 additions & 11 deletions frontend/src/styles/Styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const FileDropStyle = {
};

export const FileDropInput = {
width: "95px"
width: "95px",
};

export const FileDropText = {
Expand All @@ -27,7 +27,7 @@ export const FileDropText = {
fontWeight: 500,
letterSpacing: 0,
lineHeight: "18px",
textAlign: "center"
textAlign: "center",
};
export const FileDropGroup = {
width: "92px",
Expand All @@ -41,11 +41,11 @@ export const DisplayFile = {
border: "1px solid #00619D",
backgroundColor: "#FFFFFF",
margin: "5px auto 0 auto",
display: "block"
display: "block",
};
export const DisplayFileItem = {
width: "100%",
height: "37px"
height: "37px",
};

export const DisplayFilename = {
Expand All @@ -56,14 +56,14 @@ export const DisplayFilename = {
letterSpacing: 0,
lineHeight: "18px",
padding: "9px 17px",
float: "left"
float: "left",
};
export const DeleteFileIcon = {
"height": "24px",
"width": "24px",
"float": "right",
"margin": "6px",
height: "24px",
width: "24px",
float: "right",
margin: "6px",
"&:hover": {
color: "#D63649"
}
color: "#D63649",
},
};