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
2 changes: 1 addition & 1 deletion .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
name: Build and push
uses: docker/build-push-action@v3
with:
context: ./frontend
context: ./backend
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/datasets/Dataset.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useEffect, useState} from "react";
import {Box, Button, Dialog, DialogTitle, Divider, Grid, Menu, MenuItem, Tab, Tabs, Typography} from "@mui/material";
import {Box, Button, Dialog, Divider, Grid, Menu, MenuItem, Tab, Tabs, Typography} from "@mui/material";
import {ClowderInput} from "../styledComponents/ClowderInput";
import {ClowderButton} from "../styledComponents/ClowderButton";
import ArrowDropDownIcon from "@mui/icons-material/ArrowDropDown";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/files/FileMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Button from '@mui/material/Button';
import Menu from '@mui/material/Menu';
import MenuItem from '@mui/material/MenuItem';
import MenuIcon from '@mui/icons-material/Menu';
import {File} from "../../types/data";
import {FileOut as File} from "../../openapi/v2";
import {useState} from "react";
import {fileDeleted, fileDownloaded} from "../../actions/file";
import {useDispatch} from "react-redux";
Expand Down
13 changes: 7 additions & 6 deletions frontend/src/components/files/FilesTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function FilesTable(props: FilesTableProps) {
const foldersInDataset = useSelector((state:RootState) => state.dataset.folders);
// use history hook to redirect/navigate between routes
const history = useNavigate();
const selectFile = (selectedFileId: string) => {
const selectFile = (selectedFileId: string | undefined) => {
// Redirect to file route with file Id and dataset id
history(`/files/${selectedFileId}?dataset=${props.datasetId}&name=${props.datasetName}`);
};
Expand All @@ -48,8 +48,8 @@ export default function FilesTable(props: FilesTableProps) {
<TableRow>
<TableCell>Name</TableCell>
<TableCell align="right">Updated</TableCell>
<TableCell align="right">Size</TableCell>
<TableCell align="right">Type</TableCell>
{/*<TableCell align="right">Size</TableCell>*/}
{/*<TableCell align="right">Type</TableCell>*/}
<TableCell align="right"></TableCell>
</TableRow>
</TableHead>
Expand Down Expand Up @@ -80,11 +80,12 @@ export default function FilesTable(props: FilesTableProps) {
<InsertDriveFileIcon color="primary" sx={iconStyle}/>
<Button onClick={() => selectFile(file.id)}>{file.name}</Button>
{/*TODO this should be version number; for now put version ID instead*/}
<VersionChip versionNumber={file.version_id.slice(0,2)}/>
<VersionChip versionNumber={file.version_num}/>
</TableCell>
<TableCell align="right">{parseDate(file.created)} by {file.creator.first_name} {file.creator.last_name}</TableCell>
<TableCell align="right">{file.size}</TableCell>
<TableCell align="right">{file.contentType}</TableCell>
{/*TODO we don't have those in backend yet*/}
{/*<TableCell align="right">{file.size}</TableCell>*/}
{/*<TableCell align="right">{file.contentType}</TableCell>*/}
<TableCell align="right"><FileMenu file={file}/></TableCell>
</TableRow>))
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/metadata/DisplayMetadata.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useState} from "react";
import React, {useEffect} from "react";
import {Box, Typography} from "@mui/material";
import metadataConfig from "../../metadata.config";
import {useSelector, useDispatch} from "react-redux";
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/components/versions/FileVersionHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from "react";
import {Box, Button, List, ListItem, ListItemAvatar, ListItemText} from "@mui/material";
import {FileVersion} from "../../types/data";
import MoreHorizIcon from '@mui/icons-material/MoreHoriz';
import {Box, List, ListItem, ListItemAvatar, ListItemText} from "@mui/material";
import {VersionChip} from "./VersionChip";
import {parseDate} from "../../utils/common";
import {FileVersion} from "../../openapi/v2";

type FileVersionHistoryProps = {
fileVersions: FileVersion[]
Expand All @@ -17,23 +16,24 @@ export function FileVersionHistory(props: FileVersionHistoryProps) {
{
// sort by date decending
fileVersions.map((fileVersion) => {
const {version_id, creator, created} = fileVersion;
const {version_num, creator, created} = fileVersion;
return (

<List dense={true}>
<ListItem>
<ListItemAvatar>
{/*TODO replace with pretty version name*/}
<VersionChip versionNumber={version_id.slice(0,2)}/>
<VersionChip versionNumber={version_num}/>
</ListItemAvatar>
<ListItemText
primary={`Uploaded by ${creator != null?
`${creator.first_name} ${creator.last_name}` : ""}`}
secondary={`Uploaded on ${parseDate(created)}`}
/>
<Button disabled>Download</Button>
<Button disabled>Delete</Button>
<Button disabled>Make Current</Button>
{/*TODO implement those actions*/}
{/*<Button disabled>Download</Button>*/}
{/*<Button disabled>Delete</Button>*/}
{/*<Button disabled>Make Current</Button>*/}
</ListItem>
</List>
);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/versions/VersionChip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import {Chip} from "@mui/material";


type VersionChipProps = {
versionNumber: string,
versionNumber: number|undefined,
}

export function VersionChip(props: VersionChipProps) {

const { versionNumber } = props;

return (
<Chip label={versionNumber}/>
<Chip label={`V${versionNumber}`}/>
// TODO can make this a clickable item
// <Chip label={`V${versionNumber}`} component="a" href="/" clickable/> : <></>
);
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/reducers/dataset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
} from "../actions/dataset";
import {CREATE_FILE, UPDATE_FILE, DELETE_FILE} from "../actions/file";
import {DataAction} from "../types/action";
import {Author, Dataset, File, DatasetState} from "../types/data";
import {Author, Dataset, DatasetState} from "../types/data";
import {FileOut as File} from "../openapi/v2";

const defaultState: DatasetState = {
files: [],
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/types/action.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import {Dataset, ExtractedMetadata, File, MetadataJsonld, FilePreview, FileVersion, Folder} from "./data";
import {MetadataOut as Metadata, FileOut as FileSummary} from "../openapi/v2";
import {Dataset, ExtractedMetadata, MetadataJsonld, FilePreview, Folder} from "./data";
import {MetadataOut as Metadata, FileOut as FileSummary, FileVersion} from "../openapi/v2";
import {MetadataDefinitionOut as MetadataDefinition} from "../openapi/v2";
import {POST_DATASET_METADATA, UPDATE_DATASET_METADATA} from "../actions/metadata";

interface RECEIVE_FILES_IN_DATASET {
type: "RECEIVE_FILES_IN_DATASET";
files: File[];
files: FileSummary[];
}

interface DELETE_FILE {
type: "DELETE_FILE";
file: File;
file: FileSummary;
}

interface RECEIVE_DATASET_ABOUT{
Expand Down Expand Up @@ -84,7 +84,7 @@ interface CREATE_DATASET{

interface CREATE_FILE{
type: "CREATE_FILE",
file: File
file: FileSummary
}

interface FAILED{
Expand Down
28 changes: 6 additions & 22 deletions frontend/src/types/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {MetadataDefinitionOut, MetadataOut as Metadata, FileOut as FileSummary} from "../openapi/v2";
import {MetadataDefinitionOut,
MetadataOut as Metadata,
FileOut as FileSummary,
FileVersion} from "../openapi/v2";

export interface Dataset {
name: string;
Expand All @@ -22,17 +25,6 @@ export interface Author {
"last_name": string|null;
}

export interface File {
version: string;
creator: Author;
created: string | Date;
id: string;
name: string;
size: number;
"date-created": string;
contentType:string;
}

export interface Folder {
id: string;
name: string;
Expand All @@ -55,14 +47,6 @@ export interface FileMetadata {
version: string;
}

export interface FileVersion {
id: string;
"version_id": string;
"file_id": string;
"creator": Author;
"created": string | Date;
}

export interface FileMetadataList{
id: string;
metadata: FileMetadata;
Expand Down Expand Up @@ -131,10 +115,10 @@ export interface Thumbnail{
}

export interface DatasetState{
files: File[];
files: FileSummary[];
datasets: Dataset[];
newDataset: Dataset;
newFile: File;
newFile: FileSummary;
about: Dataset;
folders: Folder[];
folderPath: string[];
Expand Down