diff --git a/README.md b/README.md index 3213168a..5aabcbfb 100644 --- a/README.md +++ b/README.md @@ -49,3 +49,7 @@ action: 'import', }) trackPageView { documentTitle: route } + +## Acknowledgement + +This research was supported by the EBRAINS research infrastructure, funded from the European Union’s Horizon 2020 Framework Programme for Research and Innovation under the Specific Grant Agreement No. 945539 (Human Brain Project SGA3). diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index ba852bd6..8cda33d0 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -44,13 +44,16 @@ public function index() $csp->addAllowedFrameDomain('gpu1.thehip.app'); $csp->addAllowedFrameDomain('cpu1.thehip.app'); $csp->addAllowedFrameDomain('cpu2.thehip.app'); - $csp->addAllowedFrameDomain('hip-infrastructure.github.io'); $csp->addAllowedFrameDomain('backend.thehip.app'); $csp->addAllowedFrameDomain('iam.ebrains.eu'); $csp->addAllowedFrameDomain('iam-int.ebrains.eu'); $csp->addAllowedFrameDomain('hip.local:9001'); $csp->addAllowedFrameDomain('hip.collab.local:9001'); $csp->addAllowedFrameDomain('collab-dev.thehip.app'); + $csp->addAllowedFrameDomain('keycloak.thehip.app'); + $csp->addAllowedFrameDomain('id.thehip.app'); + $csp->addAllowedFrameDomain('dev.id.thehip.app'); + $csp->addAllowedFrameDomain('hip-infrastructure.github.io'); $csp->addAllowedConnectDomain('gpu1.thehip.app'); $csp->addAllowedConnectDomain('cpu1.thehip.app'); @@ -60,11 +63,12 @@ public function index() $csp->addAllowedConnectDomain('iam-int.ebrains.eu'); $csp->addAllowedConnectDomain('hip.local:9001'); $csp->addAllowedConnectDomain('hip.collab.local:9001'); - $csp->addAllowedConnectDomain('stats.humanbrainproject.eu'); $csp->addAllowedConnectDomain('collab-dev.thehip.app'); - - $csp->addAllowedScriptDomain('stats.humanbrainproject.eu'); - + $csp->addAllowedConnectDomain('keycloak.thehip.app'); + $csp->addAllowedConnectDomain('id.thehip.app'); + $csp->addAllowedConnectDomain('dev.id.thehip.app'); + $csp->addAllowedConnectDomain('stats.humanbrainproject.eu'); + $response->setContentSecurityPolicy($csp); return $response; diff --git a/src/App.tsx b/src/App.tsx index 0ed2cacb..d90351c1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3,10 +3,10 @@ import { Box, Typography } from '@mui/material' import CssBaseline from '@mui/material/CssBaseline' import { Outlet, Route, Routes } from 'react-router-dom' import './App.css' -import Admin from './components/Center/Admin' import AppList from './components/Documentation/AppList' -import Dataset from './components/BIDS/Dataset' -import Datasets from './components/BIDS/Datasets' +import Dataset from './components/UI/BIDS/Dataset' +import CenterDatasets from './components/Center/Datasets' +import PublicDatasets from './components/Public/Datasets' import Centers from './components/Centers' import CenterWorkspace from './components/Center/Workspace' import About from './components/Documentation/About' @@ -78,14 +78,13 @@ const App = () => ( } /> } /> } /> - } /> }> } /> } /> } /> } /> }> - } /> + } /> } /> @@ -103,6 +102,7 @@ const App = () => ( + }> { + const url = `${API_GATEWAY}/tools/bids/datasets/publish?path=${path}` + fetch(url, { + headers: { + 'Content-Type': 'application/json', + requesttoken: window.OC.requestToken, + }, + }) + .then(checkForError) + .catch(catchError) +} + export const createBidsDatasetsIndex = async () => { const url = `${API_GATEWAY}/tools/bids/datasets/create_index` fetch(url, { diff --git a/src/components/BIDS/DatasetCard.tsx b/src/components/BIDS/DatasetCard.tsx deleted file mode 100644 index baaf4d9f..00000000 --- a/src/components/BIDS/DatasetCard.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { - Card, - CardActions, - CardContent, - CardMedia, - Paper, - Typography, -} from '@mui/material' -import { NavLink, useParams } from 'react-router-dom' -import { BIDSDataset } from '../../api/types' -import { linkStyle, ROUTE_PREFIX } from '../../constants' -import DatasetInfo from './DatasetInfo' -import * as React from 'react' -import { nameToColor } from '../theme' - -const DatasetCard = ({ dataset }: { dataset: BIDSDataset }): JSX.Element => { - const params = useParams() - - return ( - <> - - - - {dataset?.Name} - - id: {dataset?.id} - - - Authors: {dataset?.Authors?.join(', ')} - - - - - - View - - - - - ) -} - -DatasetCard.displayName = 'DatasetCard' - -export default DatasetCard diff --git a/src/components/Center/Admin.tsx b/src/components/Center/Admin.tsx deleted file mode 100644 index 74e58d5a..00000000 --- a/src/components/Center/Admin.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { Box, Card, CardContent, CardMedia, Typography } from '@mui/material' -import FileBrowser from '../UI/FileBrowser' -import FileChooser from '../UI/FileChooser' -import TitleBar from '../UI/titleBar' -import * as React from 'react' - -const AdminCard = ({ - title, - description, - children, -}: { - title: string - description: string - children: JSX.Element -}): JSX.Element => ( - - - - - {title} - - - {description} - - {children} - - -) - -const Admin = () => ( - - - - - - UI DEMO WIDGETS - - - - - - - - - - - - -) - -export default Admin diff --git a/src/components/Center/Cards/DataCard.tsx b/src/components/Center/Cards/DataCard.tsx new file mode 100644 index 00000000..7ee4319f --- /dev/null +++ b/src/components/Center/Cards/DataCard.tsx @@ -0,0 +1,81 @@ +import * as React from 'react' +import { + Box, + Card, + CardContent, + CardMedia, + CircularProgress, + Typography, +} from '@mui/material' +import { BIDSDataset, Container } from '../../../api/types' +import { API_GATEWAY } from '../../../api/gatewayClientAPI' + +const DataCard = ({ + bidsDatasets, + sessions, +}: { + bidsDatasets?: BIDSDataset[] + sessions?: Container[] +}) => { + return ( + <> + {!bidsDatasets && ( + + )} + + + + + + Data + + + Private space for your center data. + + <> + + {sessions?.length} Opened desktop + + + + + {!bidsDatasets && } + {bidsDatasets?.reduce( + (a, b) => a + (b?.ParticipantsCount || 0), + 0 + )}{' '} + subjects in {''} + {bidsDatasets?.length} BIDS datasets + + + + + + + + ) +} + +export default DataCard diff --git a/src/components/Center/MainCard.tsx b/src/components/Center/Cards/MainCard.tsx similarity index 94% rename from src/components/Center/MainCard.tsx rename to src/components/Center/Cards/MainCard.tsx index dc36b8cb..e66abf9f 100644 --- a/src/components/Center/MainCard.tsx +++ b/src/components/Center/Cards/MainCard.tsx @@ -17,9 +17,9 @@ import { Link, Typography, } from '@mui/material' -import { HIPCenter } from '../../api/types' -import { linkStyle } from '../../constants' -import { API_GATEWAY } from '../../api/gatewayClientAPI' +import { HIPCenter } from '../../../api/types' +import { linkStyle } from '../../../constants' +import { API_GATEWAY } from '../../../api/gatewayClientAPI' const MainCard = ({ group }: { group?: HIPCenter }) => { const SocialButton = ({ network, url }: { network: string; url: string }) => { diff --git a/src/components/Center/Members.tsx b/src/components/Center/Cards/MembersCard.tsx similarity index 91% rename from src/components/Center/Members.tsx rename to src/components/Center/Cards/MembersCard.tsx index 4846465d..89be922f 100644 --- a/src/components/Center/Members.tsx +++ b/src/components/Center/Cards/MembersCard.tsx @@ -8,9 +8,9 @@ import { Stack, Typography, } from '@mui/material' -import { API_GATEWAY } from '../../api/gatewayClientAPI' -import { HIPCenter, User } from '../../api/types' -import UserInfo from '../UI/UserInfo' +import { API_GATEWAY } from '../../../api/gatewayClientAPI' +import { HIPCenter, User } from '../../../api/types' +import UserInfo from '../../UI/UserInfo' const Members = ({ group, users }: { group?: HIPCenter; users?: User[] }) => { return ( diff --git a/src/components/Center/Tools.tsx b/src/components/Center/Cards/ToolsCard.tsx similarity index 94% rename from src/components/Center/Tools.tsx rename to src/components/Center/Cards/ToolsCard.tsx index 6bd1532c..31902657 100644 --- a/src/components/Center/Tools.tsx +++ b/src/components/Center/Cards/ToolsCard.tsx @@ -9,8 +9,8 @@ import { Typography, } from '@mui/material' import * as React from 'react' -import { API_GATEWAY, scanUserFiles } from '../../api/gatewayClientAPI' -import { useAppStore } from '../../Store' +import { API_GATEWAY, scanUserFiles } from '../../../api/gatewayClientAPI' +import { useAppStore } from '../../../Store' const Tools = () => { const { diff --git a/src/components/Center/Datasets/index.tsx b/src/components/Center/Datasets/index.tsx new file mode 100644 index 00000000..6238c387 --- /dev/null +++ b/src/components/Center/Datasets/index.tsx @@ -0,0 +1,106 @@ +import * as React from 'react' +import Datasets from '../../UI/BIDS/Datasets' +import { + Button, + Checkbox, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + FormControlLabel, + Typography, +} from '@mui/material' +import { publishDatasetToPublicSpace } from '../../../api/bids' +import { BIDSDataset } from '../../../api/types' + +const DatasetsIndex = () => { + const [open, setOpen] = React.useState(false) + const [checked1, setChecked1] = React.useState(false) + const [checked2, setChecked2] = React.useState(false) + const [datasetPath, setDatasetPath] = React.useState('') + + const handleClickedDataset = (dataset: BIDSDataset) => { + setOpen(true) + setDatasetPath(dataset?.Path || '') + } + + const handleCheckedClicked = () => { + setOpen(false) + publishDatasetToPublicSpace(datasetPath) + + } + + const handleClose = () => { + setOpen(false) + } + + return ( + <> + + + Make Dataset Public + + + By making this dataset public, I agree to the following conditions: + I am the owner of this dataset and have any necessary ethics + permissions to share the data publicly. This dataset does not + include any identifiable personal health information as defined by + the Health Insurance Portability and Accountability Act of 1996 + (including names, zip codes, dates of birth, acquisition dates, + etc). I agree to destroy any key linking the personal identity of + research participants to the subject codes used in the dataset. I + agree that this dataset will become publicly available under a + Creative Commons CC0 license after a grace period of 36 months + counted from the date of the first snapshot creation for this + dataset. You will be able to apply for up to two 6 month extensions + to increase the grace period in case the publication of a + corresponding paper takes longer than expected. See FAQ for details. + This dataset is not subject to GDPR protections. Generally, data + should only be uploaded to a single data archive. In the rare cases + where it is necessary to upload the data to two databases (such as + the NIMH Data Archive), I agree to ensure that the datasets are + harmonized across archives. + + + + Please affirm one of the following + + + setChecked1(!checked1)} + /> + } + label='All structural scans have been defaced, obscuring any tissue on or + near the face that could potentially be used to reconstruct the + facial structure.' + /> + + setChecked2(!checked2)} + /> + } + label='I have explicit participant consent and ethical + authorization to publish structural scans without defacing.' + /> + + + + + + + + ) +} + +export default DatasetsIndex diff --git a/src/components/Center/Workspace.tsx b/src/components/Center/Workspace.tsx index 3b6aea59..bd1ae1cc 100644 --- a/src/components/Center/Workspace.tsx +++ b/src/components/Center/Workspace.tsx @@ -14,10 +14,10 @@ import { BIDSDataset, ContainerType, HIPCenter, User } from '../../api/types' import { useNotification } from '../../hooks/useNotification' import { useAppStore } from '../../Store' import TitleBar from '../UI/titleBar' -import Data from './Data' -import MainCard from './MainCard' -import Members from './Members' -import Tools from './Tools' +import DataCard from './Cards/DataCard' +import MainCard from './Cards/MainCard' +import MembersCard from './Cards/MembersCard' +import ToolsCard from './Cards/ToolsCard' import { linkStyle } from '../../constants' import { getAllBidsDataset } from '../../api/bids' import { API_GATEWAY } from '../../api/gatewayClientAPI' @@ -126,18 +126,18 @@ const Workspace = () => { <> {center && users && ( - u.groups?.includes(center.id))} /> )} - + {bidsDatasets && ( - + )} @@ -146,7 +146,7 @@ const Workspace = () => { <> {center && users && ( - u.groups?.includes(center.id))} /> diff --git a/src/components/Desktop/Desktop.tsx b/src/components/Desktop/Desktop.tsx index b68533a2..3117c843 100644 --- a/src/components/Desktop/Desktop.tsx +++ b/src/components/Desktop/Desktop.tsx @@ -118,7 +118,10 @@ const Desktop = (): JSX.Element => { // console.log(e) }) }, 1000) - return () => intervalRef.current && clearInterval(intervalRef.current) + return () => { + intervalRef.current && clearInterval(intervalRef.current) + intervalRef.current = undefined + } }, [desktop, desktopIsAlive]) useEffect(() => { diff --git a/src/components/Project/Dataset.tsx b/src/components/Project/Dataset.tsx index b31a6db5..58e4e43a 100644 --- a/src/components/Project/Dataset.tsx +++ b/src/components/Project/Dataset.tsx @@ -4,8 +4,8 @@ import React, { useEffect, useState } from 'react' import { getProjectMetadataTree } from '../../api/projects' import { InspectResult } from '../../api/types' import { useAppStore } from '../../Store' -import DatasetDescription from '../BIDS/DatasetDescription' -import DatasetInfo from '../BIDS/DatasetInfo' +import DatasetDescription from '../UI/BIDS/DatasetDescription' +import DatasetInfo from '../UI/BIDS/DatasetInfo' import MetadataBrowser from '../UI/MetadataBrowser' import TitleBar from '../UI/titleBar' import ParticipantsTab from './ParticipantsTab' diff --git a/src/components/Project/Files/FileBrowser.tsx b/src/components/Project/Files/FileBrowser.tsx index 5ad763cd..8444e969 100644 --- a/src/components/Project/Files/FileBrowser.tsx +++ b/src/components/Project/Files/FileBrowser.tsx @@ -10,7 +10,7 @@ import { } from '../../../api/gatewayClientAPI' import { ISearch, Node } from '../../../api/types' import { useAppStore } from '../../../Store' -import { DocumentSquare, MinusSquare, PlusSquare } from '../../UI/Icons' +import { MinusSquare, PlusSquare } from '../../UI/Icons' const StyledTreeItem = styled((props: TreeItemProps) => ( @@ -237,7 +237,6 @@ const FileBrowser = ({ defaultExpanded={[rootFile.path]} defaultCollapseIcon={} defaultExpandIcon={} - defaultEndIcon={} onNodeToggle={(_event, filesIds: string[]) => { const clickedId = filesIds[0] const directoryExists = files.find(f => f.parentPath === clickedId) diff --git a/src/components/Project/Files/MetadataBrowser.tsx b/src/components/Project/Files/MetadataBrowser.tsx index 2a60d47a..e1574398 100644 --- a/src/components/Project/Files/MetadataBrowser.tsx +++ b/src/components/Project/Files/MetadataBrowser.tsx @@ -4,7 +4,7 @@ import { alpha, styled } from '@mui/material/styles' import { useState } from 'react' import { InspectResult } from '../../../api/types' import React, { useEffect } from 'react' -import { MinusSquare, PlusSquare, DocumentSquare } from '../../UI/Icons' +import { MinusSquare, PlusSquare } from '../../UI/Icons' const StyledTreeItem = styled((props: TreeItemProps) => ( @@ -111,7 +111,6 @@ const MetadataBrowser = ({ defaultExpanded={[rootFile.relativePath]} defaultCollapseIcon={} defaultExpandIcon={} - defaultEndIcon={} onNodeToggle={(_event, filesIds: string[]) => { if (filesIds) setExpanded(filesIds) }} diff --git a/src/components/Project/index.tsx b/src/components/Project/index.tsx index 6c2b4065..2c113b6e 100644 --- a/src/components/Project/index.tsx +++ b/src/components/Project/index.tsx @@ -22,7 +22,7 @@ const Project = () => { setProject(null) }) } else setProject(project) - }, [params, project, setProject]) + }, [params, setProject,]) return } diff --git a/src/components/Projects/ProjectCard.tsx b/src/components/Projects/ProjectCard.tsx index d4c7c462..674393c2 100644 --- a/src/components/Projects/ProjectCard.tsx +++ b/src/components/Projects/ProjectCard.tsx @@ -12,7 +12,7 @@ import { import { HIPProject, User } from '../../api/types' import * as React from 'react' import UserInfo from '../UI/UserInfo' -import { useNavigate } from 'react-router-dom' +import { NavLink, useNavigate } from 'react-router-dom' import { ROUTE_PREFIX } from '../../constants' import { Link } from '@mui/icons-material' @@ -34,82 +34,73 @@ const ProjectCard = ({ project, users }: Props) => { ) return ( - - - - {project?.title} - + + + - {project?.title[0]} - - - - {`Owner: ${projectAdmins?.map(u => u.displayName).join(', ')}`} - + {project?.title} + + {project?.title[0]} + + + + {`Owner: ${projectAdmins?.map(u => u.displayName).join(', ')}`} + - - {project?.description} - - - - Members - {project?.members?.length === 0 && ( - No members yet - )} - {[...(project?.members ?? [])] - .map( - u => - users.find(user => user.id === u) ?? { - id: u, - name: u, - displayName: u, - } - ) + + {project?.description} + - .map(u => ( - - - - ))} - - - - - - navigate(`${ROUTE_PREFIX}/projects/${project.name}`)} + - - - Visit - - - + Members + {project?.members?.length === 0 && ( + No members yet + )} + {[...(project?.members ?? [])] + .map( + u => + users.find(user => user.id === u) ?? { + id: u, + name: u, + displayName: u, + } + ) + + .map(u => ( + + + + ))} + + + + + ) } diff --git a/src/components/Center/Data.tsx b/src/components/Public/Data.tsx similarity index 100% rename from src/components/Center/Data.tsx rename to src/components/Public/Data.tsx diff --git a/src/components/Public/Datasets.tsx b/src/components/Public/Datasets.tsx new file mode 100644 index 00000000..0d32c32d --- /dev/null +++ b/src/components/Public/Datasets.tsx @@ -0,0 +1,52 @@ +import * as React from 'react' +import Datasets from '../UI/BIDS/Datasets' +import { + Button, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, +} from '@mui/material' +import { BIDSDataset } from '../../api/types' +import { publishDatasetToPublicSpace } from '../../api/bids' + +const PublicDatasets = () => { + const [open, setOpen] = React.useState(false) + const [datasetPath, setDatasetPath] = React.useState('') + + const handleClickedDataset = (dataset: BIDSDataset) => { + setOpen(true) + setDatasetPath(dataset?.Path || '') + } + + const handleCheckedClicked = () => { + setOpen(false) + publishDatasetToPublicSpace(datasetPath) + + } + + const handleClose = () => { + setOpen(false) + } + + return ( + <> + + + Copy Dataset + + + This dataset is going to be copied in your personal space. + + + + + + + + + ) +} + +export default PublicDatasets diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index e0e2031f..a75fcce8 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -292,102 +292,100 @@ const Sidebar = () => { )} {userProjects?.map(project => ( - + { + handleClickNavigate(`/projects/${project.name}`) + handleProjectClick(project?.name) }} + selected={`${ROUTE_PREFIX}/projects/${project.name}` === pathname} > - { - handleClickNavigate(`/projects/${project.name}`) - handleProjectClick(project?.name) - }} - selected={ - `${ROUTE_PREFIX}/projects/${project.name}` === pathname - } - > - - - - - {openProjects[project.name] ? : } - - - - - handleClickNavigate(`/projects/${project.name}/desktops`) - } - > - - - - - - - handleClickNavigate(`/projects/${project.name}/transfer`) - } - > - - - - - - - handleClickNavigate(`/projects/${project.name}/metadata`) - } - > - - - - - - - handleClickNavigate(`/projects/${project.name}/datasets`) - } - > - - - - - - - - - - ))} + + + + + {openProjects[project.name] ? : } + + + + + handleClickNavigate(`/projects/${project.name}/desktops`) + } + > + + + + + + + handleClickNavigate(`/projects/${project.name}/transfer`) + } + > + + + + + + + handleClickNavigate(`/projects/${project.name}/metadata`) + } + > + + + + + + + handleClickNavigate(`/projects/${project.name}/datasets`) + } + > + + + + + + + + + + ))} { + + + handleClickNavigate('/public')} + > + + + + + + + + diff --git a/src/components/BIDS/Dataset.tsx b/src/components/UI/BIDS/Dataset.tsx similarity index 92% rename from src/components/BIDS/Dataset.tsx rename to src/components/UI/BIDS/Dataset.tsx index dd86dcb3..0a01cfe8 100644 --- a/src/components/BIDS/Dataset.tsx +++ b/src/components/UI/BIDS/Dataset.tsx @@ -13,18 +13,18 @@ import { import * as React from 'react' import { useEffect, useState } from 'react' import { useNavigate, useParams } from 'react-router-dom' -import { fileContent as getFileContent } from '../../api/gatewayClientAPI' -import { BIDSDataset } from '../../api/types' -import { useAppStore } from '../../Store' -import CSV2Table from '../UI/CSV2Table' -import FileBrowser from '../UI/FileBrowser' -import TitleBar from '../UI/titleBar' +import { fileContent as getFileContent } from '../../../api/gatewayClientAPI' +import { BIDSDataset } from '../../../api/types' +import { useAppStore } from '../../../Store' +import CSV2Table from '../../UI/CSV2Table' +import FileBrowser from '../../UI/FileBrowser' +import TitleBar from '../../UI/titleBar' import DatasetDescription from './DatasetDescription' import DatasetInfo from './DatasetInfo' import Import from './Import' import Participants from './Participants' -import { getAllBidsDataset } from '../../api/bids' -import { useNotification } from '../../hooks/useNotification' +import { getAllBidsDataset } from '../../../api/bids' +import { useNotification } from '../../../hooks/useNotification' const Dataset = () => { const [dataset, setDataset] = useState() diff --git a/src/components/UI/BIDS/DatasetCard.tsx b/src/components/UI/BIDS/DatasetCard.tsx new file mode 100644 index 00000000..a28f3a45 --- /dev/null +++ b/src/components/UI/BIDS/DatasetCard.tsx @@ -0,0 +1,63 @@ +import { + Button, + Card, + CardActions, + CardContent, + CardMedia, + Paper, + Typography, +} from '@mui/material' +import { NavLink, useParams } from 'react-router-dom' +import { BIDSDataset } from '../../../api/types' +import { linkStyle, ROUTE_PREFIX } from '../../../constants' +import DatasetInfo from './DatasetInfo' +import * as React from 'react' +import { nameToColor } from '../../theme' + +const DatasetCard = ({ dataset, children }: { dataset: BIDSDataset, children?: JSX.Element }): JSX.Element => { + const params = useParams() + + return ( + <> + + + + + {dataset?.Name} + + id: {dataset?.id} + + + Authors: {dataset?.Authors?.join(', ')} + + + + + {children} + + + + + ) +} + +DatasetCard.displayName = 'DatasetCard' + +export default DatasetCard diff --git a/src/components/BIDS/DatasetDescription.tsx b/src/components/UI/BIDS/DatasetDescription.tsx similarity index 98% rename from src/components/BIDS/DatasetDescription.tsx rename to src/components/UI/BIDS/DatasetDescription.tsx index f02a0d23..2652379a 100644 --- a/src/components/BIDS/DatasetDescription.tsx +++ b/src/components/UI/BIDS/DatasetDescription.tsx @@ -1,5 +1,5 @@ import { Box, CardActions, CardContent, Link, Typography } from '@mui/material' -import { BIDSDataset } from '../../api/types' +import { BIDSDataset } from '../../../api/types' import * as React from 'react' const DatasetDescription = ({ dataset }: { dataset?: BIDSDataset }) => { diff --git a/src/components/BIDS/DatasetInfo.tsx b/src/components/UI/BIDS/DatasetInfo.tsx similarity index 98% rename from src/components/BIDS/DatasetInfo.tsx rename to src/components/UI/BIDS/DatasetInfo.tsx index ebbafc0f..3751720e 100644 --- a/src/components/BIDS/DatasetInfo.tsx +++ b/src/components/UI/BIDS/DatasetInfo.tsx @@ -1,7 +1,7 @@ import CheckIcon from '@mui/icons-material/Check' import CloseIcon from '@mui/icons-material/Close' import { Box, Tooltip, Typography } from '@mui/material' -import { BIDSDataset } from '../../api/types' +import { BIDSDataset } from '../../../api/types' import * as React from 'react' const DatasetInfo = ({ dataset }: { dataset?: BIDSDataset }): JSX.Element => ( diff --git a/src/components/BIDS/Datasets.tsx b/src/components/UI/BIDS/Datasets.tsx similarity index 91% rename from src/components/BIDS/Datasets.tsx rename to src/components/UI/BIDS/Datasets.tsx index 79b5ba03..1bdbd0d5 100644 --- a/src/components/BIDS/Datasets.tsx +++ b/src/components/UI/BIDS/Datasets.tsx @@ -24,11 +24,11 @@ import { Typography, } from '@mui/material' import React, { useCallback, useEffect, useState } from 'react' -import { queryBidsDatasets, refreshBidsDatasetsIndex } from '../../api/bids' -import { BIDSDataset } from '../../api/types' -import useDebounce from '../../hooks/useDebounce' -import { useAppStore } from '../../Store' -import TitleBar from '../UI/titleBar' +import { queryBidsDatasets, refreshBidsDatasetsIndex } from '../../../api/bids' +import { BIDSDataset } from '../../../api/types' +import useDebounce from '../../../hooks/useDebounce' +import { useAppStore } from '../../../Store' +import TitleBar from '../../UI/titleBar' import CreateDataset from './CreateDataset' import DatasetCard from './DatasetCard' @@ -53,7 +53,7 @@ const ageRangeMarks = [ { value: 100, label: '100' }, ] -const Datasets = () => { +const Datasets = ({ handleClickedDataset, buttonTitle }: { handleClickedDataset?: (dataset: BIDSDataset) => void, buttonTitle: string}) => { const { user: [user], } = useAppStore() @@ -296,7 +296,17 @@ const Datasets = () => { }} > {datasets?.data?.map(dataset => ( - + + {handleClickedDataset && } + ))} diff --git a/src/components/BIDS/EntityOptions.tsx b/src/components/UI/BIDS/EntityOptions.tsx similarity index 97% rename from src/components/BIDS/EntityOptions.tsx rename to src/components/UI/BIDS/EntityOptions.tsx index e28a2a65..d6c72471 100644 --- a/src/components/BIDS/EntityOptions.tsx +++ b/src/components/UI/BIDS/EntityOptions.tsx @@ -1,7 +1,7 @@ import TextField from '@mui/material/TextField' import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete' import React, { useEffect } from 'react' -import { IEntity, IOption } from '../../api/types' +import { IEntity, IOption } from '../../../api/types' const filter = createFilterOptions() diff --git a/src/components/BIDS/Import.tsx b/src/components/UI/BIDS/Import.tsx similarity index 97% rename from src/components/BIDS/Import.tsx rename to src/components/UI/BIDS/Import.tsx index 0a88a57b..c855ffaa 100644 --- a/src/components/BIDS/Import.tsx +++ b/src/components/UI/BIDS/Import.tsx @@ -19,18 +19,18 @@ import { Typography, } from '@mui/material' import React, { useEffect, useState } from 'react' -import { importSubject } from '../../api/bids' +import { importSubject } from '../../../api/bids' import { BIDSDataset, CreateSubjectDto, BIDSFile, IEntity, Participant, -} from '../../api/types' -import { ENTITIES, MODALITIES } from '../../constants' -import { useNotification } from '../../hooks/useNotification' -import { useAppStore } from '../../Store' -import FileChooser from '../UI/FileChooser' +} from '../../../api/types' +import { ENTITIES, MODALITIES } from '../../../constants' +import { useNotification } from '../../../hooks/useNotification' +import { useAppStore } from '../../../Store' +import FileChooser from '../../UI/FileChooser' import EntityOptions from './EntityOptions' import ParticipantInfo from './ParticipantInfo' diff --git a/src/components/BIDS/ParticipantInfo.tsx b/src/components/UI/BIDS/ParticipantInfo.tsx similarity index 93% rename from src/components/BIDS/ParticipantInfo.tsx rename to src/components/UI/BIDS/ParticipantInfo.tsx index ef58907c..75a58511 100644 --- a/src/components/BIDS/ParticipantInfo.tsx +++ b/src/components/UI/BIDS/ParticipantInfo.tsx @@ -1,8 +1,8 @@ import { Box, CircularProgress, Link, Typography } from '@mui/material' import React, { useEffect, useState } from 'react' -import { getSubject } from '../../api/bids' -import { BIDSDataset, BIDSSubjectFile } from '../../api/types' -import { useAppStore } from '../../Store' +import { getSubject } from '../../../api/bids' +import { BIDSDataset, BIDSSubjectFile } from '../../../api/types' +import { useAppStore } from '../../../Store' type IExistingFile = { modality: string diff --git a/src/components/BIDS/Participants.tsx b/src/components/UI/BIDS/Participants.tsx similarity index 95% rename from src/components/BIDS/Participants.tsx rename to src/components/UI/BIDS/Participants.tsx index dad6e6a1..8716785c 100644 --- a/src/components/BIDS/Participants.tsx +++ b/src/components/UI/BIDS/Participants.tsx @@ -14,13 +14,13 @@ import { Typography, } from '@mui/material' import { useEffect, useState } from 'react' -import { writeParticipantsTSV } from '../../api/bids' -import { BIDSDataset, Participant } from '../../api/types' -import { useAppStore } from '../../Store' -import CreateField from '../UI/createField' +import { writeParticipantsTSV } from '../../../api/bids' +import { BIDSDataset, Participant } from '../../../api/types' +import { useAppStore } from '../../../Store' +import CreateField from '../../UI/createField' import CreateParticipant from './CreateParticipant' import ParticipantInfo from './ParticipantInfo' -import { useNotification } from '../../hooks/useNotification' +import { useNotification } from '../../../hooks/useNotification' const Participants = ({ dataset, diff --git a/src/components/UI/FileBrowser.tsx b/src/components/UI/FileBrowser.tsx index 24e55209..55cbd202 100644 --- a/src/components/UI/FileBrowser.tsx +++ b/src/components/UI/FileBrowser.tsx @@ -6,7 +6,7 @@ import { useEffect, useState } from 'react' import { getFiles2, getGroupFolders, search } from '../../api/gatewayClientAPI' import { ISearch, Node } from '../../api/types' import { useAppStore } from '../../Store' -import { DocumentSquare, MinusSquare, PlusSquare } from './Icons' +import { MinusSquare, PlusSquare } from './Icons' const StyledTreeItem = styled((props: TreeItemProps) => ( @@ -204,7 +204,6 @@ const FileBrowser = ({ defaultExpanded={[rootFile.path]} defaultCollapseIcon={} defaultExpandIcon={} - defaultEndIcon={} onNodeToggle={(_event, filesIds: string[]) => { const clickedId = filesIds[0] const directoryExists = files.find(f => f.parentPath === clickedId) diff --git a/src/components/UI/Icons.tsx b/src/components/UI/Icons.tsx index a21725f8..e7ccf021 100644 --- a/src/components/UI/Icons.tsx +++ b/src/components/UI/Icons.tsx @@ -14,15 +14,3 @@ export const PlusSquare = (props: SvgIconProps) => ( ) - -export const DocumentSquare = (props: SvgIconProps) => ( - - {/* tslint:disable-next-line: max-line-length */} - - -) diff --git a/src/components/UI/MetadataBrowser.tsx b/src/components/UI/MetadataBrowser.tsx index 3f747919..10b92697 100644 --- a/src/components/UI/MetadataBrowser.tsx +++ b/src/components/UI/MetadataBrowser.tsx @@ -4,7 +4,7 @@ import { alpha, styled } from '@mui/material/styles' import { useState } from 'react' import { InspectResult } from '../../api/types' import React, { useCallback } from 'react' -import { MinusSquare, PlusSquare, DocumentSquare } from './Icons' +import { MinusSquare, PlusSquare } from './Icons' import { filesize } from 'filesize' const StyledTreeItem = styled((props: TreeItemProps) => ( @@ -101,7 +101,6 @@ const MetadataBrowser = ({ defaultExpanded={[rootFile.relativePath]} defaultCollapseIcon={} defaultExpandIcon={} - defaultEndIcon={} onNodeToggle={(_event, filesIds: string[]) => { if (filesIds) setExpanded(filesIds) }}