Skip to content

Commit

Permalink
Merge main into sweep/add-readme-dev-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Sep 1, 2023
2 parents 61ae165 + cfe8201 commit 6ffac24
Show file tree
Hide file tree
Showing 45 changed files with 208 additions and 209 deletions.
2 changes: 1 addition & 1 deletion convertPheno_client/cypress/e2e/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/getKCTokens.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Last Modified: Apr/28/2023
#
# Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
# Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
#
# License: GPL-3.0 license

Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/replace_env_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Last Modified: Apr/28/2023
#
# Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
# Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
#
# License: GPL-3.0 license

Expand Down
16 changes: 11 additions & 5 deletions convertPheno_client/src/code/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,19 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/

import React, { useEffect, useContext, useMemo, useState } from "react";
import { Navigate, Route, Routes, useNavigate, useParams } from "react-router-dom";
import {
Navigate,
Route,
Routes,
useNavigate,
useParams,
} from "react-router-dom";
import { ErrorBoundary } from "react-error-boundary";
import { Box, Grid } from "@mui/material";
import { useTheme, ThemeProvider, createTheme } from "@mui/material/styles";
Expand Down Expand Up @@ -99,22 +105,22 @@ function renderRoutes() {
));
}

function AuthenticatedRoute ({ element: Component, path, security }) {
function AuthenticatedRoute({ element: Component, path, security }) {
const navigate = useNavigate();
const isAuthenticated = security === "false" || auth.user.authenticated;
const params = useParams();

useEffect(() => {
if (!isAuthenticated) {
if ("jobId" in params) {
path = `${ path }/${ params.jobId }`;
path = `${path}/${params.jobId}`;
}
navigate("/login", { state: { redirect: path } });
}
}, [auth.user.authenticated, navigate]);

return isAuthenticated ? <Component /> : null;
};
}

function App() {
const theme = useTheme();
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/src/code/Auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
4 changes: 2 additions & 2 deletions convertPheno_client/src/code/Login.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand All @@ -20,7 +20,7 @@ import Home from "./views/home/Home";

const kcConfig =
process.env.NODE_ENV === "production"
? JSON.parse(window.REACT_APP_KC_CONFIG.replace(/'/g, "\""))
? JSON.parse(window.REACT_APP_KC_CONFIG.replace(/'/g, '"'))
: JSON.parse(import.meta.env.VITE_KC_CONFIG);

const keycloakConfig = {
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/src/code/Main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/src/code/apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/src/code/header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
2 changes: 1 addition & 1 deletion convertPheno_client/src/code/views/about/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Jun/21/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/

import React, { useState, useRef } from "react";
import { Button, Popover, Tooltip, Typography } from "@mui/material";
import ValueWithTooltip from "./ValueWithTooltip";

const UnstyledButton = ({ onClick, children }) => {
return (
Expand Down Expand Up @@ -84,62 +85,6 @@ const getValue = (props) => {
);
};

const ValueWithTooltip = ({ value, ontology_id, url }) => {
const [isTooltipOpen, setIsTooltipOpen] = useState(false);
const tooltipTimeout = useRef({ current: null });

console.log("value", value);
console.log("ontology_id", ontology_id);
console.log("url", url);

const handleMouseOver = (value) => {
if (value === "NA") {
return;
}
setIsTooltipOpen(true);
clearTimeout(tooltipTimeout.current);
};

const handleMouseOut = () => {
tooltipTimeout.current = setTimeout(() => {
setIsTooltipOpen(false);
}, 1000);
};

const handleLinkClick = () => {
clearTimeout(tooltipTimeout.current);
window.open(url, "_blank");
};

return (
<Tooltip
open={isTooltipOpen}
title={
<span>
Click to open{" "}
<a
href={url}
target="_blank"
rel="noopener noreferrer"
onClick={handleLinkClick}
>
{ontology_id}
</a>
</span>
}
placement="bottom"
>
<span
onMouseOver={() => handleMouseOver(value)}
onMouseOut={handleMouseOut}
style={{ marginRight: "5px", cursor: "pointer" }}
>
{value}
</span>
</Tooltip>
);
};

const PopoverButton = ({
children,
onClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
renders the value of a cell in the data grid with a tooltip that shows the ontology id and a link to the ontology term
This file is part of convert-pheno-ui
Last Modified: Sep/1/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/

import React, { useState, useRef } from "react";
import { Tooltip } from "@mui/material";

export default function ValueWithTooltip(props) {
const { value, ontology_id, url } = props;

const [isTooltipOpen, setIsTooltipOpen] = useState(false);
const tooltipTimeout = useRef({ current: null });

const handleMouseOver = (value) => {
if (value === "NA") {
return;
}
setIsTooltipOpen(true);
clearTimeout(tooltipTimeout.current);
};

const handleMouseOut = () => {
tooltipTimeout.current = setTimeout(() => {
setIsTooltipOpen(false);
}, 1000);
};

const handleLinkClick = () => {
clearTimeout(tooltipTimeout.current);
window.open(url, "_blank");
};

return (
<Tooltip
open={isTooltipOpen}
title={
<span>
Click to open{" "}
<a
href={url}
target="_blank"
rel="noopener noreferrer"
onClick={handleLinkClick}
>
{ontology_id}
</a>
</span>
}
placement="bottom"
>
<span
onMouseOver={() => handleMouseOver(value)}
onMouseOut={handleMouseOut}
style={{ marginRight: "5px", cursor: "pointer" }}
>
{value}
</span>
</Tooltip>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Last Modified: Apr/28/2023
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG (Ivo.leist@cnag.crg.eu)
Copyright (C) 2022-2023 Ivo Christopher Leist - CNAG ([email protected])
License: GPL-3.0 license
*/
Expand Down
Loading

0 comments on commit 6ffac24

Please sign in to comment.