Skip to content
Snippets Groups Projects
Commit 204fce78 authored by Zheng Meyer's avatar Zheng Meyer
Browse files

add console logs and get rid of some warnings

parent 34b16798
No related branches found
No related tags found
1 merge request!5Esap gui dev
......@@ -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>
);
......
......@@ -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>
);
......
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>
......
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 = (
......
......@@ -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>}
......
......@@ -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(
......
......@@ -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}
......
......@@ -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">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment