MDK Logo

Miner controls components

Power mode, reboot, LED, frequency, and maintenance controls for the miner details view

Operator controls for the currently selected miner or selection. These components dispatch into actionsSlice and surface confirmation through the standard notification hooks.

For miner identity, see the Miner details overview. For aggregated stats, see Metrics.

Prerequisites

Components

ComponentDescription
MinerControlsCardMiner power mode and restart controls
MinerPowerModeSelectionButtonsPower mode selector grouped by miner model
BatchContainerControlsCardContainer controls card for selected devices

MinerControlsCard

Miner power mode and control panel with reboot, LED controls, frequency settings, and maintenance operations.

Import

import { MinerControlsCard } from '@mdk/foundation'

Props

PropTypeDefaultDescription
buttonsStatesRecord<string, boolean | undefined>requiredPer-action disable flags. Currently consumed: isSetUpFrequencyButtonDisabled
isLoadingbooleanrequiredRenders the loading spinner and disables every action
showPowerModeSelectorbooleantrueShow the embedded MinerPowerModeSelectionButtons row

Available controls

The component renders a different control set depending on the selection and maintenance state:

Standard mode (any non-maintenance selection):

  • Power mode selector: embedded MinerPowerModeSelectionButtons (toggle via showPowerModeSelector)
  • Reboot: dispatches ACTION_TYPES.REBOOT for every selected miner
  • Setup Freq. Settings: opens the frequency dropdown and dispatches ACTION_TYPES.SETUP_FREQUENCY_SPEED with the chosen value
  • LEDs on / LEDs off: dispatches ACTION_TYPES.SET_LED for miners whose LED is not already in the requested state
  • Move to Maintenance, Change miner info, Change position: single-device actions that open the matching dialog flow

Single-miner-in-maintenance mode:

  • Change Miner Info: opens the change-info dialog
  • Back from Maintenance: opens the container-selection dialog (disabled until the device has a MAC address)
  • Remove Miner: opens the remove-miner dialog

The card returns null when more than one miner is selected and every selected miner is already in maintenance.

Basic usage

<MinerControlsCard
  buttonsStates={{ isSetUpFrequencyButtonDisabled: false }}
  isLoading={false}
/>

Hide the power mode selector

<MinerControlsCard
  buttonsStates={buttonsStates}
  isLoading={isLoading}
  showPowerModeSelector={false}
/>

Composition

MinerControlsCard composes MinerPowerModeSelectionButtons, MinerSetupFrequencyDropdown, and four dialogs (ContainerSelectionDialog, RemoveMinerDialog, AddReplaceMinerDialog, PositionChangeDialog). The dialogs are mounted unconditionally and toggle visibility through internal state; no wiring required from the caller.

Styling

  • .mdk-miner-controls: root element
  • .mdk-miner-controls__label: Miner Controls header
  • .mdk-miner-controls__content: controls container
  • .mdk-miner-controls__loader: loading spinner
  • .mdk-miner-controls__grid: standard mode button grid
  • .mdk-miner-controls__full-width: full-width button slot
  • .mdk-miner-controls__maintenance-stack: maintenance mode action stack
  • .mdk-miner-controls__single-device-stack: single-device action stack

MinerPowerModeSelectionButtons

Dropdown selector for setting miner power modes, groups miners by type.

MinerPowerModeSelectionButtons is rendered inside MinerControlsCard by default but is exported as a peer for layouts that want the power-mode dropdown without the rest of the control card (for example, an Alarm rail or a custom toolbar).

Import

import { MinerPowerModeSelectionButtons } from '@mdk/foundation'

Props

PropTypeDefaultDescription
selectedDevicesDevice[][]Miners targeted by the dropdown; used to derive the model groups
setPowerMode(devices: Device[], mode: string) => voidnoneCallback fired with the matching device subset when a mode is chosen
connectedMinersDevice[]noneUsed to compute the current power mode summary when powerModesLog is not provided
powerModesLogUnknownRecordnonePre-computed per-model current power modes (overrides the derived value)
disabledbooleannoneDisable every dropdown
hasMarginbooleanfalseAdd the --with-margin modifier on the root

The component groups selectedDevices by miner model (via getDeviceModel) and renders one dropdown per group. When the selection contains a single model, the button reads Set Power Mode; with multiple models, the model name is appended (Set Power Mode (S19 Pro)).

Basic usage

<MinerPowerModeSelectionButtons
  selectedDevices={selectedMiners}
  setPowerMode={(devices, mode) => {
    console.log('Set power mode:', mode, 'for', devices.length, 'miners')
  }}
/>

With pre-computed power modes

<MinerPowerModeSelectionButtons
  selectedDevices={selectedMiners}
  powerModesLog={powerModesByModel}
  setPowerMode={handlePowerModeChange}
  disabled={isLoading}
/>

Styling

  • .mdk-miner-power-mode-selection-buttons: root element
  • .mdk-miner-power-mode-selection-buttons--with-margin: margin modifier

BatchContainerControlsCard

Renders container controls for the currently selected device(s) from explorer state, switching between batch and single-device modes based on selection count.

BatchContainerControlsCard is the container-level counterpart to MinerControlsCard. It renders inside the miner details view when one or more containers are selected and switches between batch and single-container layouts based on selection size.

Import

import { BatchContainerControlsCard } from '@mdk/foundation'

Props

PropTypeDefaultDescription
isBatchbooleantrueToggle the title between Batch Container Controls and Container Controls
isCompactbooleannoneForwarded to ContainerControlsBox for the compact layout
connectedMinersunknownnoneForwarded to ContainerControlsBox when exactly one container is selected
alarmsDataItemsTimelineItemData[]noneForwarded alarm timeline data
onNavigate(path: string) => voidno-opForwarded navigation handler

The card reads selectSelectedContainers from Redux and uses the selection to derive the device record passed into ContainerControlsBox. With a single container selected, the full record (plus connectedMiners) is forwarded; with multiple containers, only type is forwarded, and only when every selected container shares the same model (otherwise type is undefined, which forces the batch layout).

Basic usage

<BatchContainerControlsCard
  alarmsDataItems={alarmTimelineItems}
  onNavigate={(path) => router.push(path)}
/>

Single-container compact layout

<BatchContainerControlsCard
  isBatch={false}
  isCompact
  connectedMiners={connectedMinerCount}
  alarmsDataItems={alarmTimelineItems}
  onNavigate={(path) => router.push(path)}
/>

Composition

BatchContainerControlsCard is a thin shell that renders ContentBox (with the batch or single title) wrapping ContainerControlsBox. Use ContainerControlsBox directly if you need to drive the controls from a non-Redux source.

Styling

  • .mdk-batch-container-controls-card: root element
  • .mdk-batch-container-controls-card__controls: controls wrapper inside the content box

On this page