MDK Logo

Repairs

Device repair and maintenance log tracking — spare-part changes sub-row

@tetherto/mdk-react-devkit/foundation

Repairs components display spare-part changes recorded in device repair batch actions. Pair with the Operations centre for full device-management context.

Prerequisites

Components

RepairLogChangesSubRow

Expandable sub-row that lists the spare-part changes recorded in a repair batch action. Each non-miner repair action is resolved against its device to show the part type, serial number, MAC address, and whether the part was added or removed. Renders as a DataTable; shows a Spinner when isLoading is true.

The component does no data fetching — the parent fetches the batch action and its associated devices (for example via the things API) and passes them as props.

Import

import { RepairLogChangesSubRow } from '@tetherto/mdk-react-devkit/foundation'
import type {
  RepairLogChangesSubRowProps,
  RepairBatchAction,
  RepairDevice,
} from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
batchActionRequiredRepairBatchActionnoneThe repair batch action whose part changes are displayed
devicesRequiredRepairDevice[]noneDevices referenced by the batch action, pre-fetched by the parent
isLoadingOptionalbooleanfalseWhen true, renders a spinner instead of the table

Supporting types

type RepairBatchAction = Partial<{
  params: RepairAction[]
}>

type RepairAction = Partial<{
  params: RepairActionParam[]
}>

type RepairActionParam = Partial<{
  comment: string
  id: string
  rackId: string
  info: { parentDeviceId: string | null }
}>

type RepairDevice = Partial<{
  id: string
  rack: string
  info: Partial<{
    serialNum: string
    macAddress: string
  }>
}>

Basic usage

import { RepairLogChangesSubRow } from '@tetherto/mdk-react-devkit/foundation'
import type { RepairBatchAction, RepairDevice } from '@tetherto/mdk-react-devkit/foundation'

const batchAction: RepairBatchAction = {
  params: [
    {
      params: [
        {
          id: 'inventory-miner_part-hashboard-001',
          rackId: 'inventory-miner_part-hashboard',
          info: { parentDeviceId: null },
        },
      ],
    },
  ],
}

const devices: RepairDevice[] = [
  {
    id: 'inventory-miner_part-hashboard-001',
    rack: 'inventory-miner_part-hashboard',
    info: { serialNum: 'HB-SN-0001', macAddress: 'AA:BB:CC:00:00:01' },
  },
]

<RepairLogChangesSubRow batchAction={batchAction} devices={devices} />

Loading state

<RepairLogChangesSubRow
  batchAction={batchAction}
  devices={[]}
  isLoading
/>

Behavior notes

  • Miner rack actions and actions with a comment field are filtered out — only spare-part changes appear in the table
  • A part is marked Removed when parentDeviceId is null; Added when parentDeviceId references a parent device
  • Part type labels come from MINER_TYPE_NAME_MAP and SparePartNames; unrecognised rack IDs display as Unknown
  • Pagination is disabled by default

Next steps

On this page