indicate non-configured server

This commit is contained in:
Josh Harvey 2017-05-31 15:08:33 +01:00
parent e8356c1041
commit acaf343b64
5 changed files with 75 additions and 29 deletions

View file

@ -146,7 +146,7 @@
"displayTop": "Cash-in",
"displayBottom": "Fixed Fee",
"displayTopCount": 2,
"fieldType": "integer",
"fieldType": "decimal",
"fieldClass": "fiat",
"cryptoScope": "both",
"machineScope": "both",

View file

@ -165,8 +165,8 @@ function fetchData () {
{code: 'twilio', display: 'Twilio', class: 'sms'},
{code: 'mailjet', display: 'Mailjet', class: 'email'},
{code: 'all-zero-conf', display: 'All pass', class: 'zeroConf'},
{code: 'blockcypher', display: 'Blockcypher', class: 'zeroConf'},
{code: 'mock-zero-conf', display: 'Mock 0-conf', class: 'zeroConf'}
{code: 'blockcypher', display: 'Blockcypher', class: 'zeroConf', cryptos: ['BTC']},
{code: 'mock-zero-conf', display: 'Mock 0-conf', class: 'zeroConf', cryptos: ['BTC']}
],
machines: machineList.map(machine => ({machine: machine.deviceId, display: machine.name}))
}))

View file

@ -9,6 +9,12 @@ const machineLoader = require('../machine-loader')
const CONSIDERED_UP_SECS = 30
function checkWasConfigured () {
settingsLoader.loadLatest()
.then(() => true)
.catch(() => false)
}
function machinesLastPing () {
const sql = `select min(extract(epoch from (now() - created))) as age
from machine_events
@ -46,8 +52,8 @@ function status () {
order by created desc
limit 1`
return Promise.all([db.oneOrNone(sql, ['ping']), machinesLastPing()])
.then(([statusRow, machineStatus]) => {
return Promise.all([checkWasConfigured(), db.oneOrNone(sql, ['ping']), machinesLastPing()])
.then(([wasConfigured, statusRow, machineStatus]) => {
const age = statusRow && moment.duration(statusRow.age, 'seconds')
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false
const lastPing = statusRow && age.humanize()
@ -56,7 +62,7 @@ function status () {
.catch(() => null)
.then(settings => {
return getRates(settings)
.then(rates => ({up, lastPing, rates, machineStatus}))
.then(rates => ({wasConfigured, up, lastPing, rates, machineStatus}))
})
})
}

File diff suppressed because one or more lines are too long

View file

@ -484,7 +484,7 @@ p {
.lamassuAdminNavBar {
margin: 0;
padding: 0 0 80px 0;
padding: 0 0 110px 0;
background-color: #2d2d2d;
font-size: 18px;
width: 15em;