MDK Logo

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 t…

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. Device data is fetched by the parent and passed in via props — the component does no data fetching itself.

import { RepairLogChangesSubRow } from "@tetherto/mdk-react-devkit";
PropStatusTypeDefaultDescription
batchActionRequiredPartial<{ params: Partial<{ params: Partial<{ comment: string; id: string; rackId: string; info: { parentDeviceId: string | null; }; }>[]; }>[]; }>The repair batch action whose part changes should be displayed.
devicesRequiredPartial<{ id: string; rack: string; info: Partial<{ serialNum: string; macAddress: string; }>; }>[]Devices referenced by the batch action, pre-fetched by the parent.
isLoadingOptionalboolean | undefinedfalseShow a spinner while the parent is still fetching `devices`.

Usage

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. It renders a non-paginated DataTable.

Data contracts

  • RepairBatchActionfoundation/components/repairs/types.ts. The component reads params[].params[0] for each action's comment, id, rackId, and info.parentDeviceId.
  • RepairDevicefoundation/components/repairs/types.ts. Only id, rack, info.serialNum, and info.macAddress are read.

Notes

  • The component does not fetch data itself — pass pre-fetched devices from the parent (e.g. query the things API by the action ids), consistent with the rest of the devkit.
  • Miner actions are filtered out; only spare-part changes are shown.
  • A part is labelled Removed when it has no parentDeviceId, otherwise Added.
  • Part type is resolved via MINER_TYPE_NAME_MAP then SparePartNames, falling back to Unknown.

Example

/** * Runnable example for RepairLogChangesSubRow. */import type { RepairBatchAction, RepairDevice } from '@tetherto/mdk-react-devkit'import { RepairLogChangesSubRow } from '@tetherto/mdk-react-devkit'const mockBatchAction: RepairBatchAction = {  params: [    {      params: [        {          id: 'inventory-miner_part-hashboard-001',          rackId: 'inventory-miner_part-hashboard',          info: { parentDeviceId: null },        },      ],    },    {      params: [        {          id: 'inventory-miner_part-psu-002',          rackId: 'inventory-miner_part-psu',          info: { parentDeviceId: 'antminer-s21-001' },        },      ],    },  ],}const mockDevices: RepairDevice[] = [  {    id: 'inventory-miner_part-hashboard-001',    rack: 'inventory-miner_part-hashboard',    info: { serialNum: 'HB-SN-0001', macAddress: 'AA:BB:CC:00:00:01' },  },  {    id: 'inventory-miner_part-psu-002',    rack: 'inventory-miner_part-psu',    info: { serialNum: 'PSU-SN-0002', macAddress: 'AA:BB:CC:00:00:02' },  },]export const RepairLogChangesSubRowExample = () => {  return <RepairLogChangesSubRow batchAction={mockBatchAction} devices={mockDevices} />}