Skip to content

Commit b843152

Browse files
authored
Merge pull request #2 from elixir-europe/dev
Merge news changes to main
2 parents ec32a39 + 399cfab commit b843152

16 files changed

+435
-143
lines changed

Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1+
# --- stage 1 --- #
12
ARG NODE_VERSION=20
2-
FROM node:${NODE_VERSION}-alpine
3-
COPY . /app
3+
FROM node:${NODE_VERSION}-alpine AS build
44
WORKDIR /app
5+
6+
COPY package.json yarn.lock ./
57
RUN sh -c "corepack enable && (yarn install --immutable || yarn install --frozen-lockfile)"
6-
EXPOSE 3000
7-
CMD yarn start
88

9+
COPY . .
10+
RUN yarn build # CRA genera en /app/build
11+
12+
# --- stage 2 --- #
13+
FROM nginx:1.27-alpine
14+
RUN rm -f /etc/nginx/conf.d/default.conf
15+
COPY nginx.conf /etc/nginx/conf.d/default.conf
16+
17+
COPY --from=build /app/build /usr/share/nginx/html
18+
19+
EXPOSE 80

__nginx.conf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
server {
2+
listen 80;
3+
sendfile on;
4+
default_type application/octet-stream;
5+
6+
gzip on;
7+
gzip_http_version 1.1;
8+
gzip_disable "MSIE [1-6]\.";
9+
gzip_min_length 256;
10+
gzip_vary on;
11+
gzip_proxied expired no-cache no-store private auth;
12+
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
13+
gzip_comp_level 9;
14+
15+
root /usr/share/nginx/html;
16+
17+
location / {
18+
try_files $uri $uri/ /index.html =404;
19+
}
20+
}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
"@emotion/react": "^11.14.0",
1616
"@emotion/styled": "^11.14.0",
1717
"@mui/icons-material": "^7.0.1",
18+
"@mui/lab": "^7.0.0-beta.16",
1819
"@mui/material": "^7.0.1",
1920
"formik": "^2.4.6",
2021
"fuse.js": "^7.1.0",
2122
"joi": "^17.13.3",
23+
"papaparse": "^5.5.3",
2224
"react": "18",
2325
"react-dom": "18",
2426
"react-router-dom": "^7.5.0",

