Skip to content
Snippets Groups Projects
Commit 01efd003 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

Merge branch 'dev-stv-ida-loading' into 'master'

Added Loading message to Workflows search page / Move code from IDAContext to service

See merge request astron-sdc/esap-gui!80
parents df55c956 c972c44c
No related branches found
No related tags found
1 merge request!80Added Loading message to Workflows search page / Move code from IDAContext to service
Pipeline #20954 passed
import React, { useContext } from "react";
import React, { createContext, useState, useEffect, useContext } from "react";
import axios from "axios";
import { Button, Form, Container, Alert } from "react-bootstrap";
import { IDAContext } from "../../contexts/IDAContext";
import { GlobalContext } from "../../contexts/GlobalContext";
import "../../assets/Interactive.css";
import LoadingSpinner from "../LoadingSpinner";
export default function Interactive() {
......@@ -15,6 +17,32 @@ export default function Interactive() {
const [showMoreButton, setShowMoreButton] = React.useState(true);
const [showDeploy, setShowDeploy] = React.useState(false);
const [numberOfitemsShown, setNumberOfitemsShown] = React.useState(3)
const [loading, setLoading] = React.useState(true);
// Fetch Notebooks
useEffect(() => {
axios
.get(api_host + "ida/workflows/search")
.then((response) => {
console.log(response);
setList_of_workflows(response.data.results);
setWorkflowURL(response.data.results[0].url);
setLoading(false);
});
}, [api_host]);
// Fetch JHubs
useEffect(() => {
axios
.get(api_host + "ida/facilities/search")
.then((response) => {
setList_of_idaSystems(response.data.results);
setIdaSystemURL(response.data.results[0].url);
});
}, [api_host]);
let list_of_batchsystems = [
......@@ -22,8 +50,24 @@ export default function Interactive() {
{"name" : "CTA DIRAC", "url" : "https://ccdcta-web.in2p3.fr/DIRAC/"},
]
if (loading) {
return (
<Container className="ida" fluid>
<h1>Interactive Analysis</h1>
{ !showFacilities ?
<div class="workflow-div">
<h2>Workflows</h2>
</div>
: null }
<LoadingSpinner/>
</Container>
)
}
if ((!list_of_workflows) || (!list_of_idaSystems) || (!list_of_batchsystems)) {
return null
return null;
}
const handleChange = event => {
......
......@@ -13,27 +13,6 @@ export function IDAContextProvider({ children }) {
const [list_of_workflows, setList_of_workflows] = useState();
const [list_of_idaSystems, setList_of_idaSystems] = useState();
// Fetch Notebooks
useEffect(() => {
axios
.get(api_host + "ida/workflows/search")
.then((response) => {
setList_of_workflows(response.data.results);
setWorkflowURL(response.data.results[0].url);
});
}, [api_host]);
// Fetch JHubs
useEffect(() => {
axios
.get(api_host + "ida/facilities/search")
.then((response) => {
setList_of_idaSystems(response.data.results);
setIdaSystemURL(response.data.results[0].url);
});
}, [api_host]);
return (
<IDAContext.Provider
......
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