diff --git a/webapp/src/components/graphing/BarGraph.tsx b/webapp/src/components/graphing/BarGraph.tsx index 38f49b0f65633cf74f6952c94cf571031ba10c2a..084a49fa4d79a53e60c7414cf161c00c1648b8eb 100644 --- a/webapp/src/components/graphing/BarGraph.tsx +++ b/webapp/src/components/graphing/BarGraph.tsx @@ -1,4 +1,4 @@ -import React, {ReactElement, useEffect, useState} from 'react'; +import React, {ReactElement} from 'react'; import {Bar} from 'react-chartjs-2'; import {DataSetProps} from './types'; diff --git a/webapp/src/components/graphing/LineGraph.tsx b/webapp/src/components/graphing/LineGraph.tsx index be9d1e026838498672e334e073deadbc1938f8dc..f865ccbf9284d7b1e4944676380a9836a071425d 100644 --- a/webapp/src/components/graphing/LineGraph.tsx +++ b/webapp/src/components/graphing/LineGraph.tsx @@ -1,4 +1,4 @@ -import React, {ReactElement, useEffect, useState} from 'react'; +import React, {ReactElement} from 'react'; import {Line} from 'react-chartjs-2'; import {DataSetProps} from './types'; diff --git a/webapp/src/pages/AnnualReport.tsx b/webapp/src/pages/AnnualReport.tsx index 90f744aa561c339a65605b92c6476155aa505bfd..e4524b65ab5a9b499c7e7f1afe47fdbb3c2aa572 100644 --- a/webapp/src/pages/AnnualReport.tsx +++ b/webapp/src/pages/AnnualReport.tsx @@ -1,60 +1,11 @@ -import React, {useState, useEffect, ReactElement} from 'react'; -import {Nren, Service, ServiceMatrix} from "../Schema"; - - -// const api_url = window.location.origin; -// const api_url = "http://[::1]:33333"; -const api_url = "https://test-compendium01.geant.org"; +import React, {ReactElement} from 'react'; function AnnualReport(): ReactElement { - function api<T>(url: string, options: RequestInit): Promise<T> { - return fetch(url, options) - .then((response) => { - console.log(response) - if (!response.ok) { - return response.text().then((message) => { - console.error(`Failed to load datax: ${message}`, response.status); - throw new Error("The data could not be loaded, check the logs for details."); - }); - } - return response.json() as Promise<T>; - }) - } - - const [nrens, setNrens] = useState<Nren[]>(); - const [services, setServices] = useState<Service[][]>(); - - useEffect(() => { - // let timeoutRef = 0; - const loadData = () => { - api<ServiceMatrix>(api_url+'/service-matrix',{ - referrerPolicy: "unsafe-url", - headers: { - "Access-Control-Allow-Origin": "*", - "Content-Type": "text/plain" - } - }) - .then((serviceMatrix :ServiceMatrix)=>{ - console.log('got response==>nrens'); - console.log(serviceMatrix.nrens); - console.log('got response==>service'); - console.log(serviceMatrix.services); - - setNrens(serviceMatrix.nrens) - setServices(serviceMatrix.services) - }) - - } - loadData() - }, []); return ( <div> <h1>Annual Report</h1> - {/*{nrens?.map(nren=>(*/} - {/* <h4 key={nren.nren_id}>{nren.name}</h4>*/} - {/*))}*/} </div> ); } diff --git a/webapp/src/pages/DataAnalysis.tsx b/webapp/src/pages/DataAnalysis.tsx index e30214ad23a94e51c0ef6036674f7f1cc70c6724..78cd7ebc3d0e082f00f7ea81ea34aee5efc0f82d 100644 --- a/webapp/src/pages/DataAnalysis.tsx +++ b/webapp/src/pages/DataAnalysis.tsx @@ -1,8 +1,7 @@ import React, {ReactElement, useEffect, useState} from 'react'; -import {Accordion, Col, Container, Form, ListGroup, Row} from "react-bootstrap"; +import {Accordion, Col, Container, ListGroup, Row} from "react-bootstrap"; import BarGraph from "../components/graphing/BarGraph"; import LineGraph from "../components/graphing/LineGraph"; -import {DataSetProps} from "../components/graphing/types"; import {BudgetMatrix, DataEntrySection} from "../Schema"; @@ -82,13 +81,6 @@ function DataAnalysis(): ReactElement { loadData() }, [selectedDataEntry]); - const renderEntries = () => { - return ( - <ul> - - </ul> - ); - }; const empty_bar_response = { 'data': { 'datasets': [ @@ -106,25 +98,7 @@ function DataAnalysis(): ReactElement { } const barResponse: BudgetMatrix = budgetResponse !== undefined ? budgetResponse : empty_bar_response; - const data: DataSetProps = { - data: { - datasets: [ - { - backgroundColor: '#114466', - borderColor: '#114466', - data: [10, 13, 18,21,16,12], - label: '2016' - }, - { - backgroundColor: '#FF4466', - borderColor: '#FF4466', - data: [15, null, 13,11,11,44], - label: '2017' - }, - ], - labels: ['AB', 'BC', 'CD', 'DE', 'EF', 'FE'] - } - } + return ( <div>