further graph work

This commit is contained in:
Martin Donnelly 2016-08-18 11:31:26 +01:00
parent e6a26e642d
commit 7fd457b725
7 changed files with 184 additions and 13 deletions

View File

@ -1,3 +1,5 @@
.panel {
background-color: rgba(255,255,255,0.95);
color:rgba(255,0,99,1);
}

View File

@ -347,13 +347,13 @@
synchronizeGrid: true,
valueAxes: [{
id: 'lux',
axisColor: '#FF6600',
axisColor: '#FFC802',
axisThickness: 2,
axisAlpha: 1,
position: 'left'
}, {
id: 'co2',
axisColor: 'rgba(255,0,99,1)',
axisColor: 'rgba(0,191,255,1)',
axisThickness: 2,
axisAlpha: 1,
position: 'right'
@ -367,7 +367,7 @@
position: 'left'
}, {
id: 'humid',
axisColor: 'rgba(0,191,255,1)',
axisColor: 'rgba(255,0,99,1)',
axisThickness: 2,
axisAlpha: 1,
offset: 50,
@ -383,13 +383,13 @@
}],
graphs: [{
valueAxis: 'lux',
lineColor: '#FF6600',
lineColor: '#FFC802',
title: 'Light Level',
valueField: 'lux',
fillAlphas: 0
}, {
valueAxis: 'co2',
lineColor: 'rgba(255,0,99,1)',
lineColor: 'rgba(0,191,255,1)',
title: 'Co2',
valueField: 'co2',
fillAlphas: 0
@ -401,7 +401,7 @@
fillAlphas: 0
},{
valueAxis: 'humid',
lineColor: 'rgba(0,191,255,1)',
lineColor: 'rgba(255,0,99,1)',
title: 'Humidity',
valueField: 'humid',
fillAlphas: 0

74
app/meeting.html Normal file
View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Meetings</title>
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<script src="lib/mui.js"></script>
</head>
<body>
<div class="mui-container">
<div class='mui-row'>
<div class="mui-panel">
<div class="mui--text-title">Meeting Log</div>
</div>
</div>
<div class='mui-row'>
<div class="mui-panel">
<form>
<legend>New Meeting</legend>
<div class="mui-select">
<select id="device" name="device">
<option></option>
<option>
Large Meeting Room
</option>
<option>
Small Meeting Room
</option>
<option>
Lab
</option>
</select> <label>Room</label>
</div>
<div class="mui-row">
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="date" placeholder="" id='from' name="from"/>
<label>Day</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='start' name="start"/>
<label>Start</label>
</div>
</div>
<div class="mui-col-md-4">
<div class="mui-textfield">
<input type="time" placeholder="" id='end' name="end"/>
<label>End</label>
</div>
</div>
</div>
<div class="mui-textfield mui-textfield--float-label">
<input type="number" value="0">
<label>Occupants</label>
</div>
<button type="submit" class="mui-btn mui-btn--raised">Submit</button>
</form>
</div>
</div>
</div>
</body>
</html>

View File

@ -2,10 +2,11 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<title>Graph</title>
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
<link href="css/test.css" rel="stylesheet" type="text/css"/>
<link href="css/style.css" rel="stylesheet" type="text/css"/>
<script src="lib/mui.js"></script>
<script src="lib/notification.js"></script>
<link rel="stylesheet" href="css/notification.css">
</head>
@ -13,8 +14,8 @@
<div class="mui-container">
<div class='mui-row'>
<div class="mui-col-md-3 panel">
<div id="main"></div>
<div id="graph"></div>
<div class='mui-panel' id="main"></div>
<div class='mui-panel' id="graph"></div>
<div id="output"></div>
</div>
<div class="mui-col-md-9">
@ -100,9 +101,12 @@
</div>
</div>
<div class="mui-row">
<button id='refresh'
class="mui-btn mui-btn--small mui-btn--primary">Refresh
</button>
<div class="mui-col-md-12">
<button id='refresh'
class="mui-btn mui-btn--small mui-btn--primary">Refresh
</button>
</div>
</div>
</script>
<script type="text/template" id="list-template">

85
lib/mdot/meeting.js Normal file
View File

@ -0,0 +1,85 @@
/**
*
* User: Martin Donnelly
* Date: 2016-08-12
* Time: 13:41
*
*/
'use strict';
var logger = require('log4js').getLogger();
var db = require('../server/db-connector').dbConnection;
var dbMeeting = require('../server/db-meeting')(db);
module.exports = function(app) {
var express = require('express');
var mdotRouter = express.Router();
mdotRouter.post('/', function(req, res) {
var body = req.body;
var data = {};
logger.debug('body', body);
if (!Object.hasOwnProperty.call(body, 'locationid') || !Object.hasOwnProperty.call(body, 'count') || !Object.hasOwnProperty.call(body, 'total')) {
logger.error('MDot','Missing required parameter');
res.status(400).send({
status: 'error',
error: 'missing required parameter'
});
return;
} else {
data.locationid = req.body.locationid;
data.count = req.body.count;
data.total = req.body.total;
dbMeeting.addNewTrack(data)
.then((d) => {
res.json({d: d});
})
.catch((e) => {
logger.error(e);
res.status(500).json({});
});
}
});
mdotRouter.get('/:id', function(req, res) {
console.log(req.headers);
var data = {};
logger.debug('track-GetData');
if (!req.params.id) {
logger.error('Track','Missing required parameter');
res.status(400).send({
status: 'error',
error: 'missing required parameter'
});
return;
}
if (req.params.hasOwnProperty('id')) {
data.locationid = req.params.id;
dbMeeting.doGet(data)
.then((d) => {
res.json({tracks:d});
})
.catch((e) => {
logger.error(e);
res.status(500).json({});
});
}
});
app.use('/apiv2/meeting/', mdotRouter);
};

View File

@ -7,7 +7,6 @@
*/
'use strict';
var logger = require('log4js').getLogger();
var mdot = require('./mdot.js');
var db = require('../server/db-connector').dbConnection;

7
lib/server/db-meeting.js Normal file
View File

@ -0,0 +1,7 @@
/**
*
* User: Martin Donnelly
* Date: 2016-08-18
* Time: 10:14
*
*/