mirror of
https://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
synced 2025-02-04 09:40:13 +00:00
Set the server to restart at 7:30am
This commit is contained in:
parent
fccb078638
commit
2d0e89bcb5
16
app.js
16
app.js
@ -24,6 +24,8 @@ var busEmitter = new EventEmitter();
|
|||||||
|
|
||||||
var apn = require('apn');
|
var apn = require('apn');
|
||||||
|
|
||||||
|
require('sugar-date');
|
||||||
|
|
||||||
var calendar = require('./lib/office/officeController.js');
|
var calendar = require('./lib/office/officeController.js');
|
||||||
var cal = new calendar.officeController(busEmitter);
|
var cal = new calendar.officeController(busEmitter);
|
||||||
|
|
||||||
@ -32,6 +34,19 @@ var heating_v1 = require('./routes/heating_v1');
|
|||||||
var projector_v1 = require('./routes/projector_v1');
|
var projector_v1 = require('./routes/projector_v1');
|
||||||
var isProduction = false;
|
var isProduction = false;
|
||||||
|
|
||||||
|
|
||||||
|
function restartTimer() {
|
||||||
|
// Ibm / mqtt things go a bit weird if left on for too long so restart the server
|
||||||
|
// at 7:30 ever morning before anyone is using it.
|
||||||
|
var tom = Date.create('tomorrow at 7:30am');
|
||||||
|
|
||||||
|
var ms = tom.getTime() - Date.create('now').getTime();
|
||||||
|
|
||||||
|
|
||||||
|
console.log('Restarting in: ', ms);
|
||||||
|
setTimeout(function() {process.exit(1);}, ms);
|
||||||
|
|
||||||
|
}
|
||||||
mqttConnect.setEmitter(busEmitter);
|
mqttConnect.setEmitter(busEmitter);
|
||||||
mqttConnect.doConnection();
|
mqttConnect.doConnection();
|
||||||
|
|
||||||
@ -243,4 +258,5 @@ app.post('/api/v1/extend', function(req, res) {
|
|||||||
|
|
||||||
app.listen(3000, function() {
|
app.listen(3000, function() {
|
||||||
logger.info('Express listening on 3000');
|
logger.info('Express listening on 3000');
|
||||||
|
restartTimer();
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,13 @@ body {
|
|||||||
background-color: #004c6d;
|
background-color: #004c6d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#weatherIcon {
|
#weatherIcon {
|
||||||
margin-left:25%;
|
margin-left:25%;
|
||||||
margin-right:25%;
|
margin-right:25%;
|
||||||
|
@ -123,7 +123,8 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mui-row">
|
<div class="mui-row">
|
||||||
<span id="caltext"></span>
|
<div id="caltext"></div>
|
||||||
|
<div id="extendInfo" class="mui--text-subhead mui--text-accent"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -108,6 +108,7 @@ var SOController = (function() {
|
|||||||
'<div class="mui--text-subhead">', d.current.summary,
|
'<div class="mui--text-subhead">', d.current.summary,
|
||||||
'</div>'
|
'</div>'
|
||||||
].join('');
|
].join('');
|
||||||
|
$('#extendInfo').text('');
|
||||||
$('#caltext').html(calString);
|
$('#caltext').html(calString);
|
||||||
$('#calendar:hidden').slideDown();
|
$('#calendar:hidden').slideDown();
|
||||||
} else {
|
} else {
|
||||||
@ -118,24 +119,32 @@ var SOController = (function() {
|
|||||||
|
|
||||||
if (Object.has(calendarData.current, 'actualEnd')) {
|
if (Object.has(calendarData.current, 'actualEnd')) {
|
||||||
now = new Date();
|
now = new Date();
|
||||||
|
var origEnd = new Date(calendarData.current.dtend);
|
||||||
actualEnd = new Date(calendarData.current.actualEnd);
|
actualEnd = new Date(calendarData.current.actualEnd);
|
||||||
var timerDistance = actualEnd.rewind({ minutes: 5 }).getTime() - now.getTime();
|
var timerDistance = actualEnd.addMinutes(-5).getTime() - now.getTime();
|
||||||
var extendTimerFn = function() {
|
var extendTimerFn = function() {
|
||||||
$('#extender:hidden').slideDown();
|
$('#extender:hidden').slideDown();
|
||||||
};
|
};
|
||||||
|
console.log('timerDistance:', timerDistance);
|
||||||
|
|
||||||
|
if (actualEnd.getTime() - origEnd.getTime() > 1000) {
|
||||||
|
var extendInfo = actualEnd.format('Meeting extended until {24hr}:{mm}');
|
||||||
|
$('#extendInfo').text( extendInfo);
|
||||||
|
}
|
||||||
if ((timerDistance > 5000) && (timerDistance < 300000)) {
|
if ((timerDistance > 5000) && (timerDistance < 300000)) {
|
||||||
//ExtendTimer = setTimeout(function() {$('#extender:hidden').slideDown();},timerDistance);
|
//ExtendTimer = setTimeout(function() {$('#extender:hidden').slideDown();},timerDistance);
|
||||||
|
clearTimeout(extendTimer);
|
||||||
extendTimer = setTimeout(extendTimerFn,timerDistance);
|
extendTimer = setTimeout(extendTimerFn,timerDistance);
|
||||||
} else if (timerDistance <= 5000) {
|
} else if (timerDistance <= 5000) {
|
||||||
$('#extender:hidden').slideDown();
|
$('#extender:hidden').slideDown();
|
||||||
} else if (timerDistance > 300000) {
|
} else if (timerDistance > 299999) {
|
||||||
$('#extender:visible').slideUp();
|
$('#extender:visible').slideUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
clearTimeout(extendTimer);
|
clearTimeout(extendTimer);
|
||||||
extendTimer = 0;
|
extendTimer = 0;
|
||||||
|
|
||||||
$('#extender:visible').slideUp();
|
$('#extender:visible').slideUp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
26
custom.css
26
custom.css
@ -654,22 +654,22 @@ h4, h5, h6 {
|
|||||||
background-color: transparent; }
|
background-color: transparent; }
|
||||||
|
|
||||||
.mui-btn--accent {
|
.mui-btn--accent {
|
||||||
color: #FFF;
|
color: #004c6d;
|
||||||
background-color: #69F0AE; }
|
background-color: #bad649; }
|
||||||
.mui-btn--accent:hover, .mui-btn--accent:focus, .mui-btn--accent:active {
|
.mui-btn--accent:hover, .mui-btn--accent:focus, .mui-btn--accent:active {
|
||||||
color: #FFF;
|
color: #004c6d;
|
||||||
background-color: #80f2bb; }
|
background-color: #c2db5e; }
|
||||||
.mui-btn--accent[disabled]:hover, .mui-btn--accent[disabled]:focus, .mui-btn--accent[disabled]:active {
|
.mui-btn--accent[disabled]:hover, .mui-btn--accent[disabled]:focus, .mui-btn--accent[disabled]:active {
|
||||||
color: #FFF;
|
color: #004c6d;
|
||||||
background-color: #69F0AE; }
|
background-color: #bad649; }
|
||||||
.mui-btn--accent.mui-btn--flat {
|
.mui-btn--accent.mui-btn--flat {
|
||||||
color: #69F0AE;
|
color: #bad649;
|
||||||
background-color: transparent; }
|
background-color: transparent; }
|
||||||
.mui-btn--accent.mui-btn--flat:hover, .mui-btn--accent.mui-btn--flat:focus, .mui-btn--accent.mui-btn--flat:active {
|
.mui-btn--accent.mui-btn--flat:hover, .mui-btn--accent.mui-btn--flat:focus, .mui-btn--accent.mui-btn--flat:active {
|
||||||
color: #69F0AE;
|
color: #bad649;
|
||||||
background-color: #f2f2f2; }
|
background-color: #f2f2f2; }
|
||||||
.mui-btn--accent.mui-btn--flat[disabled]:hover, .mui-btn--accent.mui-btn--flat[disabled]:focus, .mui-btn--accent.mui-btn--flat[disabled]:active {
|
.mui-btn--accent.mui-btn--flat[disabled]:hover, .mui-btn--accent.mui-btn--flat[disabled]:focus, .mui-btn--accent.mui-btn--flat[disabled]:active {
|
||||||
color: #69F0AE;
|
color: #bad649;
|
||||||
background-color: transparent; }
|
background-color: transparent; }
|
||||||
|
|
||||||
.mui-btn--small {
|
.mui-btn--small {
|
||||||
@ -1331,7 +1331,7 @@ th {
|
|||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: rgba(0, 0, 0, 0.87);
|
color: rgba(255, 255, 255, 0.87);
|
||||||
cursor: default;
|
cursor: default;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
line-height: 48px;
|
line-height: 48px;
|
||||||
@ -1596,13 +1596,13 @@ th {
|
|||||||
color: rgba(255, 255, 255, 0.3); }
|
color: rgba(255, 255, 255, 0.3); }
|
||||||
|
|
||||||
.mui--text-accent {
|
.mui--text-accent {
|
||||||
color: rgba(105, 240, 174, 0.87); }
|
color: rgba(186, 214, 73, 0.87); }
|
||||||
|
|
||||||
.mui--text-accent-secondary {
|
.mui--text-accent-secondary {
|
||||||
color: rgba(105, 240, 174, 0.54); }
|
color: rgba(186, 214, 73, 0.54); }
|
||||||
|
|
||||||
.mui--text-accent-hint {
|
.mui--text-accent-hint {
|
||||||
color: rgba(105, 240, 174, 0.38); }
|
color: rgba(186, 214, 73, 0.38); }
|
||||||
|
|
||||||
.mui--text-black {
|
.mui--text-black {
|
||||||
color: #000; }
|
color: #000; }
|
||||||
|
@ -5,6 +5,6 @@ $mui-accent-color: #bad649;
|
|||||||
$mui-btn-accent-font-color: #004c6d;
|
$mui-btn-accent-font-color: #004c6d;
|
||||||
$mui-accent-color-dark: mui-color('green', 'A100');
|
$mui-accent-color-dark: mui-color('green', 'A100');
|
||||||
$mui-accent-color-light: mui-color('green', 'A400');
|
$mui-accent-color-light: mui-color('green', 'A400');
|
||||||
|
$mui-tab-font-color: rgba(255, 255, 255, 0.87);
|
||||||
// import MUI SASS
|
// import MUI SASS
|
||||||
@import "bower_components/mui/src/sass/mui";
|
@import "bower_components/mui/src/sass/mui";
|
||||||
|
@ -30,7 +30,7 @@ gulp.task('scripts', function() {
|
|||||||
.pipe(jshint('.jshintrc'))
|
.pipe(jshint('.jshintrc'))
|
||||||
.pipe(jshint.reporter('default'))
|
.pipe(jshint.reporter('default'))
|
||||||
.pipe(concat('app.js'))
|
.pipe(concat('app.js'))
|
||||||
.pipe(stripDebug())
|
// .pipe(stripDebug())
|
||||||
.pipe(jsmin())
|
.pipe(jsmin())
|
||||||
.pipe(size({title: 'Scripts'}))
|
.pipe(size({title: 'Scripts'}))
|
||||||
.pipe(gulp.dest('dist/js'));
|
.pipe(gulp.dest('dist/js'));
|
||||||
|
Loading…
Reference in New Issue
Block a user