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
-
Complete the @mdk/foundation installation and add the dependency
-
A connected Redux store
-
The notification hook
useNotification(from@mdk/foundation/hooks) wired up; control actions notify on submit.
Components
| Component | Description |
|---|---|
MinerControlsCard | Miner power mode and restart controls |
MinerPowerModeSelectionButtons | Power mode selector grouped by miner model |
BatchContainerControlsCard | Container 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
| Prop | Type | Default | Description |
|---|---|---|---|
buttonsStates | Record<string, boolean | undefined> | required | Per-action disable flags. Currently consumed: isSetUpFrequencyButtonDisabled |
isLoading | boolean | required | Renders the loading spinner and disables every action |
showPowerModeSelector | boolean | true | Show 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 viashowPowerModeSelector) - Reboot: dispatches
ACTION_TYPES.REBOOTfor every selected miner - Setup Freq. Settings: opens the frequency dropdown and dispatches
ACTION_TYPES.SETUP_FREQUENCY_SPEEDwith the chosen value - LEDs on / LEDs off: dispatches
ACTION_TYPES.SET_LEDfor 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 Controlsheader.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
| Prop | Type | Default | Description |
|---|---|---|---|
selectedDevices | Device[] | [] | Miners targeted by the dropdown; used to derive the model groups |
setPowerMode | (devices: Device[], mode: string) => void | none | Callback fired with the matching device subset when a mode is chosen |
connectedMiners | Device[] | none | Used to compute the current power mode summary when powerModesLog is not provided |
powerModesLog | UnknownRecord | none | Pre-computed per-model current power modes (overrides the derived value) |
disabled | boolean | none | Disable every dropdown |
hasMargin | boolean | false | Add 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
| Prop | Type | Default | Description |
|---|---|---|---|
isBatch | boolean | true | Toggle the title between Batch Container Controls and Container Controls |
isCompact | boolean | none | Forwarded to ContainerControlsBox for the compact layout |
connectedMiners | unknown | none | Forwarded to ContainerControlsBox when exactly one container is selected |
alarmsDataItems | TimelineItemData[] | none | Forwarded alarm timeline data |
onNavigate | (path: string) => void | no-op | Forwarded 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

