Compare commits
5 Commits
6bdb8b6174
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ef3b9935a8 | |||
| 502121b536 | |||
| 4039a74fd7 | |||
|
|
b3358023f1 | ||
|
|
dc9c0d5e59 |
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]
|
||||||
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
|
||||||
@@ -8,12 +8,13 @@ import { Container, Navbar, NavbarItem, NavbarMenu, Section } from 'bloomer';
|
|||||||
import * as local from 'localforage';
|
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'} />);
|
||||||
|
|
||||||
class RouteMenu extends React.Component {
|
class RouteMenu extends React.Component {
|
||||||
constructor(props: any) {
|
constructor(props: any) {
|
||||||
@@ -23,7 +24,7 @@ class RouteMenu extends React.Component {
|
|||||||
chartList: [],
|
chartList: [],
|
||||||
colorMaps: {}
|
colorMaps: {}
|
||||||
}
|
}
|
||||||
fetch('/config.json')
|
fetch(apiDir+'config.json')
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
.then((jsonStr) => {
|
.then((jsonStr) => {
|
||||||
const jsonObj = JSON.parse(jsonStr);
|
const jsonObj = JSON.parse(jsonStr);
|
||||||
@@ -46,15 +47,15 @@ class RouteMenu extends React.Component {
|
|||||||
<Container isFluid={true} isMarginless={true} isFullWidth={true}>
|
<Container isFluid={true} isMarginless={true} isFullWidth={true}>
|
||||||
<Navbar style={{ backgroundColor: '#00D1B2' }}>
|
<Navbar style={{ backgroundColor: '#00D1B2' }}>
|
||||||
<NavbarMenu isActive={true}>
|
<NavbarMenu isActive={true}>
|
||||||
<NavbarItem >{navButton('Charts', '/charts')}</NavbarItem>
|
<NavbarItem >{navButton('Charts', apiDir + 'charts')}</NavbarItem>
|
||||||
<NavbarItem>{navButton('Tables', '/tables')}</NavbarItem>
|
<NavbarItem>{navButton('Tables', apiDir + 'tables')}</NavbarItem>
|
||||||
</NavbarMenu>
|
</NavbarMenu>
|
||||||
</Navbar>
|
</Navbar>
|
||||||
</Container>
|
</Container>
|
||||||
<Section isPaddingless={true}>
|
<Section isPaddingless={true}>
|
||||||
<Route exact={true} path="/" component={RedirectCharts} />
|
<Route exact={true} path={apiDir} component={RedirectCharts} />
|
||||||
<Route path="/charts" component={ConfiguredChart} />
|
<Route path={apiDir + "charts"} component={ConfiguredChart} />
|
||||||
<Route path="/tables" component={ConfiguredServerTab} />
|
<Route path={apiDir + "tables"} component={ConfiguredServerTab} />
|
||||||
</Section>
|
</Section>
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ 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';
|
||||||
@@ -27,7 +28,7 @@ export default class ServerTable extends React.Component<any, any> {
|
|||||||
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,
|
||||||
|
|||||||
@@ -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