fix: CSS clean up due to some orphan styling
This commit is contained in:
parent
53431a9fd9
commit
735c46ed55
4 changed files with 34 additions and 167 deletions
|
|
@ -10,6 +10,10 @@ const settingsLoader = require('./new-settings-loader')
|
|||
const notifierUtils = require('./notifier/utils')
|
||||
const notifierQueries = require('./notifier/queries')
|
||||
|
||||
const fullyFunctionalStatus = { label: 'Fully functional', type: 'success' }
|
||||
const unresponsiveStatus = { label: 'Unresponsive', type: 'error' }
|
||||
const stuckStatus = { label: 'Stuck', type: 'error' }
|
||||
|
||||
function getMachines () {
|
||||
return db.any('SELECT * FROM devices WHERE display=TRUE ORDER BY created')
|
||||
.then(rr => rr.map(r => ({
|
||||
|
|
@ -34,40 +38,38 @@ function getConfig (defaultConfig) {
|
|||
return settingsLoader.loadLatest().config
|
||||
}
|
||||
|
||||
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]) => Promise.all(
|
||||
[machines, checkPings(machines), dbm.machineEvents(), config]
|
||||
))
|
||||
.then(([machines, pings, events, config]) => {
|
||||
const getStatus = (ping, stuck) => {
|
||||
const getStatus = (ping, stuck) => {
|
||||
if (ping && ping.age) return unresponsiveStatus
|
||||
|
||||
if (stuck && stuck.age) return stuckStatus
|
||||
|
||||
return fullyFunctionalStatus
|
||||
}
|
||||
}
|
||||
|
||||
const addName = r => {
|
||||
const cashOutConfig = configManager.getCashOut(r.deviceId, config)
|
||||
function addName (pings, events, config) {
|
||||
return machine => {
|
||||
const cashOutConfig = configManager.getCashOut(machine.deviceId, config)
|
||||
|
||||
const cashOut = !!cashOutConfig.active
|
||||
|
||||
const statuses = [
|
||||
getStatus(
|
||||
_.first(pings[r.deviceId]),
|
||||
_.first(checkStuckScreen(events, r.name))
|
||||
_.first(pings[machine.deviceId]),
|
||||
_.first(checkStuckScreen(events, machine.name))
|
||||
)
|
||||
]
|
||||
|
||||
return _.assign(r, { cashOut, statuses })
|
||||
return _.assign(machine, { cashOut, statuses })
|
||||
}
|
||||
}
|
||||
|
||||
return _.map(addName, machines)
|
||||
function getMachineNames (config) {
|
||||
return Promise.all([getMachines(), getConfig(config)])
|
||||
.then(([machines, config]) => Promise.all(
|
||||
[machines, checkPings(machines), dbm.machineEvents(), config]
|
||||
))
|
||||
.then(([machines, pings, events, config]) => {
|
||||
return machines.map(addName(pings, events, config))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -88,10 +90,6 @@ function getMachineName (machineId) {
|
|||
}
|
||||
|
||||
function getMachine (machineId, config) {
|
||||
const fullyFunctionalStatus = { label: 'Fully functional', type: 'success' }
|
||||
const unresponsiveStatus = { label: 'Unresponsive', type: 'error' }
|
||||
const stuckStatus = { label: 'Stuck', type: 'error' }
|
||||
|
||||
const sql = 'SELECT * FROM devices WHERE device_id=$1'
|
||||
const queryMachine = db.oneOrNone(sql, [machineId]).then(r => ({
|
||||
deviceId: r.device_id,
|
||||
|
|
@ -110,30 +108,7 @@ function getMachine (machineId, config) {
|
|||
.then(([machine, events, config]) => {
|
||||
const pings = checkPings([machine])
|
||||
|
||||
const getStatus = (ping, stuck) => {
|
||||
if (ping && ping.age) return unresponsiveStatus
|
||||
|
||||
if (stuck && stuck.age) return stuckStatus
|
||||
|
||||
return fullyFunctionalStatus
|
||||
}
|
||||
|
||||
const addName = r => {
|
||||
const cashOutConfig = configManager.getCashOut(r.deviceId, config)
|
||||
|
||||
const cashOut = !!cashOutConfig.active
|
||||
|
||||
const statuses = [
|
||||
getStatus(
|
||||
_.first(pings[r.deviceId]),
|
||||
_.first(checkStuckScreen(events, r.name))
|
||||
)
|
||||
]
|
||||
|
||||
return _.assign(r, { cashOut, statuses })
|
||||
}
|
||||
|
||||
return addName(machine)
|
||||
return [machine].map(addName(pings, events, config))[0]
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,9 @@
|
|||
import { fade } from '@material-ui/core/styles/colorManipulator'
|
||||
|
||||
import typographyStyles from 'src/components/typography/styles'
|
||||
import {
|
||||
offColor,
|
||||
spacer,
|
||||
comet,
|
||||
primaryColor,
|
||||
fontSize4,
|
||||
errorColor
|
||||
} from 'src/styling/variables'
|
||||
import { offColor, spacer, errorColor } from 'src/styling/variables'
|
||||
|
||||
const { label1 } = typographyStyles
|
||||
|
||||
const machineActionsStyles = {
|
||||
colDivider: {
|
||||
width: 1,
|
||||
margin: [[spacer * 2, spacer * 4]],
|
||||
backgroundColor: comet,
|
||||
border: 'none'
|
||||
},
|
||||
label: {
|
||||
extend: label1,
|
||||
color: offColor,
|
||||
|
|
@ -33,44 +18,10 @@ const machineActionsStyles = {
|
|||
flexWrap: 'wrap',
|
||||
justifyContent: 'start'
|
||||
},
|
||||
wrapper: {
|
||||
display: 'flex',
|
||||
marginTop: 12,
|
||||
marginBottom: 16,
|
||||
fontSize: fontSize4
|
||||
},
|
||||
row: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
list: {
|
||||
padding: 0,
|
||||
margin: 0,
|
||||
listStyle: 'none'
|
||||
},
|
||||
item: {
|
||||
height: spacer * 3,
|
||||
marginBottom: spacer * 1.5
|
||||
},
|
||||
link: {
|
||||
color: primaryColor,
|
||||
textDecoration: 'none'
|
||||
},
|
||||
divider: {
|
||||
margin: '0 1rem'
|
||||
},
|
||||
mr: {
|
||||
marginRight: spacer,
|
||||
marginBottom: spacer
|
||||
},
|
||||
separator: {
|
||||
width: 1,
|
||||
height: 170,
|
||||
zIndex: 1,
|
||||
marginRight: 60,
|
||||
marginLeft: 'auto',
|
||||
background: fade(comet, 0.5)
|
||||
},
|
||||
warning: {
|
||||
color: errorColor
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
import {
|
||||
spacer,
|
||||
fontPrimary,
|
||||
primaryColor,
|
||||
white,
|
||||
comet
|
||||
} from 'src/styling/variables'
|
||||
import { spacer, comet } from 'src/styling/variables'
|
||||
|
||||
const styles = {
|
||||
grid: {
|
||||
|
|
@ -18,16 +12,6 @@ const styles = {
|
|||
marginLeft: spacer * 6,
|
||||
maxWidth: 900
|
||||
},
|
||||
footer: {
|
||||
margin: [['auto', 0, spacer * 3, 'auto']]
|
||||
},
|
||||
modalTitle: {
|
||||
lineHeight: '120%',
|
||||
color: primaryColor,
|
||||
fontSize: 14,
|
||||
fontFamily: fontPrimary,
|
||||
fontWeight: 900
|
||||
},
|
||||
subtitle: {
|
||||
display: 'flex',
|
||||
justifyContent: 'space-between',
|
||||
|
|
@ -39,15 +23,6 @@ const styles = {
|
|||
color: comet,
|
||||
marginTop: 0
|
||||
},
|
||||
white: {
|
||||
color: white
|
||||
},
|
||||
deleteButton: {
|
||||
paddingLeft: 13
|
||||
},
|
||||
addressRow: {
|
||||
marginLeft: 8
|
||||
},
|
||||
row: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row',
|
||||
|
|
@ -60,16 +35,10 @@ const styles = {
|
|||
detailItem: {
|
||||
marginBottom: spacer * 4
|
||||
},
|
||||
transactionsItem: {
|
||||
marginBottom: -spacer * 4
|
||||
},
|
||||
actionButtonsContainer: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
actionButton: {
|
||||
marginRight: 8
|
||||
},
|
||||
breadcrumbsContainer: {
|
||||
marginTop: 32
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,29 +4,10 @@ import {
|
|||
detailsRowStyles,
|
||||
labelStyles
|
||||
} from 'src/pages/Transactions/Transactions.styles'
|
||||
import {
|
||||
spacer,
|
||||
comet,
|
||||
primaryColor,
|
||||
fontSize4,
|
||||
errorColor
|
||||
} from 'src/styling/variables'
|
||||
import { spacer, comet, primaryColor, fontSize4 } from 'src/styling/variables'
|
||||
|
||||
const machineDetailsStyles = {
|
||||
...detailsRowStyles,
|
||||
colDivider: {
|
||||
width: 1,
|
||||
margin: [[spacer * 2, spacer * 4]],
|
||||
backgroundColor: comet,
|
||||
border: 'none'
|
||||
},
|
||||
inlineChip: {
|
||||
marginInlineEnd: '0.25em'
|
||||
},
|
||||
stack: {
|
||||
display: 'flex',
|
||||
flexDirection: 'row'
|
||||
},
|
||||
wrapper: {
|
||||
display: 'flex',
|
||||
// marginTop: 24,
|
||||
|
|
@ -53,12 +34,6 @@ const machineDetailsStyles = {
|
|||
color: primaryColor,
|
||||
textDecoration: 'none'
|
||||
},
|
||||
divider: {
|
||||
margin: '0 1rem'
|
||||
},
|
||||
mr: {
|
||||
marginRight: spacer
|
||||
},
|
||||
separator: {
|
||||
width: 1,
|
||||
height: 170,
|
||||
|
|
@ -66,9 +41,6 @@ const machineDetailsStyles = {
|
|||
marginRight: 60,
|
||||
marginLeft: 'auto',
|
||||
background: fade(comet, 0.5)
|
||||
},
|
||||
warning: {
|
||||
color: errorColor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue