Skip to content

Add bufferstrip checkbox column to fields table#532

Merged
SvenVw merged 3 commits into
developmentfrom
FDM531
Mar 30, 2026
Merged

Add bufferstrip checkbox column to fields table#532
SvenVw merged 3 commits into
developmentfrom
FDM531

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Mar 26, 2026

Summary by CodeRabbit

  • New Features
    • Added a checkbox column to the fields table to view and toggle a field’s bufferstrip status.
    • Checkbox shows a loading indicator while changes are saved and is disabled when you lack edit permission.
    • Column is mobile-friendly (hides on smaller screens) and displays a success notification after updates.

Closes #531

@SvenVw SvenVw self-assigned this Mar 26, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2d68f720-0d26-428e-99f6-90667eaabd2b

📥 Commits

Reviewing files that changed from the base of the PR and between 1d6e079 and 105de5a.

📒 Files selected for processing (1)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.tsx

📝 Walkthrough

Walkthrough

Adds a buffer-strip checkbox column to the fields table with a new cell component that submits updates via a POST action on the field route, and a route action that persists the b_bufferstrip change using updateField.

Changes

Cohort / File(s) Summary
Release Documentation
./.changeset/khaki-suits-bow.md
Adds a changeset marking @nmi-agro/fdm-app as a minor release documenting the new bufferstrip checkbox UI change.
Checkbox Component
fdm-app/app/components/blocks/fields/buffer-strip-checkbox.tsx
New exported React cell component BufferStripCheckbox using useFetcher to POST { b_id, b_bufferstrip }, shows Spinner during non-idle fetcher states, disables when no write permission.
Table Configuration
fdm-app/app/components/blocks/fields/columns.tsx
Extends FieldExtended with b_bufferstrip: boolean and adds a Bufferstrook column using BufferStripCheckbox as the cell renderer; column supports hiding like other optional columns.
Route Action
fdm-app/app/routes/farm.$b_id_farm.$calendar.field.tsx
Adds action handler to read b_id and b_bufferstrip from form data, validate b_id, call updateField(..., b_bufferstrip), return dataWithSuccess on success and use handleActionError on failure; updates imports accordingly.

Sequence Diagram

sequenceDiagram
    actor User
    participant Checkbox as BufferStripCheckbox
    participant Fetcher as ReactRouterFetcher
    participant Action as FieldRouteAction
    participant DB as updateField(database)

    User->>Checkbox: Toggle checkbox
    Checkbox->>Checkbox: Render Spinner (fetcher non-idle)
    Checkbox->>Fetcher: submit({ b_id, b_bufferstrip })
    Fetcher->>Action: POST form data
    Action->>Action: validate b_id, parse b_bufferstrip
    Action->>DB: call updateField(..., b_bufferstrip)
    DB-->>Action: update result
    Action-->>Fetcher: success response
    Fetcher-->>Checkbox: transition to idle
    Checkbox->>User: render updated checkbox
    Note over User,Action: success toast displayed
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

fdm-app, enhancement, branch:development

Suggested reviewers

  • gerardhros

Poem

🐰 A tiny checkbox hops into view,
I tick, it hums — the change goes through,
Spinner twirls, the field updates with grace,
Bufferstrook marked in its rightful place.

🚥 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%. 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.
Linked Issues check ✅ Passed The pull request implements all core requirements from issue #531: BufferStripCheckbox component with useFetcher, FieldExtended type extension with b_bufferstrip, new table column, and action handler for database updates.
Out of Scope Changes check ✅ Passed All changes are directly aligned with issue #531 objectives. The changeset, component, type updates, and action handler are all necessary for implementing the buffer strip checkbox feature.
Title Check ✅ Passed Title check skipped as CodeRabbit has written the PR title.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch FDM531

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 and usage tips.

@sentry
Copy link
Copy Markdown

sentry Bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@coderabbitai coderabbitai Bot changed the title @coderabbitai Add bufferstrip checkbox column to fields table Mar 26, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@fdm-app/app/routes/farm`.$b_id_farm.$calendar.field.tsx:
- Around line 50-76: The action handler reads b_id from formData and casts it to
string without checking for presence, which can pass "null" to updateField;
update the action function to validate b_id after const b_id =
formData.get("b_id") — ensure it is non-null and a string (or matches expected
id format), and if invalid return or throw a handled error (e.g., use
handleActionError or return a dataWithSuccess/dataWithError response with a
clear message) before calling updateField so updateField never receives an
invalid b_id.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 70a5e0f7-08da-4200-9797-eed8cc7d758b

📥 Commits

Reviewing files that changed from the base of the PR and between 2a47cfd and 1d6e079.

📒 Files selected for processing (4)
  • .changeset/khaki-suits-bow.md
  • fdm-app/app/components/blocks/fields/buffer-strip-checkbox.tsx
  • fdm-app/app/components/blocks/fields/columns.tsx
  • fdm-app/app/routes/farm.$b_id_farm.$calendar.field.tsx

Comment thread fdm-app/app/routes/farm.$b_id_farm.$calendar.field.tsx Outdated
@SvenVw SvenVw requested a review from BoraIneviNMI March 26, 2026 13:52
Copy link
Copy Markdown
Collaborator

@BoraIneviNMI BoraIneviNMI left a comment

Choose a reason for hiding this comment

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

Seems to work well. The graying out based on permissions also works.

@SvenVw SvenVw merged commit b553eea into development Mar 30, 2026
12 checks passed
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.

Add Bufferstrook Toggle to Fields Table

2 participants