Skip to content

fanctrlplus2: apply a field's floor on blur, not while typing (#17) - #18

Merged
andrebrait merged 2 commits into
mainfrom
fix/interval-typing-floor
Oct 8, 2026
Merged

andrebrait merged 2 commits into
mainfrom
fix/interval-typing-floor

Conversation

@andrebrait

@andrebrait andrebrait commented Oct 8, 2026 •

Copy link
Copy Markdown
Owner

Fixes #17.

Typing 20 into the Interval field gave 50. bindUnitInputs raised the first digit to the 5-second floor before the second digit arrived.

  • While you type, only the ceiling applies. The floor applies when the field loses focus.
  • A value below the floor gets an orange outline and a tooltip naming the minimum. A field's own tooltip, such as a disk group's Low Temp, comes back afterwards.
  • The server still clamps to 5–3600 via cfg_interval_seconds.

This affects every bindUnitInputs field (percent and temperature too); before, their floors also fired mid-entry.

Tests: tests/interval_ui_test.js drives the real bindUnitInputs. It fails on main and passes here, and tests/run-all.sh is green. I also checked it by hand in headless Chromium against a real input.

Summary by CodeRabbit

  • Bug Fixes
    • Interval fields no longer jump to the minimum while you’re typing. Values below the minimum are highlighted and receive a temporary tooltip; leaving the field raises them to the minimum.
    • Values above the maximum are still capped while editing, and empty fields remain empty.
  • Tests
    • Added coverage for interval field behavior while typing and on blur.

Typing 20 into the interval field gave 50: the first digit was raised to
the 5-second floor before the second one arrived. The floor now applies
when the field is left; while typing, only the ceiling applies, and a
value below the floor gets an outline and a tooltip naming the minimum.
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 34c79583-e44a-4834-ae1c-e1af0fee0769
📥 Commits

Reviewing files that changed from the base of the PR and between a6944ba and 5056f50.

📒 Files selected for processing (2)
  • src/usr/local/emhttp/plugins/fanctrlplus2/fanctrlplus2.page
  • tests/interval_ui_test.js

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9aef5c8e-04e4-472f-99be-528ca727e756
📥 Commits

Reviewing files that changed from the base of the PR and between 9dd3cf2 and a6944ba.

📒 Files selected for processing (3)
  • src/usr/local/emhttp/plugins/fanctrlplus2/css/fcp.base.css
  • src/usr/local/emhttp/plugins/fanctrlplus2/fanctrlplus2.page
  • tests/interval_ui_test.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Interval fields now preserve below-minimum values during editing and enforce the minimum on blur. Below-minimum values receive a temporary tooltip and amber outline. Initialization continues to enforce both bounds.

Changes

Interval entry

Layer / File(s) Summary
Interval input validation and feedback
src/usr/local/emhttp/plugins/fanctrlplus2/fanctrlplus2.page, src/usr/local/emhttp/plugins/fanctrlplus2/css/fcp.base.css, tests/interval_ui_test.js
Input events enforce the maximum but defer the minimum until blur. Below-minimum values are flagged with a class and temporary tooltip. Initialization enforces both bounds. Tests cover below-minimum entry, clearing the warning, maximum capping, and blur enforcement.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a6944

Interval fields keep values below the minimum while the user types and raise them to the minimum on blur. This fixes the bug where typing 20 could produce 50. No merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: applying a field's minimum value on blur instead of during typing.
Linked Issues check ✅ Passed Issue [#17] requires that entering 20 does not become 50 because the 5-second minimum fires after the first digit. The PR summary and focused test establish that bindUnitInputs leaves a below-…
Out of Scope Changes check ✅ Passed The reported changes stay connected to issue [#17]. The shared bindUnitInputs change fixes the common input behavior for interval, percent, and temperature fields. The CSS supports the below-minimum…
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@andrebrait

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T17:37:16.228727Z a6944ba Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6944baa07

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

});

enforceUnit(); // Apply once during initialization.
enforceUnit(true); // Apply once during initialization.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit floor initialization to newly added inputs

When an Add Fan or Add Disk Group AJAX request completes while the user is editing another field, the call sites at lines 521–531 and 1482–1484 invoke bindUnitInputs with selectors that also match every existing input. This unconditional initialization therefore applies the floor to the active partial value, so typing 2 toward 20 can still become 5 when the asynchronous callback runs; it can also capture the temporary minimum-warning tooltip as the field's ownTitle. Initialize only newly inserted inputs, or skip inputs that were already bound.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5056f50. bindUnitInputs marks each input it binds and skips it on later calls, so Add Fan and Add Disk Group only initialize the new fields. That also stops the duplicate listeners. I added a test that rebinds while a field holds a partial value.

Add Fan and Add Disk Group rebind every matching field, so a field being
typed in was re-initialized and raised to its floor mid-entry.
@andrebrait
andrebrait merged commit f139f22 into main Oct 8, 2026
2 checks passed
@andrebrait
andrebrait deleted the fix/interval-typing-floor branch October 8, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Interval - Data Entry

1 participant