mirror of
https://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
synced 2025-01-10 21:05:09 +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');
|
||||
|
||||
require('sugar-date');
|
||||
|
||||
var calendar = require('./lib/office/officeController.js');
|
||||
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 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.doConnection();
|
||||
|
||||
@ -243,4 +258,5 @@ app.post('/api/v1/extend', function(req, res) {
|
||||
|
||||
app.listen(3000, function() {
|
||||
logger.info('Express listening on 3000');
|
||||
restartTimer();
|
||||
});
|
||||
|
@ -3,6 +3,13 @@ body {
|
||||
background-color: #004c6d;
|
||||
}
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#weatherIcon {
|
||||
margin-left:25%;
|
||||
margin-right:25%;
|
||||
|
@ -123,7 +123,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<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>
|
||||
|
@ -108,6 +108,7 @@ var SOController = (function() {
|
||||
'<div class="mui--text-subhead">', d.current.summary,
|
||||
'</div>'
|
||||
].join('');
|
||||
$('#extendInfo').text('');
|
||||
$('#caltext').html(calString);
|
||||
$('#calendar:hidden').slideDown();
|
||||
} else {
|
||||
@ -118,24 +119,32 @@ var SOController = (function() {
|
||||
|
||||
if (Object.has(calendarData.current, 'actualEnd')) {
|
||||
now = new Date();
|
||||
var origEnd = new Date(calendarData.current.dtend);
|
||||
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() {
|
||||
$('#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)) {
|
||||
//ExtendTimer = setTimeout(function() {$('#extender:hidden').slideDown();},timerDistance);
|
||||
clearTimeout(extendTimer);
|
||||
extendTimer = setTimeout(extendTimerFn,timerDistance);
|
||||
} else if (timerDistance <= 5000) {
|
||||
$('#extender:hidden').slideDown();
|
||||
} else if (timerDistance > 300000) {
|
||||
} else if (timerDistance > 299999) {
|
||||
$('#extender:visible').slideUp();
|
||||
}
|
||||
|
||||
} else {
|
||||
clearTimeout(extendTimer);
|
||||
extendTimer = 0;
|
||||
|
||||
$('#extender:visible').slideUp();
|
||||
}
|
||||
}
|
||||
|
26
custom.css
26
custom.css
@ -654,22 +654,22 @@ h4, h5, h6 {
|
||||
background-color: transparent; }
|
||||
|
||||
.mui-btn--accent {
|
||||
color: #FFF;
|
||||
background-color: #69F0AE; }
|
||||
color: #004c6d;
|
||||
background-color: #bad649; }
|
||||
.mui-btn--accent:hover, .mui-btn--accent:focus, .mui-btn--accent:active {
|
||||
color: #FFF;
|
||||
background-color: #80f2bb; }
|
||||
color: #004c6d;
|
||||
background-color: #c2db5e; }
|
||||
.mui-btn--accent[disabled]:hover, .mui-btn--accent[disabled]:focus, .mui-btn--accent[disabled]:active {
|
||||
color: #FFF;
|
||||
background-color: #69F0AE; }
|
||||
color: #004c6d;
|
||||
background-color: #bad649; }
|
||||
.mui-btn--accent.mui-btn--flat {
|
||||
color: #69F0AE;
|
||||
color: #bad649;
|
||||
background-color: transparent; }
|
||||
.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; }
|
||||
.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; }
|
||||
|
||||
.mui-btn--small {
|
||||
@ -1331,7 +1331,7 @@ th {
|
||||
text-transform: uppercase;
|
||||
font-weight: 500;
|
||||
font-size: 14px;
|
||||
color: rgba(0, 0, 0, 0.87);
|
||||
color: rgba(255, 255, 255, 0.87);
|
||||
cursor: default;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
@ -1596,13 +1596,13 @@ th {
|
||||
color: rgba(255, 255, 255, 0.3); }
|
||||
|
||||
.mui--text-accent {
|
||||
color: rgba(105, 240, 174, 0.87); }
|
||||
color: rgba(186, 214, 73, 0.87); }
|
||||
|
||||
.mui--text-accent-secondary {
|
||||
color: rgba(105, 240, 174, 0.54); }
|
||||
color: rgba(186, 214, 73, 0.54); }
|
||||
|
||||
.mui--text-accent-hint {
|
||||
color: rgba(105, 240, 174, 0.38); }
|
||||
color: rgba(186, 214, 73, 0.38); }
|
||||
|
||||
.mui--text-black {
|
||||
color: #000; }
|
||||
|
@ -5,6 +5,6 @@ $mui-accent-color: #bad649;
|
||||
$mui-btn-accent-font-color: #004c6d;
|
||||
$mui-accent-color-dark: mui-color('green', 'A100');
|
||||
$mui-accent-color-light: mui-color('green', 'A400');
|
||||
|
||||
$mui-tab-font-color: rgba(255, 255, 255, 0.87);
|
||||
// import MUI SASS
|
||||
@import "bower_components/mui/src/sass/mui";
|
||||
|
@ -30,7 +30,7 @@ gulp.task('scripts', function() {
|
||||
.pipe(jshint('.jshintrc'))
|
||||
.pipe(jshint.reporter('default'))
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(stripDebug())
|
||||
// .pipe(stripDebug())
|
||||
.pipe(jsmin())
|
||||
.pipe(size({title: 'Scripts'}))
|
||||
.pipe(gulp.dest('dist/js'));
|
||||
|
Loading…
Reference in New Issue
Block a user