Skip to content
Snippets Groups Projects
Commit 2a350028 authored by Martin Ledvinka's avatar Martin Ledvinka
Browse files

UI for the setup project.

parent 638b43a5
No related branches found
No related tags found
No related merge requests found
Showing with 176 additions and 16 deletions
......@@ -25,13 +25,18 @@ public class Teacher implements Serializable {
@Column(nullable = false)
private String email;
@Basic(optional = false)
@Column(nullable = false)
private String room;
public Teacher() {
}
public Teacher(String firstName, String lastName, String email) {
public Teacher(String firstName, String lastName, String email, String room) {
this.firstName = firstName;
this.lastName = lastName;
this.email = email;
this.room = room;
}
public Integer getId() {
......@@ -66,6 +71,14 @@ public class Teacher implements Serializable {
this.email = email;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
@Override
public String toString() {
return "Teacher{" + firstName + ' ' + lastName + '}';
......
......@@ -18,10 +18,10 @@ public class DataSetup {
private static List<Teacher> initTeachers() {
final List<Teacher> lst = new ArrayList<>();
lst.add(new Teacher("Miroslav", "Blaško", "miroslav.blasko@fel.cvut.cz"));
lst.add(new Teacher("Bogdan", "Kostov", "bogdan.kostov@fel.cvut.cz"));
lst.add(new Teacher("Martin", "Ledvinka", "martin.ledvinka@fel.cvut.cz"));
lst.add(new Teacher("Petr", "Křemen", "petr.kremen@fel.cvut.cz"));
lst.add(new Teacher("Miroslav", "Blaško", "miroslav.blasko@fel.cvut.cz", "E-227"));
lst.add(new Teacher("Bogdan", "Kostov", "bogdan.kostov@fel.cvut.cz", "E-225c"));
lst.add(new Teacher("Martin", "Ledvinka", "martin.ledvinka@fel.cvut.cz", "E-227"));
lst.add(new Teacher("Petr", "Křemen", "petr.kremen@fel.cvut.cz", "E-227"));
return lst;
}
......
{
"plugins": ["transform-runtime"],
"presets": ["es2015", "react", "stage-0"]
}
\ No newline at end of file
......@@ -20,9 +20,9 @@
<meta charset="UTF-8">
<link rel="stylesheet" href="resources/css/bootstrap.min.css"/>
<link rel="stylesheet" href="resources/css/inbas-audit.css"/>
<link rel="icon" type="image/png" href="resources/images/favicon.png"/>
<link rel="icon" type="image/png" href="resources/images/favicon.ico"/>
<title>Reporting Tool</title>
<title>B6B33EAR Setup Verifier</title>
</head>
<body>
<div id="wrap">
......
'use strict';
import Reflux from 'reflux';
const Actions = Reflux.createActions([
'loadTeachers'
]);
export default Actions;
'use strict';
import React from 'react';
import ReactDOM from 'react-dom';
import {PageHeader} from 'react-bootstrap';
import InfoMessage from './components/InfoMessage';
import TeachersController from './components/TeachersController';
const App = () => {
return <div>
<PageHeader>Your teachers</PageHeader>
<TeachersController/>
<InfoMessage/>
</div>;
};
ReactDOM.render(<App/>, document.getElementById("content"));
'use strict';
import React from 'react';
import {Alert} from 'react-bootstrap';
const InfoMessage = () => {
return <Alert bsStyle="success">If you are seeing this message, your system has all the necessary tools and
libraries
and is prepared for developing projects in the B6B33EAR course. <strong>Congratulations!</strong></Alert>;
};
export default InfoMessage;
'use strict';
import React from 'react';
import {Panel, Table} from 'react-bootstrap';
export default class Teachers extends React.Component {
static propTypes = {
teachers: React.PropTypes.array.isRequired
};
constructor(props) {
super(props);
}
render() {
return <Panel header={<h5>Teachers</h5>} bsStyle="primary">
<Table striped bordered hover condensed>
<thead>
<tr>
<th className="col-xs-3 content-center">First name</th>
<th className="col-xs-3 content-center">Last Name</th>
<th className="col-xs-3 content-center">Contact</th>
<th className="col-xs-2 content-center">Room</th>
</tr>
</thead>
<tbody>
{this._renderRows()}
</tbody>
</Table>
</Panel>;
}
_renderRows() {
var rows = [],
teachers = this.props.teachers;
for (var i = 0, len = teachers.length; i < len; i++) {
rows.push(<Row key={'teacher-' + teachers[i].id} teacher={teachers[i]}/>);
}
return rows;
}
}
const Row = (props) => {
var teacher = props.teacher;
return <tr>
<td>{teacher.firstName}</td>
<td>{teacher.lastName}</td>
<td>{teacher.email}</td>
<td className="content-center">{teacher.room}</td>
</tr>;
};
Row.propTypes = {
teacher: React.PropTypes.object.isRequired
};
'use strict';
import React from 'react';
import Actions from '../actions/Actions';
import Teachers from './Teachers';
import TeacherStore from '../stores/TeacherStore';
export default class TeachersController extends React.Component {
constructor(props) {
super(props);
this.state = {
teachers: []
};
}
componentDidMount() {
Actions.loadTeachers();
this.unsubscribe = TeacherStore.listen(this._onTeachersLoaded);
}
componentWillUnmount() {
this.unsubscribe();
}
_onTeachersLoaded = (data) => {
this.setState({teachers: data});
};
render() {
return <Teachers teachers={this.state.teachers}/>;
}
}
'use strict';
import Reflux from 'reflux';
import request from 'superagent';
import Actions from '../actions/Actions';
const URL = 'rest/teachers';
const TeacherStore = Reflux.createStore({
listenables: [Actions],
onLoadTeachers: function() {
request.get(URL).accept('json').end((err, resp) => {
if (err) {
console.log('Error when loading teachers. Status: ' + err.status);
} else {
this.trigger(resp.body);
}
});
}
});
export default TeacherStore;
......@@ -9,22 +9,14 @@
"keymirror": "~0.1.0",
"object-assign": "~4.0.1",
"superagent": "~1.8.3",
"react-router": "~2.2.1",
"history": "~2.0.1",
"react-bootstrap": "~0.28.5",
"react-router-bootstrap": "~0.22.1",
"body-parser": "~1.15.0",
"express": "~4.13.4",
"reflux": "~0.4.1",
"classnames": "~2.2.3",
"remarkable": "~1.6.2",
"js-cookie": "~2.1.0",
"halogen": "~0.2.0",
"react-intl": "~2.0.1",
"jsonld": "~0.4.6",
"react-dropzone": "~3.4.0",
"react-pivot": "1.14.1",
"react-d3": "0.4.0"
"halogen": "~0.2.0"
},
"devDependencies": {
"babel-core": "^6.7.5",
......
src/main/webapp/resources/images/favicon.ico

13.6 KiB

src/main/webapp/resources/images/favicon.png

1.41 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment