fix: when finished pairing a machine open the machine status page with

this machine expanded

refactor: simplify add machine page
This commit is contained in:
Liordino Neto 2020-10-15 15:27:48 -03:00 committed by Josh Harvey
parent c56d4759bd
commit 20370fcd1d
5 changed files with 39 additions and 44 deletions

View file

@ -4,6 +4,7 @@ import gql from 'graphql-tag'
import moment from 'moment'
import * as R from 'ramda'
import React from 'react'
import { useParams } from 'react-router-dom'
import { MainStatus } from 'src/components/Status'
import Title from 'src/components/Title'
@ -40,9 +41,11 @@ const useStyles = makeStyles(mainStyles)
const MachineStatus = () => {
const classes = useStyles()
const { id: machineId } = useParams()
const { data: machinesResponse } = useQuery(GET_MACHINES)
const shouldStartExpanded = machine => machine.deviceId === machineId
const elements = [
{
header: 'Machine Name',
@ -95,6 +98,7 @@ const MachineStatus = () => {
elements={elements}
data={R.path(['machines'])(machinesResponse)}
Details={MachineDetailsRow}
shouldStartExpanded={shouldStartExpanded}
expandable
/>
</>