Skip to content
Snippets Groups Projects
Commit 4469e9d4 authored by Ian Galpin's avatar Ian Galpin
Browse files

Removed unused react components and functions to clean up tsc output

parent 0e9f7ee8
No related branches found
No related tags found
No related merge requests found
import React, {ReactElement, useEffect, useState} from 'react'; import React, {ReactElement} from 'react';
import {Bar} from 'react-chartjs-2'; import {Bar} from 'react-chartjs-2';
import {DataSetProps} from './types'; import {DataSetProps} from './types';
......
import React, {ReactElement, useEffect, useState} from 'react'; import React, {ReactElement} from 'react';
import {Line} from 'react-chartjs-2'; import {Line} from 'react-chartjs-2';
import {DataSetProps} from './types'; import {DataSetProps} from './types';
......
import React, {useState, useEffect, ReactElement} from 'react'; import React, {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";
function AnnualReport(): ReactElement { 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 ( return (
<div> <div>
<h1>Annual Report</h1> <h1>Annual Report</h1>
{/*{nrens?.map(nren=>(*/}
{/* <h4 key={nren.nren_id}>{nren.name}</h4>*/}
{/*))}*/}
</div> </div>
); );
} }
......
import React, {ReactElement, useEffect, useState} from 'react'; 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 BarGraph from "../components/graphing/BarGraph";
import LineGraph from "../components/graphing/LineGraph"; import LineGraph from "../components/graphing/LineGraph";
import {DataSetProps} from "../components/graphing/types";
import {BudgetMatrix, DataEntrySection} from "../Schema"; import {BudgetMatrix, DataEntrySection} from "../Schema";
...@@ -82,13 +81,6 @@ function DataAnalysis(): ReactElement { ...@@ -82,13 +81,6 @@ function DataAnalysis(): ReactElement {
loadData() loadData()
}, [selectedDataEntry]); }, [selectedDataEntry]);
const renderEntries = () => {
return (
<ul>
</ul>
);
};
const empty_bar_response = { const empty_bar_response = {
'data': { 'data': {
'datasets': [ 'datasets': [
...@@ -106,25 +98,7 @@ function DataAnalysis(): ReactElement { ...@@ -106,25 +98,7 @@ function DataAnalysis(): ReactElement {
} }
const barResponse: BudgetMatrix = budgetResponse !== undefined ? budgetResponse : empty_bar_response; 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 ( return (
<div> <div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment