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";| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
batchAction | Required | Partial<{ params: Partial<{ params: Partial<{ comment: string; id: string; rackId: string; info: { parentDeviceId: string | null; }; }>[]; }>[]; }> | — | The repair batch action whose part changes should be displayed. |
devices | Required | Partial<{ id: string; rack: string; info: Partial<{ serialNum: string; macAddress: string; }>; }>[] | — | Devices referenced by the batch action, pre-fetched by the parent. |
isLoading | Optional | boolean | undefined | false | Show 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
RepairBatchAction—foundation/components/repairs/types.ts. The component readsparams[].params[0]for each action'scomment,id,rackId, andinfo.parentDeviceId.RepairDevice—foundation/components/repairs/types.ts. Onlyid,rack,info.serialNum, andinfo.macAddressare read.
Notes
- The component does not fetch data itself — pass pre-fetched
devicesfrom 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_MAPthenSparePartNames, falling back toUnknown.
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} />}