Skip to content

feat(miner): fetch max hash rate, max power and model when creating a miner#51

Merged
markoceri merged 3 commits into
edge-mining:mainfrom
markoceri:feat/issue-49-fetch-limits-on-create
Jul 2, 2026
Merged

feat(miner): fetch max hash rate, max power and model when creating a miner#51
markoceri merged 3 commits into
edge-mining:mainfrom
markoceri:feat/issue-49-fetch-limits-on-create

Conversation

@markoceri

@markoceri markoceri commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

Lets users fetch device data (max hash rate, max power and model/hostname) from the associated controller while creating a miner, without having to save it first. Previously the "fetch from miner" buttons were only available in edit mode, because the underlying reads operate on a persisted miner.

Backend

  • New endpoints GET /miner-controllers/{controller_id}/info and GET /miner-controllers/{controller_id}/limits, backed by MinerActionService.get_controller_info / get_controller_limits, which query a controller directly via a temporary miner (same approach already used by get_miner_details_from_controller).
  • Extracted shared _read_miner_info / _read_miner_limits helpers and a _temp_miner_for_controller builder, reused by the miner- and controller-level reads to avoid duplication.

Frontend

  • The "Add Miner" form enables the fetch buttons for Max Hash Rate, Max Power and Model when at least one controller is selected.
  • In creation mode the selected controllers are tried until one provides the value; saved miners keep using the miner-level endpoints (which respect feature priority).
  • Fetched values populate and highlight the corresponding fields; if no controller provides a value the action fails gracefully with a readable message.

Closes #49

Test plan

  • Backend: ruff check / ruff format clean; MinerActionService remains concrete.
  • Frontend: vue-tsc -b passes.
  • Manual: Add a miner, select a controller that supports detection → fetch Max Hash Rate / Max Power / Model → fields populate and highlight, without saving first.
  • Manual: Editing an existing miner still fetches via the miner-level endpoints as before.
image

Enable the device-fetch buttons in the Add Miner form before the miner is
saved, querying the associated controller directly instead of the (not yet
existing) miner.

- Add GET /miner-controllers/{id}/info and /miner-controllers/{id}/limits
  endpoints, backed by MinerActionService.get_controller_info /
  get_controller_limits, which read a controller via a temporary miner.
- Extract shared _read_miner_info / _read_miner_limits helpers and a
  _temp_miner_for_controller builder to avoid duplication.
- In the form, show the fetch buttons for Max Hash Rate, Max Power and Model
  when a controller is selected; in creation mode the selected controllers are
  tried until one returns a value.

Closes edge-mining#49
@markoceri markoceri self-assigned this Jun 30, 2026
@markoceri markoceri added the enhancement New feature or request label Jun 30, 2026
@markoceri markoceri merged commit e900952 into edge-mining:main Jul 2, 2026
3 checks passed
@markoceri markoceri deleted the feat/issue-49-fetch-limits-on-create branch July 2, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fetch max hash rate, max power and model from the device when creating a new miner

1 participant