indicate non-configured server
This commit is contained in:
parent
e8356c1041
commit
acaf343b64
5 changed files with 75 additions and 29 deletions
|
|
@ -146,7 +146,7 @@
|
||||||
"displayTop": "Cash-in",
|
"displayTop": "Cash-in",
|
||||||
"displayBottom": "Fixed Fee",
|
"displayBottom": "Fixed Fee",
|
||||||
"displayTopCount": 2,
|
"displayTopCount": 2,
|
||||||
"fieldType": "integer",
|
"fieldType": "decimal",
|
||||||
"fieldClass": "fiat",
|
"fieldClass": "fiat",
|
||||||
"cryptoScope": "both",
|
"cryptoScope": "both",
|
||||||
"machineScope": "both",
|
"machineScope": "both",
|
||||||
|
|
|
||||||
|
|
@ -165,8 +165,8 @@ function fetchData () {
|
||||||
{code: 'twilio', display: 'Twilio', class: 'sms'},
|
{code: 'twilio', display: 'Twilio', class: 'sms'},
|
||||||
{code: 'mailjet', display: 'Mailjet', class: 'email'},
|
{code: 'mailjet', display: 'Mailjet', class: 'email'},
|
||||||
{code: 'all-zero-conf', display: 'All pass', class: 'zeroConf'},
|
{code: 'all-zero-conf', display: 'All pass', class: 'zeroConf'},
|
||||||
{code: 'blockcypher', display: 'Blockcypher', class: 'zeroConf'},
|
{code: 'blockcypher', display: 'Blockcypher', class: 'zeroConf', cryptos: ['BTC']},
|
||||||
{code: 'mock-zero-conf', display: 'Mock 0-conf', class: 'zeroConf'}
|
{code: 'mock-zero-conf', display: 'Mock 0-conf', class: 'zeroConf', cryptos: ['BTC']}
|
||||||
],
|
],
|
||||||
machines: machineList.map(machine => ({machine: machine.deviceId, display: machine.name}))
|
machines: machineList.map(machine => ({machine: machine.deviceId, display: machine.name}))
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,12 @@ const machineLoader = require('../machine-loader')
|
||||||
|
|
||||||
const CONSIDERED_UP_SECS = 30
|
const CONSIDERED_UP_SECS = 30
|
||||||
|
|
||||||
|
function checkWasConfigured () {
|
||||||
|
settingsLoader.loadLatest()
|
||||||
|
.then(() => true)
|
||||||
|
.catch(() => false)
|
||||||
|
}
|
||||||
|
|
||||||
function machinesLastPing () {
|
function machinesLastPing () {
|
||||||
const sql = `select min(extract(epoch from (now() - created))) as age
|
const sql = `select min(extract(epoch from (now() - created))) as age
|
||||||
from machine_events
|
from machine_events
|
||||||
|
|
@ -46,8 +52,8 @@ function status () {
|
||||||
order by created desc
|
order by created desc
|
||||||
limit 1`
|
limit 1`
|
||||||
|
|
||||||
return Promise.all([db.oneOrNone(sql, ['ping']), machinesLastPing()])
|
return Promise.all([checkWasConfigured(), db.oneOrNone(sql, ['ping']), machinesLastPing()])
|
||||||
.then(([statusRow, machineStatus]) => {
|
.then(([wasConfigured, statusRow, machineStatus]) => {
|
||||||
const age = statusRow && moment.duration(statusRow.age, 'seconds')
|
const age = statusRow && moment.duration(statusRow.age, 'seconds')
|
||||||
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false
|
const up = statusRow ? statusRow.age < CONSIDERED_UP_SECS : false
|
||||||
const lastPing = statusRow && age.humanize()
|
const lastPing = statusRow && age.humanize()
|
||||||
|
|
@ -56,7 +62,7 @@ function status () {
|
||||||
.catch(() => null)
|
.catch(() => null)
|
||||||
.then(settings => {
|
.then(settings => {
|
||||||
return getRates(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
|
|
@ -484,7 +484,7 @@ p {
|
||||||
|
|
||||||
.lamassuAdminNavBar {
|
.lamassuAdminNavBar {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0 0 80px 0;
|
padding: 0 0 110px 0;
|
||||||
background-color: #2d2d2d;
|
background-color: #2d2d2d;
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
width: 15em;
|
width: 15em;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue