Skip to content

Commit

Permalink
Merge pull request #25 from HIP-infrastructure/feat/public-space-v2
Browse files Browse the repository at this point in the history
Feat/public space v2
  • Loading branch information
nicedexter authored Nov 16, 2023
2 parents de5418f + 5b4d627 commit f8908e5
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 298 deletions.
55 changes: 0 additions & 55 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"@mui/lab": "^5.0.0-alpha.128",
"@mui/material": "^5.12.2",
"@mui/styled-engine-sc": "^5.12.0",
"@nextcloud/auth": "^1.3.0",
"@testing-library/jest-dom": "^5.16.4",
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^14.2.0",
Expand Down
15 changes: 11 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ import './App.css'
import AppList from './components/Documentation/AppList'
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'
import CreateProject from './components/Projects/Create'
import ProjectWorkspace from './components/Project/Workspace'
import ProjectDataset from './components/Project/Dataset'
import Projects from './components/Projects'
import Desktop from './components/Desktop/Desktop'
import CenterDesktops from './components/Center/Desktops'
import ProjectDesktops from './components/Project/Desktops'
Expand Down Expand Up @@ -89,7 +87,6 @@ const App = () => (
</Route>
</Route>
<Route path={'projects'} element={<Outlet />}>
<Route index element={<Projects />} />
<Route path={'create'} element={<CreateProject />} />
<Route path={':projectId'} element={<Project />}>
<Route index element={<ProjectWorkspace />} />
Expand All @@ -102,7 +99,17 @@ const App = () => (
</Route>
</Route>
</Route>
<Route path={'public'} element={<PublicDatasets />}></Route>
<Route path={'public'} element={<Outlet />}>
<Route path={':projectId'} element={<Project />}>
<Route index element={<ProjectWorkspace />} />
<Route path={'desktops'} element={<ProjectDesktops />} />
<Route path={'metadata'} element={<Files />} />
<Route path={'datasets'} element={<Outlet />}>
<Route index element={<ProjectDataset />} />
<Route path={':datasetId'} element={<ProjectDataset />} />
</Route>
</Route>
</Route>
<Route
path='*'
element={
Expand Down
7 changes: 4 additions & 3 deletions src/Store.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCurrentUser } from '@nextcloud/auth'
import { getCurrentUser } from './nextcloudAuth'
import React, { useState } from 'react'
import { refreshBidsDatasetsIndex } from './api/bids'
import { getCenters, getUser } from './api/gatewayClientAPI'
Expand Down Expand Up @@ -104,9 +104,10 @@ export const AppStoreProvider = ({

// Fetch initial data
React.useEffect(() => {
const currentUser = getCurrentUser() as UserCredentials
setUser(currentUser)
const currentUser = getCurrentUser()
if (!currentUser) return

setUser(currentUser)
getUser(currentUser.uid)
.then(data => {
if (data) {
Expand Down
2 changes: 1 addition & 1 deletion src/api/gatewayClientAPI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const getUsers = async (): Promise<User[]> =>
.then(checkForError)
.catch(catchError)

export const getUser = async (userid?: string): Promise<User> =>
export const getUser = async (userid: string): Promise<User> =>
fetch(`${API_GATEWAY}/users/${userid}`, {
headers: {
requesttoken: window.OC.requestToken,
Expand Down
9 changes: 4 additions & 5 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ export enum ContainerType {
}

export interface UserCredentials {
uid?: string
displayName?: string | null
isAdmin?: boolean
password?: string
uid: string
displayName: string | null
isAdmin: boolean
groups?: string[]
hasProjectsAdminRole?: boolean
}
Expand Down Expand Up @@ -91,8 +90,8 @@ export interface HIPCenter {
export interface HIPProject {
name: string
title: string
isPublic: boolean
description?: string
acceptMembershipRequest?: boolean
isMember?: boolean
admins?: string[]
members?: string[]
Expand Down
2 changes: 1 addition & 1 deletion src/components/Center/Datasets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DatasetsIndex = () => {

return (
<>
<Datasets handleClickedDataset={handleClickedDataset} buttonTitle={'Make public'} />
<Datasets />
<Dialog open={open} onClose={handleCheckedClicked}>
<DialogTitle>Make Dataset Public</DialogTitle>
<DialogContent>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Projects/ProjectCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const ProjectCard = ({ project, users }: Props) => {

return (
<NavLink to={`${ROUTE_PREFIX}/projects/${project.name}`}>
<Card elevation={3} component={Paper} sx={{ width: 280 }}>
<Card elevation={3} component={Paper} sx={{ width: 280, minHeight: 320 }}>
<CardContent>
<Box
sx={{
Expand Down
64 changes: 0 additions & 64 deletions src/components/Projects/index.tsx

This file was deleted.

81 changes: 0 additions & 81 deletions src/components/Public/Data.tsx

This file was deleted.

Loading

0 comments on commit f8908e5

Please sign in to comment.