Compare commits
13 Commits
311180189f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ef3b9935a8 | |||
| 502121b536 | |||
| 4039a74fd7 | |||
|
|
b3358023f1 | ||
|
|
dc9c0d5e59 | ||
|
|
6bdb8b6174 | ||
|
|
97e628c4e1 | ||
|
|
b02c090d03 | ||
|
|
2dcb19c8ee | ||
|
|
2aae9ee455 | ||
|
|
0dcad337ed | ||
|
|
73c30d7f8e | ||
|
|
b2cff623b7 |
3
.env
Normal file
3
.env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
GENERATE_SOURCEMAP=false
|
||||||
|
REACT_APP_API_HOST="http://localhost:5000/test/"
|
||||||
|
REACT_APP_API_DIR="/test/"
|
||||||
2
.env.development
Normal file
2
.env.development
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
REACT_APP_API_HOST="http://localhost:3000/"
|
||||||
|
REACT_APP_API_DIR="/"
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -66,6 +66,7 @@ build/Release
|
|||||||
# Dependency directories
|
# Dependency directories
|
||||||
node_modules/
|
node_modules/
|
||||||
jspm_packages/
|
jspm_packages/
|
||||||
|
build/
|
||||||
|
|
||||||
# Typescript v1 declaration files
|
# Typescript v1 declaration files
|
||||||
typings/
|
typings/
|
||||||
|
|||||||
4
public/.htaccess
Normal file
4
public/.htaccess
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
Options -MultiViews
|
||||||
|
RewriteEngine On
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
|
RewriteRule ^ index.html [QSA,L]
|
||||||
@@ -21,9 +21,31 @@
|
|||||||
"fileName": "data.csv"
|
"fileName": "data.csv"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"chartList":[{
|
"chartList": [{
|
||||||
|
"chartTitle": "Status Plot",
|
||||||
|
"fileName": "data.csv",
|
||||||
|
"chartColumn": "status"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fileName": "data.csv",
|
||||||
|
"chartColumn": "age"
|
||||||
|
}, {
|
||||||
|
"chartTitle": "Another Status Plot",
|
||||||
|
"fileName": "data.csv",
|
||||||
|
"chartColumn": "status"
|
||||||
|
}, {
|
||||||
|
"chartTitle": "Yet Another Status Plot",
|
||||||
|
"fileName": "data.csv",
|
||||||
|
"chartColumn": "status"
|
||||||
|
}, {
|
||||||
"fileName": "data.csv",
|
"fileName": "data.csv",
|
||||||
"chartColumn": "status"
|
"chartColumn": "status"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"colorMaps": {
|
||||||
|
"status": {
|
||||||
|
"complicated": "red",
|
||||||
|
"single": "green"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/App.css
12
src/App.css
@@ -23,8 +23,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.navbar-item:hover {
|
.navbar-item:hover {
|
||||||
background-color: #f0f0f0;
|
background-color: rgba(10, 10, 10, .1);
|
||||||
color: #3273dc;
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* body {
|
||||||
|
font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||||
|
} */
|
||||||
|
|
||||||
|
a,a:hover {
|
||||||
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes App-logo-spin {
|
@keyframes App-logo-spin {
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
import 'bulma/css/bulma.css';
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import AppRoute from './RouteMenu';
|
import RouteMenu from './RouteMenu';
|
||||||
|
|
||||||
class App extends React.Component {
|
class App extends React.Component {
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
<div className="App">
|
<div className="App">
|
||||||
<AppRoute />
|
<RouteMenu />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
} from 'recharts';
|
} from 'recharts';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { Container, Title } from 'bloomer';
|
import { Card, CardImage, CardHeader, CardHeaderTitle } from 'bloomer';
|
||||||
const randomColor = require('randomcolor');
|
const randomColor = require('randomcolor');
|
||||||
import * as Papa from 'papaparse';
|
import * as Papa from 'papaparse';
|
||||||
|
|
||||||
@@ -36,32 +36,45 @@ export class Chart extends React.Component<any, any> {
|
|||||||
value: countMap[k],
|
value: countMap[k],
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const RADIAN = Math.PI / 180;
|
// const RADIAN = Math.PI / 180;
|
||||||
const renderCustomizedLabel = ({ cx, cy, midAngle, innerRadius, outerRadius, percent, index }:any) => {
|
// const renderCustomizedLabel = ({ cx, cy, midAngle, innerRadius, outerRadius, percent, index }:any) => {
|
||||||
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
// const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
||||||
const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
// const x = cx + radius * Math.cos(-midAngle * RADIAN);
|
||||||
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
// const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
||||||
|
//
|
||||||
return (
|
// return (
|
||||||
<text x={x} y={y} fill="white" textAnchor='middle' dominantBaseline="central">
|
// <text x={x} y={y} fill="white" textAnchor='middle' dominantBaseline="central">
|
||||||
{chartData[index].name}
|
// {chartData[index].name}
|
||||||
</text>
|
// </text>
|
||||||
);
|
// );
|
||||||
};
|
// };
|
||||||
|
const colorMap = this.props.colorMap;
|
||||||
|
// const LabeText = (props: any) => {
|
||||||
|
// return (<text>{props.name}</text>);
|
||||||
|
// };
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Card>
|
||||||
<Title isSize={4}>Plotting {_.capitalize(this.props.chartColumn)}</Title>
|
<CardHeader>
|
||||||
<ResponsiveContainer width="100%" height={200}>
|
<CardHeaderTitle className='is-centered'>
|
||||||
<PieChart>
|
{this.props.title}
|
||||||
<Pie data={chartData} dataKey='value' outerRadius={100} label={renderCustomizedLabel} labelLine={false}>
|
</CardHeaderTitle>
|
||||||
{
|
</CardHeader>
|
||||||
chartData.map((_0, _1) => <Cell key={_1} fill={randomColor()} />)
|
<CardImage>
|
||||||
}
|
<ResponsiveContainer width="100%" height={300}>
|
||||||
</Pie>
|
<PieChart>
|
||||||
<Tooltip />
|
<Pie data={chartData} dataKey='value' outerRadius={100} labelLine={true} label={true}>
|
||||||
</PieChart>
|
{
|
||||||
</ResponsiveContainer>
|
chartData.map((_0, _1) => {
|
||||||
</Container>
|
const color = _.get(colorMap, _0.name, randomColor());
|
||||||
|
return (<Cell key={_1} fill={color} />)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</Pie>
|
||||||
|
<Tooltip />
|
||||||
|
</PieChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</CardImage>
|
||||||
|
</Card>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,25 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as _ from 'lodash';
|
|
||||||
import { Columns, Column } from 'bloomer';
|
import { Columns, Column } from 'bloomer';
|
||||||
import * as local from 'localforage';
|
|
||||||
import { Chart } from './Chart';
|
import { Chart } from './Chart';
|
||||||
|
|
||||||
export default class ChartLoader extends React.Component<any, any> {
|
export default class ChartLoader extends React.Component<any, any> {
|
||||||
constructor(props: any) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
chartList: []
|
|
||||||
}
|
|
||||||
fetch('/config.json')
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then((jsonStr) => {
|
|
||||||
const jsonObj = JSON.parse(jsonStr);
|
|
||||||
const chartList = _.get<any>(jsonObj, 'chartList', []);
|
|
||||||
this.setState({ chartList });
|
|
||||||
local.setItem('config', jsonObj).catch((err: any) => {
|
|
||||||
console.error('error occurred when saving config', err);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error('error occurred when loading config', e);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
|
const colorMaps = this.props.colorMaps;
|
||||||
return (
|
return (
|
||||||
<Columns>
|
<Columns isCentered={true} isMultiline={true} style={{
|
||||||
{this.state.chartList.map((o: any, i: number) =>
|
backgroundColor:'#f0f0f0'
|
||||||
<Column key={i} isSize={3}>
|
}}>
|
||||||
<Chart csvFile={o.fileName} chartColumn={o.chartColumn} />
|
{this.props.chartList.map((o: any, i: number) => {
|
||||||
</Column>
|
const colorMap = colorMaps[o.chartColumn];
|
||||||
)}
|
return (
|
||||||
|
<Column key={i} isSize={4}>
|
||||||
|
<Chart
|
||||||
|
csvFile={o.fileName} chartColumn={o.chartColumn}
|
||||||
|
colorMap={colorMap} title={o.chartTitle ? o.chartTitle: o.chartColumn}
|
||||||
|
/>
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</Columns>
|
</Columns>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
2
src/Config.tsx
Normal file
2
src/Config.tsx
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
export const apiHost = process.env.REACT_APP_API_HOST
|
||||||
|
export const apiDir = process.env.REACT_APP_API_DIR
|
||||||
@@ -5,33 +5,61 @@ import {
|
|||||||
Link
|
Link
|
||||||
} from 'react-router-dom';
|
} from 'react-router-dom';
|
||||||
import { Container, Navbar, NavbarItem, NavbarMenu, Section } from 'bloomer';
|
import { Container, Navbar, NavbarItem, NavbarMenu, Section } from 'bloomer';
|
||||||
import 'bulma/css/bulma.css';
|
import * as local from 'localforage';
|
||||||
import ServerTabLoader from './ServerTabLoader';
|
import ServerTabLoader from './ServerTabLoader';
|
||||||
import ChartLoader from './ChartLoader';
|
import ChartLoader from './ChartLoader';
|
||||||
|
import { apiDir } from './Config';
|
||||||
|
|
||||||
const navButton = (name: string, link: string) => (
|
const navButton = (name: string, link: string) => (
|
||||||
<Link to={link}>{name}</Link>
|
<Link to={link}>{name}</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
const RedirectCharts = () => (<Redirect to='/charts' />);
|
const RedirectCharts = () => (<Redirect to={apiDir+'charts'} />);
|
||||||
|
|
||||||
const AppRoute = () => (
|
class RouteMenu extends React.Component {
|
||||||
<Router>
|
constructor(props: any) {
|
||||||
<div>
|
super(props);
|
||||||
<Container isFluid={true} isMarginless={true} isFullWidth={true}>
|
this.state = {
|
||||||
<Navbar style={{ border: 'solid 1px #00D1B2', margin: '0' }}>
|
tabList: [],
|
||||||
<NavbarMenu isActive={true}>
|
chartList: [],
|
||||||
<NavbarItem >{navButton('Charts', '/charts')}</NavbarItem>
|
colorMaps: {}
|
||||||
<NavbarItem>{navButton('Tables', '/tables')}</NavbarItem>
|
}
|
||||||
</NavbarMenu>
|
fetch(apiDir+'config.json')
|
||||||
</Navbar>
|
.then((response) => response.text())
|
||||||
</Container>
|
.then((jsonStr) => {
|
||||||
<Section isPaddingless={true}>
|
const jsonObj = JSON.parse(jsonStr);
|
||||||
<Route exact={true} path="/" component={RedirectCharts} />
|
this.setState({ ...jsonObj });
|
||||||
<Route path="/charts" component={ChartLoader} />
|
local.setItem('config', jsonObj).catch((err: any) => {
|
||||||
<Route path="/tables" component={ServerTabLoader} />
|
console.error('error occurred when saving config', err);
|
||||||
</Section>
|
});
|
||||||
</div>
|
})
|
||||||
</Router>
|
.catch((e) => {
|
||||||
)
|
console.error('error occurred when loading config', e);
|
||||||
export default AppRoute
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
const ConfiguredChart = () => (<ChartLoader {...this.state} />);
|
||||||
|
const ConfiguredServerTab = () => (<ServerTabLoader {...this.state} />);
|
||||||
|
return (
|
||||||
|
<Router>
|
||||||
|
<div>
|
||||||
|
<Container isFluid={true} isMarginless={true} isFullWidth={true}>
|
||||||
|
<Navbar style={{ backgroundColor: '#00D1B2' }}>
|
||||||
|
<NavbarMenu isActive={true}>
|
||||||
|
<NavbarItem >{navButton('Charts', apiDir + 'charts')}</NavbarItem>
|
||||||
|
<NavbarItem>{navButton('Tables', apiDir + 'tables')}</NavbarItem>
|
||||||
|
</NavbarMenu>
|
||||||
|
</Navbar>
|
||||||
|
</Container>
|
||||||
|
<Section isPaddingless={true}>
|
||||||
|
<Route exact={true} path={apiDir} component={RedirectCharts} />
|
||||||
|
<Route path={apiDir + "charts"} component={ConfiguredChart} />
|
||||||
|
<Route path={apiDir + "tables"} component={ConfiguredServerTab} />
|
||||||
|
</Section>
|
||||||
|
</div>
|
||||||
|
</Router>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
export default RouteMenu
|
||||||
|
|||||||
@@ -1,75 +1,29 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as _ from 'lodash';
|
|
||||||
import ServerTable from './ServerTable';
|
import ServerTable from './ServerTable';
|
||||||
import { Tabs, TabList, TabPanel, Tab } from 'react-tabs';
|
import { Tabs, TabList, TabPanel, Tab } from 'react-tabs';
|
||||||
import { Hero, HeroBody } from 'bloomer';
|
import { Hero, HeroBody } from 'bloomer';
|
||||||
import * as local from 'localforage';
|
|
||||||
import './Tabs.css';
|
import './Tabs.css';
|
||||||
|
|
||||||
|
|
||||||
export default class ServerTabLoader extends React.Component<any, any> {
|
export default class ServerTabLoader extends React.Component<any, any> {
|
||||||
constructor(props: any) {
|
|
||||||
super(props);
|
|
||||||
this.state = {
|
|
||||||
tabList: []
|
|
||||||
}
|
|
||||||
fetch('/config.json')
|
|
||||||
.then((response) => response.text())
|
|
||||||
.then((jsonStr) => {
|
|
||||||
const jsonObj = JSON.parse(jsonStr);
|
|
||||||
const tabList = _.get<any>(jsonObj, 'tabList', []);
|
|
||||||
this.setState({ tabList });
|
|
||||||
local.setItem('config', jsonObj).catch((err: any) => {
|
|
||||||
console.error('error occurred when saving config', err);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.catch((e) => {
|
|
||||||
console.error('error occurred when loading config', e);
|
|
||||||
});
|
|
||||||
// TODO: enable localstore to load config
|
|
||||||
// const onLocal = (config: any) => {
|
|
||||||
// if (config) {
|
|
||||||
// const tabList = _.get<any>(config, 'tabList', []);
|
|
||||||
// this.setState({ tabList });
|
|
||||||
// } else {
|
|
||||||
// fetch('/config.json')
|
|
||||||
// .then((response) => response.text())
|
|
||||||
// .then((jsonStr) => {
|
|
||||||
// const jsonObj = JSON.parse(jsonStr);
|
|
||||||
// const tabList = _.get<any>(jsonObj, 'tabList', []);
|
|
||||||
// this.setState({ tabList });
|
|
||||||
// local.setItem('config', jsonObj).then((val: any) => {
|
|
||||||
// console.log('saved to localstore ',val);
|
|
||||||
// }).catch((err:any) => {
|
|
||||||
// console.error('error occurred when saving config', err);
|
|
||||||
// });
|
|
||||||
// })
|
|
||||||
// .catch((e) => {
|
|
||||||
// this.setState({ message: e.stack, showMessage: true });
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
// local.getItem('config').then(onLocal).catch((err: any) => {
|
|
||||||
// // This code runs if there were any errors
|
|
||||||
// console.error('error occurred when getting config from localstore', err);
|
|
||||||
// });
|
|
||||||
}
|
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
return (
|
return (
|
||||||
<Hero isColor='light' isSize='large' isFullWidth={true} isFullHeight={true}>
|
<Hero isColor='light' isSize='large' isFullWidth={true} isFullHeight={true}>
|
||||||
<HeroBody isPaddingless={true} isDisplay='block'>
|
<HeroBody isPaddingless={true} isDisplay='block'>
|
||||||
<Tabs forceRenderTabPanel={true}>
|
<Tabs forceRenderTabPanel={true}>
|
||||||
<TabList>
|
<TabList>
|
||||||
{this.state.tabList.map((o: any, i: number) =>
|
{this.props.tabList.map((o: any, i: number) =>
|
||||||
(<Tab key={i}>{o.tabTitle}</Tab>)
|
(<Tab key={i}>{o.tabTitle}</Tab>)
|
||||||
)}
|
)}
|
||||||
</TabList>
|
</TabList>
|
||||||
{this.state.tabList.map((o: any, i: number) =>
|
{this.props.tabList.map((o: any, i: number) => {
|
||||||
(<TabPanel key={i}>
|
const colorMap = this.props.colorMaps[o.colorColumn];
|
||||||
<ServerTable csvFile={o.fileName} colorColumn={o.colorColumn} />
|
return (
|
||||||
</TabPanel>
|
<TabPanel key={i}>
|
||||||
)
|
<ServerTable csvFile={o.fileName} colorColumn={o.colorColumn} colorMap={colorMap} />
|
||||||
|
</TabPanel>
|
||||||
|
);
|
||||||
|
}
|
||||||
)}
|
)}
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</HeroBody>
|
</HeroBody>
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|||||||
import { Tips } from "./Utils";
|
import { Tips } from "./Utils";
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
import { Button } from 'bloomer';
|
import { Button } from 'bloomer';
|
||||||
const randomColor = require('randomcolor');
|
// const randomColor = require('randomcolor');
|
||||||
|
import { apiDir } from './Config';
|
||||||
const reactcsv = require('react-csv');
|
const reactcsv = require('react-csv');
|
||||||
const CSVLink = reactcsv.CSVLink;
|
const CSVLink = reactcsv.CSVLink;
|
||||||
import * as Papa from 'papaparse';
|
import * as Papa from 'papaparse';
|
||||||
@@ -19,15 +20,15 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
}
|
}
|
||||||
const loaded = (results: any) => {
|
const loaded = (results: any) => {
|
||||||
const local = this;
|
const local = this;
|
||||||
const colsUnique = _.keys(_.groupBy(results.data, (o: any) => _.get<any>(o, this.props.colorColumn)));
|
// const colsUnique = _.keys(_.groupBy(results.data, (o: any) => _.get<any>(o, this.props.colorColumn)));
|
||||||
const colColorMap = _.zipObject(colsUnique, _.map(colsUnique, () => randomColor()));
|
const colColorMap = this.props.colorMap; // _.zipObject(colsUnique, _.map(colsUnique, () => randomColor()));
|
||||||
local.setState({
|
local.setState({
|
||||||
headers: results.meta.fields,
|
headers: results.meta.fields,
|
||||||
data: results.data,
|
data: results.data,
|
||||||
colColorMap
|
colColorMap
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Papa.parse(this.props.csvFile, {
|
Papa.parse(apiDir + this.props.csvFile, {
|
||||||
header: true,
|
header: true,
|
||||||
download: true,
|
download: true,
|
||||||
skipEmptyLines: true,
|
skipEmptyLines: true,
|
||||||
@@ -40,8 +41,8 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
const data = this.state.data;
|
const data = this.state.data;
|
||||||
const headers = this.state.headers;
|
const headers = this.state.headers;
|
||||||
const filterPart = (filter: any, row: any) =>
|
const filterPart = (filter: any, row: any) =>
|
||||||
String(row[filter.id]).startsWith(filter.value) ||
|
String(_.toLower(row[filter.id])).startsWith(_.toLower(filter.value)) ||
|
||||||
String(row[filter.id]).endsWith(filter.value)
|
String(_.toLower(row[filter.id])).endsWith(_.toLower(filter.value))
|
||||||
const headerGen = (headerName: string) => {
|
const headerGen = (headerName: string) => {
|
||||||
// const title = headerName
|
// const title = headerName
|
||||||
// .replace(/([A-Z])/g, ' $1')
|
// .replace(/([A-Z])/g, ' $1')
|
||||||
@@ -61,13 +62,18 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const colValue = _.get<any>(rowInfo.row, colorCol, '');
|
const colValue = _.get<any>(rowInfo.row, colorCol, '');
|
||||||
const colColor = _.get<any>(colColorMap, colValue, 'green');
|
const colColor = _.get<any>(colColorMap, colValue, 'white');
|
||||||
return {
|
return {
|
||||||
style: {
|
style: {
|
||||||
background: colColor
|
background: colColor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
const colStyle = () => ({
|
||||||
|
style: {
|
||||||
|
textAlign: 'left'
|
||||||
|
}
|
||||||
|
});
|
||||||
const headerCols = headers.map(headerGen);
|
const headerCols = headers.map(headerGen);
|
||||||
return (
|
return (
|
||||||
<ReactTable
|
<ReactTable
|
||||||
@@ -79,6 +85,7 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
defaultPageSize={100}
|
defaultPageSize={100}
|
||||||
className="-striped -highlight"
|
className="-striped -highlight"
|
||||||
getTrProps={rowStyle}
|
getTrProps={rowStyle}
|
||||||
|
getTdProps={colStyle}
|
||||||
style={{
|
style={{
|
||||||
height: "75vh"
|
height: "75vh"
|
||||||
}}
|
}}
|
||||||
@@ -88,7 +95,6 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{makeTable()}
|
{makeTable()}
|
||||||
{/* <Chart data={lastFiltered} /> */}
|
|
||||||
<Button>
|
<Button>
|
||||||
<CSVLink data={lastFiltered} filename={"data.csv"}>
|
<CSVLink data={lastFiltered} filename={"data.csv"}>
|
||||||
Download CSV
|
Download CSV
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ import * as React from 'react';
|
|||||||
import * as ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import registerServiceWorker from './registerServiceWorker';
|
// import registerServiceWorker from './registerServiceWorker';
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<App />,
|
<App />,
|
||||||
document.getElementById('root') as HTMLElement
|
document.getElementById('root') as HTMLElement
|
||||||
);
|
);
|
||||||
registerServiceWorker();
|
// registerServiceWorker();
|
||||||
|
|||||||
Reference in New Issue
Block a user