fix: pre release screen fixes

This commit is contained in:
Taranto 2020-06-16 09:43:58 +01:00 committed by Josh Harvey
parent 1bcc87757b
commit 5dd8501a17
98 changed files with 1569 additions and 1149 deletions

View file

@ -1,3 +1,4 @@
const _ = require('lodash/fp')
const { COINS, ALL_CRYPTOS } = require('./coins')
const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS

View file

@ -5,6 +5,7 @@ const configManager = require('../new-config-manager')
const wallet = require('../wallet')
const ticker = require('../ticker')
const coinUtils = require('../coin-utils')
const logger = require('../logger')
function allScopes (cryptoScopes, machineScopes) {
const scopes = []
@ -68,6 +69,9 @@ function getSingleCoinFunding (settings, fiatCode, cryptoCode) {
})
}
// Promise.allSettled not running on current version of node
const reflect = p => p.then(value => ({value, status: "fulfilled" }), error => ({error: error.toString(), status: "rejected" }))
function getFunding () {
return settingsLoader.loadLatest().then(settings => {
const cryptoCodes = configManager.getAllCryptoCurrencies(settings.config)
@ -77,9 +81,10 @@ function getFunding () {
const cryptoDisplays = _.filter(pareCoins, cryptoCurrencies)
const promises = cryptoDisplays.map(it => getSingleCoinFunding(settings, fiatCode, it.cryptoCode))
return Promise.all(promises)
return Promise.all(promises.map(reflect))
.then((response) => {
return _.toArray(_.merge(response, cryptoDisplays))
const mapped = response.map(it => _.merge({ errorMsg: it.error }, it.value))
return _.toArray(_.merge(mapped, cryptoDisplays))
})
})
}

View file

@ -19,7 +19,6 @@ const serverLogs = require('../server-logs')
const pairing = require('../pairing')
const { accounts: accountsConfig, coins, countries, currencies, languages } = require('../config')
// TODO why does server logs messages can be null?
const typeDefs = gql`
scalar JSON
scalar JSONObject
@ -54,6 +53,10 @@ const typeDefs = gql`
name: String!
deviceId: ID!
paired: Boolean!
lastPing: Date
pairedAt: Date
version: String
model: String
cashbox: Int
cassette1: Int
cassette2: Int
@ -123,21 +126,22 @@ const typeDefs = gql`
type CoinFunds {
cryptoCode: String!
fundingAddress: String!
fundingAddressUrl: String!
confirmedBalance: String!
pending: String!
fiatConfirmedBalance: String!
fiatPending: String!
fiatCode: String!
display: String!
unitScale: String!
errorMsg: String
fundingAddress: String
fundingAddressUrl: String
confirmedBalance: String
pending: String
fiatConfirmedBalance: String
fiatPending: String
fiatCode: String
display: String
unitScale: String
}
type ProcessStatus {
name: String!
state: String!
uptime: Date!
uptime: Int!
}
type Transaction {
@ -156,6 +160,7 @@ const typeDefs = gql`
created: Date
send: Boolean
sendConfirmed: Boolean
dispense: Boolean
timedout: Boolean
sendTime: Date
errorCode: String

View file

@ -2,6 +2,10 @@ const xmlrpc = require('xmlrpc')
const logger = require('../logger')
const { promisify } = require('util')
// TODO new-admin: add the following to supervisor config
// [inet_http_server]
// port = 127.0.0.1:9001
function getAllProcessInfo () {
const convertStates = (state) => {
// From http://supervisord.org/subprocess.html#process-states
@ -45,7 +49,7 @@ function getAllProcessInfo () {
{
name: process.name,
state: convertStates(process.statename),
uptime: (process.statename === 'RUNNING') ? new Date(process.now) - new Date(process.start) : 0
uptime: (process.statename === 'RUNNING') ? process.now - process.start : 0
}
))
})