Skip to content

Commit 716625d

Browse files
committed
Merge branch 'staging'
* staging: (21 commits) temporarily remove the option to use MC without authentication, until we get sessions working properly use null in place of empty string for missing parameters only show "add model/test" button when authenticated fix bug when adding new model or test from table fix bug introduced in 53357c3 Fix download links for data in CSCS containers move filtering of editable projects to the server Set back-end server for staging at Docker build time Remove warnings from more recent versions of dependencies avoid reloading page when clicking on featured models; allow login when try to access model detail page directly update names of featured models Add support for using Model Catalog when not logged in Update keycloak config, based on HumanBrainProject/hbp-validation-framework#319 by @appukuttan-shailesh update EBRAINS logo for link-outs Add ModelDB linkouts fix a not-so-obvious issue with using autocomplete fix dumb mistake in autocomplete Add search/autocomplete to single-select drop-down lists only show project ID (collab name) for private models, it is not relevant for public ones debug ci build failure ...
2 parents c55964e + eb78e14 commit 716625d

22 files changed

+694
-445
lines changed

apps/deployment/Dockerfile.staging

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ WORKDIR /model-catalog
1010
ENV PATH /model-catalog/node_modules/.bin:$PATH
1111
COPY model_catalog/package.json ./
1212
COPY model_catalog/package-lock.json ./
13-
RUN npm ci --silent --legacy-peer-deps
13+
RUN npm ci --legacy-peer-deps
1414

1515
COPY model_catalog ./
16+
COPY model_catalog/src/globals-staging.js ./src/globals.js
1617
RUN node --max-old-space-size=4096 `which npm` run build
1718

1819
WORKDIR /curation-dashboard

apps/model_catalog/package-lock.json

Lines changed: 272 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/model_catalog/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"dependencies": {
66
"@material-ui/core": "^4.11.1",
77
"@material-ui/icons": "^4.5.1",
8+
"@material-ui/lab": "^4.0.0-alpha.61",
89
"axios": "^0.21.1",
910
"eslint-config-react-app": "^5.2.1",
1011
"eslint-plugin-flowtype": "^5.2.0",
@@ -14,7 +15,7 @@
1415
"eslint-plugin-react-hooks": "^4.2.0",
1516
"filesize": "^6.1.0",
1617
"humanparser": "^1.11.0",
17-
"keycloak-js": "^8.0.1",
18+
"keycloak-js": "^12.0.2",
1819
"lodash": "^4.17.20",
1920
"material-ui-chip-input": "^2.0.0-beta.2",
2021
"moment": "^2.29.1",
-67.3 KB
Loading
13.9 KB
Loading
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import React from "react";
2+
import Button from "@material-ui/core/Button";
3+
import IconButton from "@material-ui/core/IconButton";
4+
import PersonIcon from '@material-ui/icons/Person';
5+
import Tooltip from "@material-ui/core/Tooltip";
6+
import ContextMain from "./ContextMain";
7+
8+
9+
function AuthWidget(props) {
10+
11+
const context = React.useContext(ContextMain);
12+
const [auth] = context.auth;
13+
14+
if (auth.authenticated || props.currentUser) {
15+
16+
if (!props.currentUser) {
17+
auth.loadUserInfo().then((userInfo) => {
18+
console.log(userInfo);
19+
props.setCurrentUser(userInfo.preferred_username);
20+
});
21+
};
22+
23+
return (
24+
<Tooltip title={props.currentUser || "anonymous"}>
25+
<IconButton variant="outlined">
26+
<PersonIcon />
27+
</IconButton>
28+
</Tooltip>
29+
);
30+
} else {
31+
return (
32+
<Button
33+
variant="outlined"
34+
color="primary"
35+
disableElevation
36+
size="small"
37+
onClick={auth.login} // todo: login with scopes
38+
>
39+
Login
40+
</Button>
41+
);
42+
}
43+
}
44+
45+
export default AuthWidget;

apps/model_catalog/src/CompareMultiResults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2210,7 +2210,7 @@ class CompareMultiResults extends React.Component {
22102210
</Typography>
22112211
</Grid>
22122212
<Grid item xs={12}>
2213-
<Grid container justify="space-around" spacing={3}>
2213+
<Grid container justifyContent="space-around" spacing={3}>
22142214
{/* Model listing */}
22152215
<Grid
22162216
item

apps/model_catalog/src/ErrorDialog.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import DialogActions from "@material-ui/core/DialogActions";
66
import Typography from "@material-ui/core/Typography";
77
import Button from "@material-ui/core/Button";
88
import { reformatErrorMessage } from "./utils";
9+
import ContextMain from "./ContextMain";
10+
911

1012
const addLineBreaks = (string) =>
1113
string.split("\n").map((text, index) => (
@@ -15,8 +17,26 @@ const addLineBreaks = (string) =>
1517
</React.Fragment>
1618
));
1719

20+
1821
export default function ErrorDialog(props) {
1922
console.log("ErrorDialog: " + props.error);
23+
const context = React.useContext(ContextMain);
24+
const [auth] = context.auth;
25+
26+
let loginButton = "";
27+
if (props.showLoginButton) {
28+
loginButton = (
29+
<Button
30+
color="primary"
31+
disableElevation
32+
size="small"
33+
onClick={() => auth.login({redirectUri: props.redirectUri})} // todo: login with scopes
34+
>
35+
Login
36+
</Button>
37+
)
38+
}
39+
2040
return (
2141
<Dialog
2242
open={props.open}
@@ -32,8 +52,12 @@ export default function ErrorDialog(props) {
3252
? addLineBreaks(props.error)
3353
: addLineBreaks(reformatErrorMessage(props.error))}
3454
</Typography>
55+
<Typography variant="body2" gutterBottom>
56+
{props.additionalMessage}
57+
</Typography>
3558
</DialogContent>
3659
<DialogActions>
60+
{loginButton}
3761
<Button onClick={props.handleErrorDialogClose} color="primary">
3862
Close
3963
</Button>

apps/model_catalog/src/Introduction.js

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,12 @@ import Button from "@material-ui/core/Button";
2121
import { yellow } from "@material-ui/core/colors";
2222
import Plotly from "plotly.js";
2323
import createPlotlyComponent from "react-plotly.js/factory";
24-
import { updateHash, corsProxy, filterKeys } from "./globals";
24+
import { corsProxy, filterKeys } from "./globals";
2525
import { formatLabel } from "./utils";
2626
import "./App.css";
2727

2828
const ResponsiveEllipsis = responsiveHOC()(LinesEllipsis);
2929

30-
// const openInNewTab = (url) => {
31-
// const newWindow = window.open(url, "_blank", "noopener,noreferrer");
32-
// if (newWindow) newWindow.opener = null;
33-
// };
3430

3531
const styles = (theme) => ({
3632
header: {
@@ -84,8 +80,7 @@ function MediaCard(props) {
8480
>
8581
<CardActionArea
8682
onClick={() => {
87-
updateHash("model_id." + props.id);
88-
window.location.reload();
83+
props.onClick(props.id);
8984
}}
9085
>
9186
<CardMedia
@@ -134,8 +129,7 @@ function MediaCard(props) {
134129
color="primary"
135130
style={{ fontWeight: "bolder" }}
136131
onClick={() => {
137-
updateHash("model_id." + props.id);
138-
window.location.reload();
132+
props.onClick(props.id);
139133
}}
140134
>
141135
View Model
@@ -405,48 +399,50 @@ class Introduction extends React.Component {
405399
<MediaCard
406400
id="3772094a-8e2d-4075-8f05-9be62c8d8a5d"
407401
image_title={"Golding_et_al_2001_dichotomy"}
408-
title={"Golding_et_al_2001_dichotomy"}
402+
title={"Dichotomy of action-potential backpropagation in CA1 pyramidal neuron dendrites (Golding et al 2001)"}
409403
citation={
410404
"Nace L. Golding, William L. Kath, Nelson Spruston, Sára Sáray"
411405
}
406+
onClick={this.props.handleSelectFeaturedModel}
412407
/>
413408
<MediaCard
414409
id="528ec0e6-2f21-413c-9abd-d131f7150882"
415410
image_title={"CA1_Bianchi_2012"}
416-
title={"CA1_Bianchi_2012"}
411+
title={"Mechanisms of the depolarization block in CA1 pyramidal neurons - Bianchi et al., 2012"}
417412
citation={
418413
"Daniela Bianchi, Addolorata Marasco, Alessandro Limongiello, Cristina Marchetti, Hélène Marie, Brunello Tirozzi, Michele Migliore, Sára Sáray"
419414
}
415+
onClick={this.props.handleSelectFeaturedModel}
420416
/>
421417
<MediaCard
422418
id="09cbcd03-1e39-497a-a34e-090dde3617d8"
423419
image_title={"Basal ganglia network model"}
424420
title={"Basal ganglia network model"}
425421
citation={"Shreyas M Suryanarayana"}
422+
onClick={this.props.handleSelectFeaturedModel}
426423
/>
427424
<MediaCard
428425
id="1ccc23ec-d3a6-43b6-b96f-41e9c4221a15"
429-
image_title={
430-
"SpiNNCer: Neuromorphic cerebellum implementation on SpiNNaker"
431-
}
432-
title={
433-
"SpiNNCer: Neuromorphic cerebellum implementation on SpiNNaker"
434-
}
426+
image_title={"SpiNNCer: Neuromorphic cerebellum implementation on SpiNNaker"}
427+
title={"SpiNNCer: Neuromorphic cerebellum implementation on SpiNNaker"}
435428
citation={
436429
"Petruț Antoniu Bogdan, Beatrice Marcinnò, Claudia Casellato, Stefano Casali, Andrew G. D. Rowley, Michael Hopkins, Francesco Leporati, Egidio D'Angelo, Oliver Rhodes"
437430
}
431+
onClick={this.props.handleSelectFeaturedModel}
438432
/>
439433
<MediaCard
440434
id="c28c4e1f-0ef3-4ccd-9a81-8e792aa349a4"
441435
image_title={"Model of two-photon calcium signals"}
442436
title={"Model of two-photon calcium signals"}
443437
citation={"Nuria Tort-Colet, Alain Destexhe"}
438+
onClick={this.props.handleSelectFeaturedModel}
444439
/>
445440
<MediaCard
446441
id="03d26f01-9197-4fae-97d7-09b33274b76f"
447442
image_title={"CA1_int_cNAC_060314AM2_20190328165336"}
448443
title={"CA1_int_cNAC_060314AM2_20190328165336"}
449444
citation={"Rosanna Migliore"}
445+
onClick={this.props.handleSelectFeaturedModel}
450446
/>
451447
</Slider>
452448
</Grid>
@@ -470,7 +466,7 @@ class Introduction extends React.Component {
470466
spacing={2}
471467
direction="row"
472468
alignItems="center"
473-
justify="center"
469+
justifyContent="center"
474470
>
475471
{[
476472
"species",

apps/model_catalog/src/MUIDataTableCustomToolbar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ class CustomToolbar extends React.Component {
1515

1616
render() {
1717
const [status] = this.context.status;
18+
const [auth] = this.context.auth;
1819
let addNewVersionButton = "";
19-
if (!status.includes("read-only")) {
20+
if (auth.authenticated && !status.includes("read-only")) {
2021
addNewVersionButton = (
2122
<Tooltip
2223
title={

0 commit comments

Comments
 (0)