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

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

parent df55c956
No related branches found
No related tags found
1 merge request!80Added Loading message to Workflows search page / Move code from IDAContext to service
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 { Button, Form, Container, Alert } from "react-bootstrap";
import { IDAContext } from "../../contexts/IDAContext"; import { IDAContext } from "../../contexts/IDAContext";
import { GlobalContext } from "../../contexts/GlobalContext"; import { GlobalContext } from "../../contexts/GlobalContext";
import "../../assets/Interactive.css"; import "../../assets/Interactive.css";
import LoadingSpinner from "../LoadingSpinner";
export default function Interactive() { export default function Interactive() {
...@@ -15,6 +17,32 @@ export default function Interactive() { ...@@ -15,6 +17,32 @@ export default function Interactive() {
const [showMoreButton, setShowMoreButton] = React.useState(true); const [showMoreButton, setShowMoreButton] = React.useState(true);
const [showDeploy, setShowDeploy] = React.useState(false); const [showDeploy, setShowDeploy] = React.useState(false);
const [numberOfitemsShown, setNumberOfitemsShown] = React.useState(3) 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 = [ let list_of_batchsystems = [
...@@ -22,8 +50,24 @@ export default function Interactive() { ...@@ -22,8 +50,24 @@ export default function Interactive() {
{"name" : "CTA DIRAC", "url" : "https://ccdcta-web.in2p3.fr/DIRAC/"}, {"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)) { if ((!list_of_workflows) || (!list_of_idaSystems) || (!list_of_batchsystems)) {
return null return null;
} }
const handleChange = event => { const handleChange = event => {
......
...@@ -13,27 +13,6 @@ export function IDAContextProvider({ children }) { ...@@ -13,27 +13,6 @@ export function IDAContextProvider({ children }) {
const [list_of_workflows, setList_of_workflows] = useState(); const [list_of_workflows, setList_of_workflows] = useState();
const [list_of_idaSystems, setList_of_idaSystems] = 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 ( return (
<IDAContext.Provider <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