mirror of
https://gitlab.silvrtree.co.uk/martind2000/mdot_server.git
synced 2025-02-11 06:29:16 +00:00
further graph work
This commit is contained in:
parent
e6a26e642d
commit
7fd457b725
@ -1,3 +1,5 @@
|
|||||||
.panel {
|
.panel {
|
||||||
background-color: rgba(255,255,255,0.95);
|
background-color: rgba(255,255,255,0.95);
|
||||||
|
|
||||||
|
color:rgba(255,0,99,1);
|
||||||
}
|
}
|
||||||
|
@ -347,13 +347,13 @@
|
|||||||
synchronizeGrid: true,
|
synchronizeGrid: true,
|
||||||
valueAxes: [{
|
valueAxes: [{
|
||||||
id: 'lux',
|
id: 'lux',
|
||||||
axisColor: '#FF6600',
|
axisColor: '#FFC802',
|
||||||
axisThickness: 2,
|
axisThickness: 2,
|
||||||
axisAlpha: 1,
|
axisAlpha: 1,
|
||||||
position: 'left'
|
position: 'left'
|
||||||
}, {
|
}, {
|
||||||
id: 'co2',
|
id: 'co2',
|
||||||
axisColor: 'rgba(255,0,99,1)',
|
axisColor: 'rgba(0,191,255,1)',
|
||||||
axisThickness: 2,
|
axisThickness: 2,
|
||||||
axisAlpha: 1,
|
axisAlpha: 1,
|
||||||
position: 'right'
|
position: 'right'
|
||||||
@ -367,7 +367,7 @@
|
|||||||
position: 'left'
|
position: 'left'
|
||||||
}, {
|
}, {
|
||||||
id: 'humid',
|
id: 'humid',
|
||||||
axisColor: 'rgba(0,191,255,1)',
|
axisColor: 'rgba(255,0,99,1)',
|
||||||
axisThickness: 2,
|
axisThickness: 2,
|
||||||
axisAlpha: 1,
|
axisAlpha: 1,
|
||||||
offset: 50,
|
offset: 50,
|
||||||
@ -383,13 +383,13 @@
|
|||||||
}],
|
}],
|
||||||
graphs: [{
|
graphs: [{
|
||||||
valueAxis: 'lux',
|
valueAxis: 'lux',
|
||||||
lineColor: '#FF6600',
|
lineColor: '#FFC802',
|
||||||
title: 'Light Level',
|
title: 'Light Level',
|
||||||
valueField: 'lux',
|
valueField: 'lux',
|
||||||
fillAlphas: 0
|
fillAlphas: 0
|
||||||
}, {
|
}, {
|
||||||
valueAxis: 'co2',
|
valueAxis: 'co2',
|
||||||
lineColor: 'rgba(255,0,99,1)',
|
lineColor: 'rgba(0,191,255,1)',
|
||||||
title: 'Co2',
|
title: 'Co2',
|
||||||
valueField: 'co2',
|
valueField: 'co2',
|
||||||
fillAlphas: 0
|
fillAlphas: 0
|
||||||
@ -401,7 +401,7 @@
|
|||||||
fillAlphas: 0
|
fillAlphas: 0
|
||||||
},{
|
},{
|
||||||
valueAxis: 'humid',
|
valueAxis: 'humid',
|
||||||
lineColor: 'rgba(0,191,255,1)',
|
lineColor: 'rgba(255,0,99,1)',
|
||||||
title: 'Humidity',
|
title: 'Humidity',
|
||||||
valueField: 'humid',
|
valueField: 'humid',
|
||||||
fillAlphas: 0
|
fillAlphas: 0
|
||||||
|
74
app/meeting.html
Normal file
74
app/meeting.html
Normal 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>
|
@ -2,10 +2,11 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Title</title>
|
<title>Graph</title>
|
||||||
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
|
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
|
||||||
<link href="css/test.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"/>
|
<link href="css/style.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script src="lib/mui.js"></script>
|
||||||
<script src="lib/notification.js"></script>
|
<script src="lib/notification.js"></script>
|
||||||
<link rel="stylesheet" href="css/notification.css">
|
<link rel="stylesheet" href="css/notification.css">
|
||||||
</head>
|
</head>
|
||||||
@ -13,8 +14,8 @@
|
|||||||
<div class="mui-container">
|
<div class="mui-container">
|
||||||
<div class='mui-row'>
|
<div class='mui-row'>
|
||||||
<div class="mui-col-md-3 panel">
|
<div class="mui-col-md-3 panel">
|
||||||
<div id="main"></div>
|
<div class='mui-panel' id="main"></div>
|
||||||
<div id="graph"></div>
|
<div class='mui-panel' id="graph"></div>
|
||||||
<div id="output"></div>
|
<div id="output"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mui-col-md-9">
|
<div class="mui-col-md-9">
|
||||||
@ -100,9 +101,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mui-row">
|
<div class="mui-row">
|
||||||
<button id='refresh'
|
<div class="mui-col-md-12">
|
||||||
class="mui-btn mui-btn--small mui-btn--primary">Refresh
|
<button id='refresh'
|
||||||
</button>
|
class="mui-btn mui-btn--small mui-btn--primary">Refresh
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/template" id="list-template">
|
<script type="text/template" id="list-template">
|
||||||
|
85
lib/mdot/meeting.js
Normal file
85
lib/mdot/meeting.js
Normal 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);
|
||||||
|
};
|
||||||
|
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
var logger = require('log4js').getLogger();
|
var logger = require('log4js').getLogger();
|
||||||
var mdot = require('./mdot.js');
|
|
||||||
|
|
||||||
var db = require('../server/db-connector').dbConnection;
|
var db = require('../server/db-connector').dbConnection;
|
||||||
|
|
||||||
|
7
lib/server/db-meeting.js
Normal file
7
lib/server/db-meeting.js
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* User: Martin Donnelly
|
||||||
|
* Date: 2016-08-18
|
||||||
|
* Time: 10:14
|
||||||
|
*
|
||||||
|
*/
|
Loading…
Reference in New Issue
Block a user