Commit e50a43a5 authored by Sonja Happ's avatar Sonja Happ

Dashboards are now reachable via scenarios, removed example dashboard

parent 20967006
......@@ -51,7 +51,6 @@ import Scenario from './scenario/scenario';
import SimulationModel from './simulationmodel/simulation-model';
import Users from './user/users';
import User from './user/user';
import ExDashboard from './dashboard/exdashboard';
import './styles/app.css';
......@@ -146,7 +145,6 @@ class App extends React.Component {
<div className={`app-content app-content-margin-left`}>
<Route exact path="/" component={Home} />
<Route path="/home" component={Home} />
<Route path="/exdashboard/:dashboard" component={Dashboard} />
<Route path="/dashboards/:dashboard" component={Dashboard} />
<Route exact path="/scenarios" component={Scenarios} />
<Route path="/scenarios/:scenario" component={Scenario} />
......@@ -154,7 +152,6 @@ class App extends React.Component {
<Route path="/simulators" component={Simulators} />
<Route path="/user" component={User} />
<Route path="/users" component={Users} />
<Route path="/exdashboard" component={ExDashboard} />
</div>
</div>
......
......@@ -35,7 +35,6 @@ class SidebarMenu extends React.Component {
<li><NavLink to="/home" activeClassName="active" title="Home">Home</NavLink></li>
<li><NavLink to="/scenarios" activeClassName="active" title="Scenarios">Scenarios</NavLink></li>
<li><NavLink to="/simulators" activeClassName="active" title="Simulators">Simulators</NavLink></li>
<li><NavLink to="/exdashboard" activeClassName="active" title="Example Dashboard">Example Dashboard</NavLink></li>
{ this.props.currentRole === 'Admin' ?
<li><NavLink to="/users" activeClassName="active" title="User Management">User Management</NavLink></li> : ''
}
......
import React, { Component } from 'react';
import { Container } from 'flux/utils';
import DashboardStore from './dashboard-store';
import AppDispatcher from '../common/app-dispatcher';
import Table from '../common/table';
import TableColumn from '../common/table-column';
import UserStore from '../user/user-store';
import { Button } from 'react-bootstrap';
import Icon from '../common/icon';
class ExDashboard extends Component {
static getStores() {
return [ DashboardStore ];
}
static calculateState(prevState, props) {
prevState = prevState || {};
console.log("calculateState has been called");
const dashboards = DashboardStore.getState();
let tokenState = UserStore.getState().token;
console.log(dashboards);
return{
dashboards,
tokenState
}
}
componentDidMount() {
AppDispatcher.dispatch({
type: 'dashboards/start-load',
token: this.state.tokenState,
param: '?scenarioID=1'
});
}
loadDash(){
console.log('bis hierhin gekommen');
AppDispatcher.dispatch({
type: 'dashboards/start-load',
token: this.state.tokenState,
param: '?scenarioID=1'
});
}
render() {
const buttonStyle = {
marginLeft: '10px'
};
return (
<div className='section'>
<h1>Dashboards</h1>
<Table data={this.state.dashboards}>
<TableColumn title='Name' dataKey='name' link='/exdashboard/' linkKey='id' />
<TableColumn title='Grid' dataKey='grid' link='/edashboard/' linkKey='id' />
<TableColumn title='ScenarioID' dataKey='scenarioID' link='/exdashboard/' linkKey='id' />
</Table>
<div style={{ float: 'right' }}>
<Button onClick={() => this.loadDash} style={buttonStyle}><Icon icon="plus" /> Add</Button>
</div>
</div>
);
}
}
let fluxContainerConverter = require('../common/FluxContainerConverter');
export default Container.create(fluxContainerConverter.convert(ExDashboard));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment