MDK Logo
ReferenceUI KitReactUI Kit foundationOperations centreDetails view

Fleet management

Dialogs for adding, replacing, moving, and removing miners across containers

Dialogs that orchestrate the miner lifecycle launched from the details view: registering a new miner in an empty socket, replacing an existing miner, moving a miner to or from maintenance, changing position between sockets, and permanently removing a miner.

For miner identity, see the details view overview. For the buttons that open most of these dialogs, see Controls.

Prerequisites

  • Complete the @tetherto/mdk-react-devkit installation and add the dependency

  • <MdkProvider> from @tetherto/mdk-react-adapter wrapping your app tree

  • A miner Device record (or socket payload containing one) passed in via dialog props

  • The notification helpers from @tetherto/mdk-react-devkit/foundation wired up; submit actions fire info or success notifications

Components

ComponentDescription
PositionChangeDialogOrchestrator for miner position changes within the explorer
AddReplaceMinerDialogDialog to add/replace a miner in a container socket
ContainerSelectionDialogDialog for picking a container socket for a miner in maintenance
MaintenanceDialogContentConfirmation body for moving a miner to maintenance
RemoveMinerDialogConfirmation dialog for permanently removing a miner

PositionChangeDialog

Top-level dialog that orchestrates the miner position-change flows: change info, move to maintenance, replace miner, confirm position change, and container selection. Dispatches into actionsSlice to queue position updates and routes internally between the step-specific dialog surfaces.

Import

import { PositionChangeDialog } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
openRequiredbooleannoneControls dialog visibility
onCloseRequiredfunctionnoneCalled when the dialog closes; receives the active flow key so callers can decide whether to reset selection state
selectedSocketToReplaceRequiredUnknownRecordnoneSocket payload for the destination socket in a position-change or replace flow
selectedEditSocketRequiredUnknownRecordnoneSocket payload for the miner being edited, replaced, or moved
onChangePositionClickedRequiredfunctionnoneFired when the user picks "Change position" in the default flow
onPositionChangedSuccessRequiredfunctionnoneFired after a successful confirm-change-position submission
isContainerEmptyOptionalbooleanfalseHint for the container-selection step that the destination container has no occupied sockets
dialogFlowOptionalstring''Initial flow key from POSITION_CHANGE_DIALOG_FLOWS; when omitted the default chooser is shown

Internal flows

The dialog routes between step-specific surfaces based on the active dialogFlow value:

Flow keySurface rendered
confirmChangeConfirmChangePositionDialogContent
containerSelectionContainerSelectionDialogContent
replaceMiner, changeInfoAddReplaceMinerDialogContent
confirmRemoveRemoveMinerDialogContent
maintenanceMaintenanceDialogContent
noneDefaultPositionChangeDialogContent chooser

When both selectedSocketToReplace and selectedEditSocket are set, the dialog auto advances to the confirmChange flow.

Basic usage

const [open, setOpen] = useState(false)

<PositionChangeDialog
  open={open}
  onClose={() => setOpen(false)}
  selectedEditSocket={selectedEditSocket}
  dialogFlow={POSITION_CHANGE_DIALOG_FLOWS.CHANGE_INFO}
  onPositionChangedSuccess={() => refetchInventory()}
/>

Move-to-maintenance flow

<PositionChangeDialog
  open={open}
  onClose={handleClose}
  selectedEditSocket={selectedEditSocket}
  dialogFlow={POSITION_CHANGE_DIALOG_FLOWS.MAINTENANCE}
/>

Styling

  • .mdk-position-change-dialog: Root dialog element

AddReplaceMinerDialog

Dialog for registering a new miner in an empty socket or replacing an existing miner. Supports direct-to-maintenance registration, change-info mode for existing miners, and MAC/serial validation against pending submissions.

Import

import { AddReplaceMinerDialog } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
openRequiredbooleannoneControls dialog visibility
onCloseRequiredfunctionnoneCalled when the dialog closes
selectedSocketToReplaceRequiredUnknownRecordnoneSocket payload for the empty socket receiving a new miner
selectedEditSocketRequiredUnknownRecordnoneSocket payload for an existing miner when running the change-info flow
currentDialogFlowRequiredstringnoneFlow key from POSITION_CHANGE_DIALOG_FLOWS; typically replaceMiner or changeInfo
isDirectToMaintenanceModeOptionalbooleanfalseRegister the new miner straight into the maintenance container instead of the selected socket
minersTypeRequiredstringnoneRestricts the form to a specific miner type (used to gate model-specific validation)
isContainerEmptyOptionalbooleannoneForwarded to internal validation when registering into an empty container

Validation

  • MAC and serial are validated against pending submissions before dispatch
  • isDirectToMaintenanceMode skips the position picker and uses the maintenance container as the target

Basic usage

<AddReplaceMinerDialog
  open={open}
  onClose={() => setOpen(false)}
  selectedSocketToReplace={emptySocket}
  currentDialogFlow={POSITION_CHANGE_DIALOG_FLOWS.REPLACE_MINER}
/>

Direct-to-maintenance registration

<AddReplaceMinerDialog
  open={open}
  onClose={() => setOpen(false)}
  selectedSocketToReplace={emptySocket}
  isDirectToMaintenanceMode
/>

ContainerSelectionDialog

Dialog for selecting a destination container and socket when bringing a miner back from the maintenance container. Wraps ContainerSelectionDialogContent with the maintenance container preset as the source.

Import

import { ContainerSelectionDialog } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
openRequiredbooleannoneControls dialog visibility
onCloseRequiredfunctionnoneCalled when the dialog closes
minerRequiredDevicenoneThe miner being moved out of maintenance
containersOptionalDevice[][]Candidate destination containers shown in the picker
isLoadingOptionalbooleannoneShows a loading state while containers is being fetched

Behavior

  • Presets the source as the maintenance container and lets the user pick a destination container and socket
  • Internally renders ContainerSelectionDialogContent with a synthesised selectedSocketToReplace of { miner, containerInfo: { container: 'maintenance' }, pos: '', socket: '' }

Basic usage

<ContainerSelectionDialog
  open={open}
  onClose={() => setOpen(false)}
  miner={minerUnderMaintenance}
  containers={availableContainers}
  isLoading={isContainersLoading}
/>

MaintenanceDialogContent

Confirmation body rendered inside PositionChangeDialog when the flow is 'move to maintenance'. Dispatches the update action to actionsSlice with the maintenance container and an empty position, and fires a success notification on submit.

This is a content body intended to be rendered inside PositionChangeDialog (or any host Dialog); it does not render its own dialog chrome.

Import

import { MaintenanceDialogContent } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
selectedEditSocketOptionalobjectnoneSocket payload for the miner being moved to maintenance. Shape: Partial<{ miner: Device, containerInfo: { container?: string } }>
onCancelRequiredfunctionnoneCalled when the user cancels or after a successful submission

Behavior

  • Confirms the action with the miner short-code and its current container and position
  • On submit, queues an update action through useActions() with the maintenance container, an empty pos, and an empty subnet, preserving the prior position in posHistory
  • Fires an info notification ("Action added") and calls onCancel

Basic usage

<MaintenanceDialogContent
  selectedEditSocket={selectedEditSocket}
  onCancel={() => setOpen(false)}
/>

Styling

  • .mdk-maintenance-confirm: Root container
  • .mdk-maintenance-confirm__warning: Confirmation copy
  • .mdk-maintenance-confirm__highlight: Inline miner short-code
  • .mdk-maintenance-confirm__footer: Cancel and confirm action row

RemoveMinerDialog

Confirmation dialog wrapping RemoveMinerDialogContent. Accepts the head device and a remove-flow flag; dispatches the remove action into actionsSlice when confirmed.

Import

import { RemoveMinerDialog } from '@tetherto/mdk-react-devkit/foundation'

Props

PropStatusTypeDefaultDescription
headDeviceOptionalDevice{}The miner being removed; the dialog reads info.pos for the confirmation copy
isRemoveMinerFlowRequiredbooleannoneControls dialog visibility
onCancelRequiredfunctionnoneCalled when the user cancels or after a successful submission

Behavior

  • Wraps RemoveMinerDialogContent inside a Dialog with the title "Are you sure to permanently remove miner?"
  • On confirm, queues the remove action through useActions() for the head device

Basic usage

<RemoveMinerDialog
  headDevice={selectedMiner}
  isRemoveMinerFlow={isRemoveOpen}
  onCancel={() => setRemoveOpen(false)}
/>

On this page