Skip to content

Commit

Permalink
bug fixes, style improvements½
Browse files Browse the repository at this point in the history
- fixed http error range check
- numerous style tweaks,
 better default behaviour
  • Loading branch information
shukriadams committed Aug 6, 2019
1 parent 772345a commit 5a64b38
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/lib/daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class CronProcess
async work(){
try {

this.errorMessage = null;
this.isPassing = true;
this.lastRun = new Date();

if (this.config.test){
Expand All @@ -99,6 +97,8 @@ class CronProcess
} else {
// do a simple http get
await httpHelper.downloadString(this.config.url);
this.isPassing = true;
this.errorMessage = null;
}


Expand Down
4 changes: 2 additions & 2 deletions src/lib/httpHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module.exports = {
function(error, response) {
if (error)
return reject(error);

if (code && code < 200 && code >= 300) // allow all code 2**
if (code && (code < 200 || code >= 300)) // allow all code 2**
return reject(`Error : server responded with code ${code}.`);

resolve(response);
Expand Down
1 change: 1 addition & 0 deletions src/public/css/iframe.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ body {
padding: 0;
margin: 0;
overflow: hidden;
background-color: #A82800;
}

iframe {
Expand Down
19 changes: 18 additions & 1 deletion src/public/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ footer {
display: inline;
}

.table-cellValue {
.table-cell {
padding: 8px /* universal Unit */;
word-break: break-all;
word-wrap: break-word;
Expand Down Expand Up @@ -176,6 +176,23 @@ footer {
font-weight: bold;
}

.nextCheck {
position: absolute;
bottom: 0;
text-align: center;
width: 100%;
}

.errorMessage {
margin-bottom: 20px;
}

.table-cell--content{
height: 118px;
max-height: 118px;
overflow: hidden;
}

@media all and (min-width: 501px) {

}
Expand Down
9 changes: 9 additions & 0 deletions src/public/js/base.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var clientRefreshInterval = document.querySelector('body').getAttribute('data-clientRefreshInterval');
var updateInSeconds = document.querySelector('.layout-updateTime');
var renderTime = null; //new Date(document.querySelector('.renderTime').getAttribute('data-value'));
var dateFields = document.querySelectorAll('[data-formatDate]');

var nowHolder = document.querySelector('.now');
var now = new Date();
Expand All @@ -10,6 +11,14 @@ if (clientRefreshInterval)
clientRefreshInterval = parseInt(clientRefreshInterval);


for (var i = 0 ; i < dateFields.length ; i ++)
{
let dateField = dateFields[i];
let date = new Date(dateField.getAttribute('data-formatDate'));
let formatted = date.toLocaleTimeString();
dateField.innerHTML = formatted;
}

function showTimes(){
let agos = document.querySelectorAll('.date-ago');

Expand Down
8 changes: 8 additions & 0 deletions src/public/js/iframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@

function update(){
inactiveFrame.contentWindow.location = '/status'

var timeOut = setTimeout(function(){
activeFrame.classList.remove('iframe--show');
inactiveFrame.classList.remove('iframe--show');

}, 10000)

inactiveFrame.onload = function(){
clearTimeout(timeOut);
setTimeout(function(){
inactiveFrame.classList.add('iframe--show');
activeFrame.classList.remove('iframe--show');
Expand Down
19 changes: 11 additions & 8 deletions src/views/pages/status.hbs
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
{{#extend "layout"}}
{{#content "body"}}
<div class="table">
<div>
{{#if jobs.length}}
{{#each jobs}}
<div class="table-row job {{#if isPassing}}job--passing{{/if}}">

<div class="table-cell table-cell--header">
<div class="table-cellValue name">
<div class="name">
{{config.name}}
</div>
</div>

<div class="table-cell table-cell--content">
{{#if isPassing}}
<img class="icon-passing" src="/icons/passing.svg" alt="Passing" />
{{else}}
{{ago statusDate}} - {{errorMessage}}
{{/if}}
</div>
<div class="table-cell">
<div class="table-cellValue">
{{#if isPassing}}
<img class="icon-passing" src="/icons/passing.svg" alt="Passing" />
{{else}}
{{errorMessage}} ({{ago statusDate}})
{{/if}}
<div class="nextCheck">
Next check : <span data-formatDate="{{nextRun}}"></span>
</div>
</div>
</div>
Expand Down

0 comments on commit 5a64b38

Please sign in to comment.