Skip to content
Snippets Groups Projects
Commit ba016b72 authored by stvoutsin's avatar stvoutsin
Browse files

Modify IDA UI to read notebooks/jhubs from REST API

parent 221390b0
No related branches found
No related tags found
2 merge requests!17Master,!16Modify IDA UI to read notebooks/jhubs from REST API
Pipeline #13744 passed
......@@ -2,26 +2,14 @@ import React, { useContext } from "react";
import { Button, Form, Container, Alert } from "react-bootstrap";
import { IDAContext } from "../contexts/IDAContext";
export default function Interactive() {
const { jhubURL, setJhubURL, jnotebookURL, setJnotebookURL, batchsystemsURL, setBatchsystemsURL } = useContext(IDAContext);
let list_of_jnotebooks = [
{"name" : "CSIC-IAA HCG-16 workflow", "url" : "https://mybinder.org/v2/gh/AMIGA-IAA/hcg-16/master"},
{"name" : "CDS MOCPy", "url" : "https://mybinder.org/v2/gh/cds-astro/mocpy/master"},
{"name" : "JIVE Jupyter CASA", "url": "https://mybinder.org/v2/gh/aardk/jupyter-casa/master"},
{"name" : "ASTRON VO Apertif", "url" : "https://mybinder.org/v2/gh/zhengmeyer/first-binder.git/master"},]
let list_of_jhubs = [
{"name" : "SKAO JupyterHub", "url" : "https://srcdev.skatelescope.org/escape"},
{"name" : "ASTRON JupyterHub", "url" : "https://sdc.astron.nl/hub/"},
{"name" : "IFAE-PIC JupyterHub", "url" : "https://jupyter.pic.es" },
{"name" : "CERN SWAN Service", "url" : "https://swan.cern.ch/"}]
export default function Interactive() {
const { jhubURL, setJhubURL, jnotebookURL, setJnotebookURL, batchsystemsURL, setBatchsystemsURL, list_of_jnotebooks, setList_of_jnotebooks, list_of_jhubs, setList_of_jhubs} = useContext(IDAContext);
let list_of_batchsystems = [
{"name" : "DIRAC EGI (LOFAR, KM3Net)", "url" : "https://dirac.egi.eu"},
{"name" : "CTA DIRAC", "url" : "https://ccdcta-web.in2p3.fr/DIRAC/"},
]
return (
<Container fluid>
<Form className="mt-5">
......
import React, { useState, createContext } from 'react';
import React, { createContext, useState, useEffect } from "react";
import { Alert } from "react-bootstrap";
import axios from "axios";
import getCookie from "../utils/getCookie";
export const IDAContext = createContext();
export function IDAContextProvider({ children }) {
const api_host =
process.env.NODE_ENV === "development"
? "http://localhost:5555/esap-api/"
: "https://sdc-dev.astron.nl:5555/esap-api/";
const [jhubURL, setJhubURL] = useState("https://srcdev.skatelescope.org/escape");
const [jnotebookURL, setJnotebookURL] = useState("https://mybinder.org/v2/gh/AMIGA-IAA/hcg-16/master");
const [batchsystemsURL, setBatchsystemsURL] = useState("https://dirac.egi.eu");
const [list_of_jnotebooks, setList_of_jnotebooks] = useState();
const [list_of_jhubs, setList_of_jhubs] = useState();
// Fetch Notebooks
useEffect(() => {
axios
.get(api_host + "ida/workflows/search")
.then((response) => {
setList_of_jnotebooks(response.data.results);
});
}, [api_host]);
// Fetch JHubs
useEffect(() => {
axios
.get(api_host + "ida/facilities/search")
.then((response) => {
setList_of_jhubs(response.data.results);
});
}, [api_host]);
return (
<IDAContext.Provider
value={{
......@@ -12,11 +46,15 @@ export function IDAContextProvider({ children }) {
setJhubURL,
jnotebookURL,
setJnotebookURL,
batchsystemsURL,
batchsystemsURL,
setBatchsystemsURL,
list_of_jnotebooks,
setList_of_jnotebooks,
list_of_jhubs,
setList_of_jhubs
}}
>
{children}
</IDAContext.Provider>
)
}
\ No newline at end of file
}
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