Skip to content

Commit c4bf55c

Browse files
committed
Fixed bug where logged in user could not see
authenticated dataset. Added chip to dataset tile showing access status.
1 parent aa09135 commit c4bf55c

File tree

3 files changed

+41
-25
lines changed

3 files changed

+41
-25
lines changed

frontend/src/components/Explore.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export const Explore = (): JSX.Element => {
109109
created={dataset.created}
110110
description={dataset.description}
111111
thumbnailId={dataset.thumbnail_id}
112-
publicView={true}
112+
publicView={false}
113113
frozen={dataset.frozen}
114114
frozenVersionNum={dataset.frozen_version_num}
115115
status={dataset.status}

frontend/src/components/datasets/DatasetCard.tsx

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import { Download } from "@mui/icons-material";
1616
import { generateThumbnailUrl } from "../../utils/visualization";
1717
import config from "../../app.config";
18+
import Chip from "@mui/material/Chip";
1819

1920
type DatasetCardProps = {
2021
id?: string;
@@ -132,17 +133,42 @@ export default function DatasetCard(props: DatasetCardProps) {
132133
<Download />
133134
</IconButton>
134135
</Tooltip>
135-
<Typography>{status}</Typography>
136-
{/*<Tooltip title="Favorite">*/}
137-
{/* <IconButton color="primary" aria-label="favorite" sx={{mr: 3}} disabled>*/}
138-
{/* <Favorite/>*/}
139-
{/* </IconButton>*/}
140-
{/*</Tooltip>*/}
141-
{/*<Tooltip title="Share">*/}
142-
{/* <IconButton color="primary" aria-label="share" sx={{mr: 3}} disabled>*/}
143-
{/* <Share/>*/}
144-
{/* </IconButton>*/}
145-
{/*</Tooltip>*/}
136+
{(() => {
137+
switch (status) {
138+
case "PUBLIC":
139+
return (
140+
<Tooltip title="Anyone on the internet can access this dataset">
141+
<Chip
142+
label={status?.toLowerCase()}
143+
color="primary"
144+
size="small"
145+
/>
146+
</Tooltip>
147+
);
148+
case "AUTHENTICATED":
149+
return (
150+
<Tooltip title="Only users who have logged in can access this dataset">
151+
<Chip
152+
label={status?.toLowerCase()}
153+
color="primary"
154+
size="small"
155+
/>
156+
</Tooltip>
157+
);
158+
case "PRIVATE":
159+
return (
160+
<Tooltip title="Only users given specific permissions can access this dataset">
161+
<Chip
162+
label={status?.toLowerCase()}
163+
color="primary"
164+
size="small"
165+
/>
166+
</Tooltip>
167+
);
168+
default:
169+
return null;
170+
}
171+
})()}
146172
</CardActions>
147173
</Card>
148174
);

frontend/src/components/datasets/PublicDatasetCard.tsx

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { Download } from "@mui/icons-material";
1616
import { generateThumbnailUrl } from "../../utils/visualization";
1717
import config from "../../app.config";
1818
// import {Favorite, Share} from "@material-ui/icons";
19+
import PublicIcon from "@mui/icons-material/Public";
20+
import Chip from "@mui/material/Chip";
1921

2022
type PublicDatasetCardProps = {
2123
id?: string;
@@ -120,28 +122,16 @@ export default function PublicDatasetCard(props: PublicDatasetCardProps) {
120122
</CardContent>
121123
</CardActionArea>
122124
)}
123-
<CardActions sx={{ pb: 0, justifyContent: "space-between" }}>
125+
<CardActions sx={{ pb: 0, pr: 0 }}>
124126
<Tooltip title="Download">
125127
<IconButton
126128
href={`${config.hostname}/api/v2/public_datasets/${id}/download`}
127129
color="primary"
128130
aria-label="download"
129-
sx={{ mr: 3 }}
130131
>
131132
<Download />
132133
</IconButton>
133134
</Tooltip>
134-
<Typography>{status}</Typography>
135-
{/*<Tooltip title="Favorite">*/}
136-
{/* <IconButton color="primary" aria-label="favorite" sx={{mr: 3}} disabled>*/}
137-
{/* <Favorite/>*/}
138-
{/* </IconButton>*/}
139-
{/*</Tooltip>*/}
140-
{/*<Tooltip title="Share">*/}
141-
{/* <IconButton color="primary" aria-label="share" sx={{mr: 3}} disabled>*/}
142-
{/* <Share/>*/}
143-
{/* </IconButton>*/}
144-
{/*</Tooltip>*/}
145135
</CardActions>
146136
</Card>
147137
);

0 commit comments

Comments
 (0)