diff --git a/src/components/Interactive.js b/src/components/Interactive.js index cdd47b3f024df1b947f8562d76aa137783ec0db4..2cf8a907572c6021db7eb799c8cf0fd861ca1275 100644 --- a/src/components/Interactive.js +++ b/src/components/Interactive.js @@ -1,9 +1,12 @@ import React, { useContext } from "react"; import { Button, Form, Container, Alert } from "react-bootstrap"; import { IDAContext } from "../contexts/IDAContext"; +import { GlobalContext } from "../contexts/GlobalContext"; + 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); + const { api_host } = useContext(GlobalContext); let list_of_batchsystems = [ {"name" : "DIRAC EGI (LOFAR, KM3Net)", "url" : "https://dirac.egi.eu"}, @@ -21,13 +24,12 @@ export default function Interactive() { (event) => setJnotebookURL(list_of_jnotebooks.find((item) => item.name === event.target.value).url) }> <Form.Label> - <h3>Run ESCAPE ESFRI Jupyter Notebooks</h3> + <h3>Select ESCAPE ESFRI Jupyter Workflows (Notebooks)</h3> </Form.Label> <Form.Control className="mt-1" as="select"> {list_of_jnotebooks.map((option) => <option>{option.name}</option>)} </Form.Control> </Form.Group> - <Button href={jnotebookURL} target="_blank">Run selected notebook</Button> </Form> <Form className="mt-5"> <Form.Group controlId="jhub" onChange={ @@ -40,21 +42,10 @@ export default function Interactive() { {list_of_jhubs.map((option) => <option>{option.name}</option>)} </Form.Control> </Form.Group> - <Button href={jhubURL} target="_blank">Launch JupyterHub</Button> - </Form> - <Form className="mt-5"> - <Form.Group controlId="batchsystems" onChange={ - (event) => setBatchsystemsURL(list_of_batchsystems.find((item) => item.name === event.target.value).url) - }> - <Form.Label> - <h3>Select HPC/HTC Services</h3> - </Form.Label> - <Form.Control className="mt-1" as="select"> - {list_of_batchsystems.map((option) => <option>{option.name}</option>)} - </Form.Control> - </Form.Group> - <Button href={batchsystemsURL} target="_blank">Start HPC/HTC service</Button> </Form> + + <Button href={api_host + "ida/deploy?facility=" + jhubURL + "&workflow=" + jnotebookURL} target="_blank">Deploy</Button> + </Container> ); } diff --git a/src/contexts/IDAContext.js b/src/contexts/IDAContext.js index ee95b6e377c73e6ca636593f4fc5ea68b2f37058..357e90fe7a3300dc6a4fbd6c5bf7712b75dab9e4 100644 --- a/src/contexts/IDAContext.js +++ b/src/contexts/IDAContext.js @@ -1,20 +1,16 @@ - -import React, { createContext, useState, useEffect } from "react"; +import React, { createContext, useState, useEffect, useContext } from "react"; import { Alert } from "react-bootstrap"; import axios from "axios"; import getCookie from "../utils/getCookie"; +import { GlobalContext } from "./GlobalContext"; 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 { api_host } = useContext(GlobalContext); const [jhubURL, setJhubURL] = useState("https://srcdev.skatelescope.org/escape"); - const [jnotebookURL, setJnotebookURL] = useState("https://mybinder.org/v2/gh/AMIGA-IAA/hcg-16/master"); + const [jnotebookURL, setJnotebookURL] = useState("https://github.com/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();