feat: add machine status page (#344)
* feat: add confirm-dialog component * feat: add MachineStatus to router * feat: add machine details to api endpoints * feat: add machine-status expandabletable * fix: add missing property to TextInput on story * style: minor style fixes * feat: useAxios to unpair and reboot specific machinees * fix: style fixes use shutdown instead of reboot use named colors * fix: use new ExpTable * fix: class instead of sttyles, use named colors * feat: use ConfirmDialog to confirm unpair action * chore: eslint fix * refactor: use gql, new ExpTable and ramda on machine-status * fix: 'fallback' status instead of the 'all good' one * fix: makeStyles instead of withStyles * refactor: simplify StatusChip * fix: css spacing instead of nbsp * fix: move makeStyles outside component * refactor: makeStyles instead of withStyles * refactor: adapting based props for Status * refactor: moar simple Status chip * feat: use graphql mutation instead of rest for machine action feat: use graphql instead of rest on MachineDetailsCard * fix: Dialog close must be handled outside * fix: just pass down onDissmissed and onConfirmed to the component https://github.com/lamassu/lamassu-server/pull/344#discussion_r370136028 * refactor: machineAction on separate file and 404 handling * feat: basic handling of graphql exceptions on machineAction
This commit is contained in:
parent
f1edea4e8a
commit
fdf18b60ad
14 changed files with 609 additions and 3 deletions
|
|
@ -4,6 +4,7 @@ const { GraphQLJSON, GraphQLJSONObject } = require('graphql-type-json')
|
|||
const got = require('got')
|
||||
|
||||
const machineLoader = require('../../machine-loader')
|
||||
const { machineAction } = require('../machines')
|
||||
const logs = require('../../logs')
|
||||
const supportLogs = require('../../support_logs')
|
||||
const settingsLoader = require('../../new-settings-loader')
|
||||
|
|
@ -42,6 +43,11 @@ const typeDefs = gql`
|
|||
display: String!
|
||||
}
|
||||
|
||||
type MachineStatus {
|
||||
label: String!
|
||||
type: String!
|
||||
}
|
||||
|
||||
type Machine {
|
||||
name: String!
|
||||
deviceId: ID!
|
||||
|
|
@ -49,6 +55,7 @@ const typeDefs = gql`
|
|||
cashbox: Int
|
||||
cassette1: Int
|
||||
cassette2: Int
|
||||
statuses: [MachineStatus]
|
||||
}
|
||||
|
||||
type Account {
|
||||
|
|
@ -154,7 +161,15 @@ const typeDefs = gql`
|
|||
deviceId: ID
|
||||
}
|
||||
|
||||
enum MachineAction {
|
||||
resetCashOutBills
|
||||
unpair
|
||||
reboot
|
||||
restartServices
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
machineAction(deviceId:ID!, action: MachineAction!): Machine
|
||||
machineSupportLogs(deviceId: ID!): SupportLogsResponse
|
||||
serverSupportLogs: SupportLogsResponse
|
||||
saveConfig(config: JSONObject): JSONObject
|
||||
|
|
@ -184,6 +199,7 @@ const resolvers = {
|
|||
config: () => settingsLoader.getConfig()
|
||||
},
|
||||
Mutation: {
|
||||
machineAction: (...[, { deviceId, action }]) => machineAction({ deviceId, action }),
|
||||
machineSupportLogs: (...[, { deviceId }]) => supportLogs.insert(deviceId),
|
||||
serverSupportLogs: () => serverLogs.insert(),
|
||||
saveConfig: (...[, { config }]) => settingsLoader.saveConfig(config)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue