AssignPoolModal
Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-up…
Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-updated time), an endpoints preview, and an optional credential template preview. Submission is async; the modal stays open with a loading state until the parent resolves.
import { AssignPoolModal } from "@tetherto/mdk-react-devkit";| Prop | Status | Type | Default | Description |
|---|---|---|---|---|
isOpen | Required | boolean | — | — |
onClose | Required | () => void | — | — |
onSubmit | Required | (values: { pool: PoolSummary; }) => Promise<void> | — | — |
miners | Required | Device[] | — | — |
poolConfig | Required | PoolConfigEntry[] | — | — |
Usage
Modal dialog for bulk-assigning a set of selected miners to a pool config. Displays the miner list, a pool selector with metadata (unit/miner counts, last-updated time), an endpoints preview, and an optional credential template preview. Submission is async; the modal stays open with a loading state until the parent resolves.
Data contracts
Device—foundation/types/device.ts; onlyid,code,tags,info.container,info.poolConfig, andlast.snap.stats.statusare read.PoolConfigData—foundation/components/pool-manager/hooks/use-pool-configs.ts; the hook parsespoolUrlsinto typedPoolEndpoint[]and resolves pool metadata.PoolSummary—foundation/components/pool-manager/types.ts; returned inonSubmit.
Notes
- The modal does not fetch data itself — pass pre-fetched
minersandpoolConfigfrom the parent. - The credential template preview section is gated by the
SHOW_CREDENTIAL_TEMPLATEconstant inpool-manager-constants.ts. - Use
PoolManagerMinerExplorerwhen you need a full miner-selection workflow before opening this modal.
Example
/** * Runnable example for AssignPoolModal. */import { useState } from 'react'import type { Device, PoolConfigData, PoolSummary } from '@tetherto/mdk-react-devkit'import { AssignPoolModal } from '@tetherto/mdk-react-devkit'const mockPoolConfig: PoolConfigData[] = [ { id: 'pool-1', poolConfigName: 'Alpha Pool', description: 'Primary pool with failover', poolUrls: [ { url: 'stratum+tcp://pool-primary.example.com:3333', pool: 'pool1', workerName: 'wn-1', workerPassword: 'x' }, { url: 'stratum+tcp://pool-failover.example.com:3333', pool: 'pool1', workerName: 'wn-1', workerPassword: 'x' }, ], miners: 120, containers: 4, updatedAt: 1773159239533, }, { id: 'pool-2', poolConfigName: 'Beta Pool', description: 'Secondary pool — low fees', poolUrls: [ { url: 'stratum+tcp://pool-secondary.example.com:3333', pool: 'pool2', workerName: 'worker1', workerPassword: 'x' }, ], miners: 39, containers: 6, updatedAt: 1773172151132, },]const mockMiners: Device[] = [ { id: 'miner-1', type: 'miner', code: 'S19XP.192.168.1.10', tags: ['site-a'], info: { container: 'Unit-01', poolConfig: 'pool-1' }, last: { snap: { stats: { status: 'mining' } } }, }, { id: 'miner-2', type: 'miner', code: 'S21.192.168.1.11', tags: ['site-a'], info: { container: 'Unit-01', poolConfig: 'pool-2' }, last: { snap: { stats: { status: 'offline' } } }, },]export const AssignPoolModalExample = () => { const [isOpen, setIsOpen] = useState(false) const handleSubmit = async ({ pool }: { pool: PoolSummary }) => { await new Promise((resolve) => setTimeout(resolve, 800)) // eslint-disable-next-line no-console console.log(`Assigned ${mockMiners.length} miners to "${pool.name}"`) setIsOpen(false) } return ( <> <button onClick={() => setIsOpen(true)}>Assign Pool</button> <AssignPoolModal isOpen={isOpen} onClose={() => setIsOpen(false)} onSubmit={handleSubmit} miners={mockMiners} poolConfig={mockPoolConfig} /> </> )}AddSparePartModal
Modal for registering a new spare part. Presents a part-type tab strip and a form for miner model, part model, serial number, MAC address (controllers only),…
BatchMoveSparePartsModal
Modal for moving multiple spare parts at once. Shows the selected parts in a table and lets the user choose a new location and/or status plus an observation,…