diff --git a/src/components/FitsViewer.js b/src/components/FitsViewer.js index 75a69d8963050adcf0ca540cb66b1572b1fbf2a5..239b20ba5a7f322c3664d2649b1b73d5bac96ac7 100644 --- a/src/components/FitsViewer.js +++ b/src/components/FitsViewer.js @@ -9,11 +9,11 @@ export default function FitsViewer() { console.log("fits url: ", url); return ( - <div class="embed-responsive embed-responsive-16by9"> + <div className="embed-responsive embed-responsive-16by9"> <iframe - class="embed-responsive-item" + className="embed-responsive-item" src={url} - allowfullscreen + allowFullScreen ></iframe> </div> ); diff --git a/src/components/Rucio.js b/src/components/Rucio.js index 5c774b321cc77f3d06a808226f0fb9e36b5e248e..6dc43e7b45128d70dcfe18645bf5ba6b8c868ab6 100644 --- a/src/components/Rucio.js +++ b/src/components/Rucio.js @@ -2,11 +2,11 @@ import React from "react"; export default function Rucio() { return ( - <div class="embed-responsive embed-responsive-16by9"> + <div className="embed-responsive embed-responsive-16by9"> <iframe - class="embed-responsive-item" + className="embed-responsive-item" src="https://escape-rucio.cern.ch" - allowfullscreen + allowFullScreen ></iframe> </div> ); diff --git a/src/components/archives/ArchiveDetails.js b/src/components/archives/ArchiveDetails.js index 9ac3f575b9c86d70dadaf4a61da50d5b033ffa68..51af3a92e95bc9cfa4cec6299e763294517b7940 100644 --- a/src/components/archives/ArchiveDetails.js +++ b/src/components/archives/ArchiveDetails.js @@ -1,6 +1,7 @@ import React, { useContext } from "react"; import { useParams } from "react-router-dom"; import { GlobalContext } from "../../contexts/GlobalContext"; +import { QueryContextProvider } from "../../contexts/QueryContext"; import { Container, Row, @@ -76,7 +77,9 @@ export default function ArchiveDetails(props) { </Row> <Row className="pt-3"> <Col> - <DataProductCategories archive={archive} /> + <QueryContextProvider> + <DataProductCategories archive={archive} /> + </QueryContextProvider> </Col> </Row> </Col> diff --git a/src/components/archives/DataProductCategories.js b/src/components/archives/DataProductCategories.js index 8775333a8e5e1f24b6399532bdb155218dc856e2..5d80d8dc86e2212e1ecd6bd3229ca09e5ade5732 100644 --- a/src/components/archives/DataProductCategories.js +++ b/src/components/archives/DataProductCategories.js @@ -1,12 +1,15 @@ import React, { useState, useContext, useEffect } from "react"; -import { NavLink } from "react-router-dom"; +import { useHistory } from "react-router-dom"; import { ListGroup, Card, Button, Row, Col } from "react-bootstrap"; import { GlobalContext } from "../../contexts/GlobalContext"; +import { QueryContext } from "../../contexts/QueryContext"; import axios from "axios"; export default function DataProductCategories({ archive }) { const { api_host } = useContext(GlobalContext); + const { setDPLevel, setCategory } = useContext(QueryContext); const [categories, setCategories] = useState([]); + const history = useHistory(); useEffect(() => { axios @@ -41,9 +44,15 @@ export default function DataProductCategories({ archive }) { button = ( // need to add level (e.g raw) and category (e.g imaging) infomation to send to the form // probably need to define onSubmit instead of point to query_url - <Button as={NavLink} variant="outline-info" to={query_url}> + <Button + onClick={() => { + setDPLevel(category.level); + setCategory(category.category); + history.push(query_url);}} + > Browse Catalog & Run Queries </Button> + ); } else if (category.catalog_user_url_derived) { button = ( diff --git a/src/components/query/VOServiceResults.js b/src/components/query/VOServiceResults.js index 2aa93cc13ce885c4f567257aecf7cdabbfc9697f..95633378ae76af49968de88fe351df5ced388559 100644 --- a/src/components/query/VOServiceResults.js +++ b/src/components/query/VOServiceResults.js @@ -53,9 +53,8 @@ export default function VORegistryResults({ catalog }) { display it with js9 */} {(result.result.endsWith('.fits')) && <Button - value={result.result} - onClick={(event) => { - setFits(event.target.value); + onClick={() => { + setFits(result.result); history.push('/fitsviewer'); }} >View fits</Button>} diff --git a/src/contexts/GlobalContext.js b/src/contexts/GlobalContext.js index e472dea44fa115e5ea8d35c18960b8d80edd7a74..4eecb1a7b633b59e9894cc723c4dac64afd796d9 100644 --- a/src/contexts/GlobalContext.js +++ b/src/contexts/GlobalContext.js @@ -12,7 +12,6 @@ export function GlobalContextProvider({ children }) { process.env.NODE_ENV === "development" ? "http://localhost:5555/esap-api/" : "/esap-api/"; - // "http://localhost:15671/esap-api/" // "http://sdc.astron.nl:5557/esap-api/" const [config, setConfig] = useState(); const [configName, setConfigName] = useState(defaultConf); @@ -24,7 +23,16 @@ export function GlobalContextProvider({ children }) { } axios .get(api_host + "query/configuration" + configNameString) - .then((response) => setConfig(response.data["configuration"])); + .then((response) => { + let config = response.data["configuration"]; + let props = config.query_schema.properties; + console.log("config props: ", props); + Object.keys(props).map((key) => { + if (key == "collection") + console.log("has key collection, default value is: ", props[key]["default"]); + }); + setConfig(config); + }); }, [api_host, configName]); console.log("config: ", { config }); @@ -35,6 +43,7 @@ export function GlobalContextProvider({ children }) { .then((response) => setArchives(response.data.results)); }, [api_host]); + // !!!!! Still need to look at sessionid and stuff const [sessionid, setSessionid] = useState(getCookie("sessionid")); console.log("waah", sessionid, getCookie("sessionid"), document.cookie); const [isAuthenticated, setIsAuthenticated] = useState( diff --git a/src/contexts/QueryContext.js b/src/contexts/QueryContext.js index a2a38ee59ab9e56e6ee49a305149055c63df216c..160a2c3f049bea41c7fc13f4c751d5d253e973d2 100644 --- a/src/contexts/QueryContext.js +++ b/src/contexts/QueryContext.js @@ -8,6 +8,8 @@ export function QueryContextProvider({ children }) { const [formData, setFormData] = useState(); const [page, setPage] = useState(1); const [fits, setFits] = useState("https://uilennest.net/astrobase/data/191231001/3836665.fits"); + const [dplevel, setDPLevel] = useState(); + const [category, setCategory] = useState(); // const [category, setCategory] = useState(); // const [level, setLevel] = useState(); @@ -21,6 +23,10 @@ export function QueryContextProvider({ children }) { setFormData, fits, setFits, + dplevel, + setDPLevel, + category, + setCategory, }} > {children} diff --git a/src/routes/Routes.js b/src/routes/Routes.js index ab5c04b9795aa146dc0a54304eb50f5d7bef3289..50a8e8c9e45c6dff8f90796f827f3b5a63e34040 100644 --- a/src/routes/Routes.js +++ b/src/routes/Routes.js @@ -21,10 +21,7 @@ export default function Routes() { <Router basename={config.frontend_basename}> <NavBar /> <Switch> - <Route exact path="/"> - <Archives /> - </Route> - <Route exact path="/archives"> + <Route exact path={["/", "/archives"]}> <Archives /> </Route> <Route exact path="/rucio">