src/components/Search.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default function Search({
3737
const { selectedPathSegment, setSelectedPathSegment } = useSelectedEntry();
3838
const [assembly, setAssembly] = useState(config.assemblyId[0]);
3939
const [open, setOpen] = useState(false);
40+
const { isLoaded, setIsLoaded } = useSelectedEntry();
4041
const searchRef = useRef(null);
4142

4243
useEffect(() => {
@@ -87,7 +88,9 @@ export default function Search({
8788
const res = await fetch(`${config.apiUrl}/map`);
8889
const data = await res.json();
8990
const endpointSets = data.response.endpointSets || {};
90-
91+
92+
setIsLoaded(false);
93+
9194
const entries = Object.entries(endpointSets)
9295
.filter(filterGenomicVariation)
9396
.map(mapEntry)
@@ -100,6 +103,8 @@ export default function Search({
100103
setSelectedPathSegment(sorted[0].pathSegment);
101104
}
102105
await handleBeaconsInfo();
106+
107+
setIsLoaded(true);
103108
} catch (err) {
104109
console.error("Error fetching entry types:", err);
105110
} finally {
@@ -123,7 +128,7 @@ export default function Search({
123128
useEffect(() => {
124129
const fetchAll = async () => {
125130
await fetchConfiguration();
126-
setLoading(false);
131+
//setLoading(false);
127132
};
128133

129134
fetchAll();
@@ -418,7 +423,7 @@ export default function Search({
418423
</Box>
419424
)}
420425

421-
{loading ? (
426+
{loading || !isLoaded ? (
422427
<CircularProgress />
423428
) : !isSingleEntryType ? (
424429
<Box sx={{ display: "flex", flexWrap: "wrap", gap: 2 }}>

src/components/context/SelectedEntryContext.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const SelectedEntryProvider = ({ children }) => {
1414
const [entryTypesConfig, setEntryTypesConfig] = useState({});
1515
const [message, setMessage] = useState(null);
1616
const [hasSearchBeenTriggered, setHasSearchBeenTriggered] = useState(false);
17+
const [isLoaded, setIsLoaded] = useState(false);
1718

1819
return (
1920
<SelectedEntryContext.Provider
@@ -40,6 +41,8 @@ export const SelectedEntryProvider = ({ children }) => {
4041
setMessage,
4142
hasSearchBeenTriggered,
4243
setHasSearchBeenTriggered,
44+
isLoaded,
45+
setIsLoaded
4346
}}
4447
>
4548
{children}

src/components/homepageBanner/SingleBeaconBanner.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ export default function SingleBeaconBanner() {
3333
const handleChange = (event, newValue) => {
3434
setTabValue(newValue);
3535
};
36-
37-
// console.log("localDatasets", localDatasets);
38-
36+
3937
// Fetch datasets on component mount
4038
// Saves the full list to local state and preselects the first dataset
4139
useEffect(() => {

src/components/pages/HomePage.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export default function HomePage({ selectedTool, setSelectedTool }) {
2727

2828
return (
2929
<>
30-
{/* Main container */}
3130
<Box
3231
sx={{
3332
display: "flex",
@@ -43,12 +42,6 @@ export default function HomePage({ selectedTool, setSelectedTool }) {
4342
display: "flex",
4443
flexDirection: "column",
4544
width: { lg: "60%", md: "60%" },
46-
// backgroundColor: {
47-
// lg: "lightsalmon",
48-
// md: "pink",
49-
// sm: "lightgreen",
50-
// xs: "lightblue",
51-
// },
5245
}}
5346
>
5447
<Founders />

src/components/results/ResultsContainer.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@ import { useEffect, useRef } from "react";
77
import { COMMON_MESSAGES } from "../common/CommonMessage";
88

99
export default function ResultsContainer() {
10-
const { loadingData, resultData, hasSearchResults, message } =
11-
useSelectedEntry();
12-
10+
const { loadingData, resultData, hasSearchResults, message } = useSelectedEntry();
1311
const showBox = loadingData || hasSearchResults || message;
14-
15-
// console.log("message", message);
16-
1712
const tableRef = useRef(null);
1813

1914
useEffect(() => {

src/components/results/ResultsTable.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ export default function ResultsTable() {
9090
});
9191
}
9292

93-
console.log("beacon<: ", beacon);
94-
9593
const logo = beacon.response
9694
? beacon.response?.organization?.logoUrl
9795
: beacon.organization?.logoUrl;
@@ -136,6 +134,7 @@ export default function ResultsTable() {
136134
<TableCell
137135
key={column.id}
138136
align={column.align}
137+
style={{ width: column.width }}
139138
sx={{
140139
...headerCellStyle,
141140
width: column.width,

src/components/results/ResultsTableRow.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,20 @@ import CalendarViewMonthIcon from '@mui/icons-material/CalendarViewMonth';
1616
import config from '../../config/config.json';
1717

1818
export default function ResultsTableRow({ item, handleOpenModal }) {
19-
console.log(item);
2019
return (
2120
<TableRow>
2221
<TableCell colSpan={6} sx={{
2322
backgroundColor: 'background.paper',
2423
borderTop: '1px solid',
25-
borderColor: 'divider'
24+
borderColor: 'divider',
25+
p: 0
2626
}}>
2727
<Box sx={{ p: 0 }}>
2828
<TableContainer>
2929
<Table stickyHeader aria-label="Results table">
3030
<TableBody>
3131
{ item.items.map((dataset) => (
3232
<TableRow key={dataset.id || dataset.dataset}>
33-
<TableCell style={{ width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset }}></TableCell>
34-
<TableCell style={{ width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset_name }}>
35-
<Box sx={{ display: 'flex'}}>
36-
<Typography sx={{ fontWeight: "bold" }} variant="body2">Dataset: </Typography>
37-
<Typography sx={{ paddingLeft: '5px' }} variant="body2">{ dataset.dataset } </Typography>
38-
</Box>
39-
</TableCell>
40-
<TableCell sx={{ fontWeight: "bold" }} style={{ width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset_response }}>
41-
{ item.totalResultsCount > 0 ? new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(Number(item.totalResultsCount)) : '-' }
42-
</TableCell>
4333
<TableCell
4434
style={{
4535
width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset_detail.width,
@@ -76,6 +66,16 @@ export default function ResultsTableRow({ item, handleOpenModal }) {
7666
</Button>
7767
</Tooltip>
7868
</TableCell>
69+
<TableCell style={{ width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset_name }}>
70+
<Box sx={{ display: 'flex'}}>
71+
<Typography sx={{ fontWeight: "bold" }} variant="body2">Dataset: </Typography>
72+
<Typography sx={{ paddingLeft: '5px' }} variant="body2">{ dataset.dataset } </Typography>
73+
</Box>
74+
</TableCell>
75+
<TableCell sx={{ fontWeight: "bold" }} style={{ width: BEACON_NETWORK_COLUMNS_EXPANDED.beacon_dataset_response }}>
76+
{ item.totalResultsCount > 0 ? new Intl.NumberFormat(navigator.language, { useGrouping: true }).format(Number(item.totalResultsCount)) : '-' }
77+
</TableCell>
78+
7979
</TableRow>
8080
))}
8181
</TableBody>

0 commit comments

Comments
 (0)