fix: machine status layout bugs

fix: reboot icon looks cropped

fix: confirm dialog layout

fix: Status chip background colors

fix: detailed machine status layout

fix: machine detailed status layout

fix: machine status article links, status chip size

fix: confirmDialog for all machine actions

fix: confirm dialog on every action. reload when success

fix: verbose input label

fix: display software version and machine model

fix: eslint fixes

fix: removed machine version and update button

fix: get machines statuses from ping

chore: removed the support articles until they're ready

fix: reset value and error states when closing the confirm dialog

fix: removed unused info from the machine table

styles: fixed styles in the machine details card

chore: moved styles to another file

fix: fixed the version gql property
This commit is contained in:
Mauricio Navarro Miranda 2020-07-13 15:25:43 -05:00 committed by Josh Harvey
parent 825a9bfe09
commit db014a3ed4
9 changed files with 278 additions and 214 deletions

View file

@ -4,6 +4,8 @@ const axios = require('axios')
const logger = require('./logger')
const db = require('./db')
const pairing = require('./pairing')
const notifier = require('./notifier')
const dbm = require('./postgresql_interface')
const configManager = require('./new-config-manager')
const settingsLoader = require('./new-settings-loader')
@ -34,15 +36,40 @@ function getConfig (defaultConfig) {
}
function getMachineNames (config) {
const fullyFunctionalStatus = {label: 'Fully functional', type: 'success'}
const unresponsiveStatus = {label: 'Unresponsive', type: 'error'}
const stuckStatus = {label: 'Stuck', type: 'error'}
return Promise.all([getMachines(), getConfig(config)])
.then(([machines, config]) => {
.then(([machines, config]) => Promise.all(
[machines, notifier.checkPings(machines), dbm.machineEvents(), config]
))
.then(([machines, pings, events, config]) => {
const getPingStatus = (ping) => {
if (!ping) return fullyFunctionalStatus
if (ping.age) return unresponsiveStatus
return fullyFunctionalStatus
}
const getStuckStatus = (stuck) => {
if (!stuck || !stuck.age) return undefined
return stuckStatus
}
const addName = r => {
const cashOutConfig = configManager.getCashOut(r.deviceId, config)
const cashOut = !!cashOutConfig.active
// TODO new-admin actually load status based on ping.
const statuses = [{label: 'Unknown detailed status', type: 'warning'}]
const ping = getPingStatus(_.first(pings[r.deviceId]))
const stuck = getStuckStatus(_.first(notifier.checkStuckScreen(events, r.name)))
const statuses = [ping]
if (stuck) statuses.push(stuck)
return _.assign(r, {cashOut, statuses})
}