diff --git a/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.js b/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.js index 14d72b55..75579f2a 100644 --- a/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.js +++ b/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.js @@ -1,16 +1,16 @@ import { useMutation, useLazyQuery } from '@apollo/react-hooks' -import { Grid, Divider } from '@material-ui/core' +import { Grid /*, Divider */ } from '@material-ui/core' import { makeStyles } from '@material-ui/core/styles' import gql from 'graphql-tag' import moment from 'moment' import React, { useState } from 'react' import { ConfirmDialog } from 'src/components/ConfirmDialog' -import { Status } from 'src/components/Status' +// import { Status } from 'src/components/Status' import ActionButton from 'src/components/buttons/ActionButton' import { ReactComponent as EditReversedIcon } from 'src/styling/icons/button/edit/white.svg' import { ReactComponent as EditIcon } from 'src/styling/icons/button/edit/zodiac.svg' -import { ReactComponent as LinkIcon } from 'src/styling/icons/button/link/zodiac.svg' +// import { ReactComponent as LinkIcon } from 'src/styling/icons/button/link/zodiac.svg' import { ReactComponent as RebootReversedIcon } from 'src/styling/icons/button/reboot/white.svg' import { ReactComponent as RebootIcon } from 'src/styling/icons/button/reboot/zodiac.svg' import { ReactComponent as ShutdownReversedIcon } from 'src/styling/icons/button/shut down/white.svg' @@ -42,16 +42,16 @@ const MACHINE = gql` } ` -const supportArtices = [ - { - // Default article for non-maped statuses - code: undefined, - label: 'Troubleshooting', - article: - 'https://support.lamassu.is/hc/en-us/categories/115000075249-Troubleshooting' - } - // TODO add Stuck and Fully Functional statuses articles for the new-admins -] +// const supportArtices = [ +// { +// // Default article for non-maped statuses +// code: undefined, +// label: 'Troubleshooting', +// article: +// 'https://support.lamassu.is/hc/en-us/categories/115000075249-Troubleshooting' +// } +// // TODO add Stuck and Fully Functional statuses articles for the new-admins +// ] const isStaticState = machineState => { if (!machineState) { @@ -71,8 +71,8 @@ const isStaticState = machineState => { return staticStates.includes(machineState) } -const article = ({ code: status }) => - supportArtices.find(({ code: article }) => article === status) +// const article = ({ code: status }) => +// supportArtices.find(({ code: article }) => article === status) const useLStyles = makeStyles(labelStyles) @@ -142,166 +142,243 @@ const MachineDetailsRow = ({ it: machine, onActionSuccess }) => { const disabled = !!(action?.command === 'restartServices' && loadingEvents) return ( - <> - - - - - -
    - {machine.statuses.map((status, index) => ( + + {/* + + + +
      + {machine.statuses.map((status, index) => ( +
    • + +
    • + ))} +
    +
    + + +
      + {machine.statuses + .map(article) + .map(({ label, article }, index) => (
    • - + + '{label}' +
    • ))} -
    -
    - - -
      - {machine.statuses - .map(article) - .map(({ label, article }, index) => ( -
    • - - '{label}' - -
    • - ))} -
    -
    -
    -
    - - { - setErrorMessage(null) - machineAction({ - variables: { - deviceId: machine.deviceId, - action: `${action?.command}`, - ...(action?.command === 'rename' && { newName: value }) - } - }) - }} - onDissmised={() => { - setAction({ command: null }) - setErrorMessage(null) - }} - /> - - - - - {machine.model} - - - - - {moment(machine.pairedAt).format('YYYY-MM-DD HH:mm:ss')} - - - - - - -
    - - setAction({ - command: 'rename', - display: 'Rename', - confirmationMessage: 'Write the new name for this machine' - }) - }> - Rename - - - setAction({ - command: 'unpair', - display: 'Unpair' - }) - }> - Unpair - - - setAction({ - command: 'reboot', - display: 'Reboot' - }) - }> - Reboot - - - setAction({ - command: 'shutdown', - display: 'Shutdown', - message: - 'In order to bring it back online, the machine will need to be visited and its power reset.' - }) - }> - Shutdown - - { - fetchMachineEvents() - setAction({ - command: 'restartServices', - display: 'Restart services for' - }) - }}> - Restart Services - -
    -
    -
    -
    -
    - +
+
+
+
+ */} + { + setErrorMessage(null) + machineAction({ + variables: { + deviceId: machine.deviceId, + action: `${action?.command}`, + ...(action?.command === 'rename' && { newName: value }) + } + }) + }} + onDissmised={() => { + setAction({ command: null }) + setErrorMessage(null) + }} + /> + + + + + {machine.model} + + + + + {moment(machine.pairedAt).format('YYYY-MM-DD HH:mm:ss')} + + + + +
+ + setAction({ + command: 'rename', + display: 'Rename', + confirmationMessage: 'Write the new name for this machine' + }) + }> + Rename + + + setAction({ + command: 'unpair', + display: 'Unpair' + }) + }> + Unpair + + + setAction({ + command: 'reboot', + display: 'Reboot' + }) + }> + Reboot + + + setAction({ + command: 'shutdown', + display: 'Shutdown', + message: + 'In order to bring it back online, the machine will need to be visited and its power reset.' + }) + }> + Shutdown + + { + fetchMachineEvents() + setAction({ + command: 'restartServices', + display: 'Restart services for' + }) + }}> + Restart Services + +
+
+
+ {/* + + +
+ + setAction({ + command: 'rename', + display: 'Rename', + confirmationMessage: 'Write the new name for this machine' + }) + }> + Rename + + + setAction({ + command: 'unpair', + display: 'Unpair' + }) + }> + Unpair + + + setAction({ + command: 'reboot', + display: 'Reboot' + }) + }> + Reboot + + + setAction({ + command: 'shutdown', + display: 'Shutdown', + message: + 'In order to bring it back online, the machine will need to be visited and its power reset.' + }) + }> + Shutdown + + { + fetchMachineEvents() + setAction({ + command: 'restartServices', + display: 'Restart services for' + }) + }}> + Restart Services + +
+
+
*/} +
+
) } diff --git a/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.styles.js b/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.styles.js index 16da4fae..33cfa009 100644 --- a/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.styles.js +++ b/new-lamassu-admin/src/pages/Maintenance/MachineDetailsCard.styles.js @@ -29,14 +29,16 @@ const machineDetailsStyles = { }, wrapper: { display: 'flex', - marginTop: 24, - marginBottom: 32, + // marginTop: 24, + // marginBottom: 32, + marginTop: 12, + marginBottom: 16, fontSize: fontSize4 }, row: { display: 'flex', - flexDirection: 'row', - marginBottom: 36 + flexDirection: 'row' + // marginBottom: 36 }, list: { padding: 0,