Skip to content

configurable row count#150

Merged
eviltester merged 2 commits into
masterfrom
140-text-to-control-auto-preview-number-rather-than-fix-10-as-default
Jun 3, 2026
Merged

configurable row count#150
eviltester merged 2 commits into
masterfrom
140-text-to-control-auto-preview-number-rather-than-fix-10-as-default

Conversation

@eviltester

@eviltester eviltester commented Jun 2, 2026

Copy link
Copy Markdown
Owner

closes #140

Summary by CodeRabbit

  • New Features

    • Added a preview row-count control (1–50) with a default of 10 to let reviewers choose how many rows show in preview mode.
  • UI Updates

    • Preview button label standardized to "Preview" (row count shown only in the spinbutton).
    • Row-count input made more compact and integrated into the preview/editor panel.
    • Changing the control updates preview output immediately.
  • Accessibility

    • Preview row-count input exposes/upkeeps ARIA labels and relevant attributes.
  • Tests

    • Expanded interaction and unit tests to validate preview row-limit behavior and UI flows.
  • Documentation

    • Added a frontend legacy-ui migration plan document.

Copilot AI review requested due to automatic review settings June 2, 2026 23:49
@eviltester eviltester linked an issue Jun 2, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Jun 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 56afad48-a23b-437b-97ef-f431549c6017

📥 Commits

Reviewing files that changed from the base of the PR and between 5bc0ca5 and efa6ed2.

📒 Files selected for processing (10)
  • AGENTS.md
  • apps/web/src/stories/export-format-interactions.js
  • apps/web/src/stories/import-export-workspace.stories.js
  • apps/web/src/stories/text-preview-editor.stories.js
  • docs/frontend-legacy-ui-elimination-plan.md
  • packages/core-ui/js/gui_components/app/import-export-workspace/index.js
  • packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-controller.js
  • packages/core-ui/src/tests/app/import-export-workspace.test.js
  • packages/core-ui/src/tests/app/text-preview-editor-controller.test.js
  • packages/core-ui/src/tests/app/text-preview-editor.test.js
✅ Files skipped from review due to trivial changes (1)
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • apps/web/src/stories/export-format-interactions.js
  • packages/core-ui/src/tests/app/text-preview-editor.test.js
  • apps/web/src/stories/import-export-workspace.stories.js
  • packages/core-ui/js/gui_components/app/import-export-workspace/index.js

📝 Walkthrough

Walkthrough

This PR extracts the preview row limit into a dedicated spinbutton control, injects it into TextPreviewEditor via a services parameter, syncs it with legacy ImportExportControls through workspace wiring, and updates stories, tests, styles, and docs to use the new UI and role-based selectors.

Changes

Preview Row Limit Control Extraction

Layer / File(s) Summary
Row Count Control - ARIA Label Support
packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-controller.js, packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-view.js
RowCountControl exposes inputAriaLabel and the view sets/removes the input's aria-label accordingly.
TextPreviewEditor - Service Injection & Controller API
packages/core-ui/js/gui_components/app/text-preview-editor/index.js, packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-controller.js
TextPreviewEditor accepts services (injectable createRowCountControl), adds normalizePreviewRowLimit and setPreviewRowLimit() on the controller, and initializes/updates state.previewRowLimit through the normalizer.
TextPreviewEditor View - Mount/CreateControls/Render/Destroy
packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-view.js
Add placeholder for row-count control, createControls() on mount using injected service, wire onChange to call controller.setPreviewRowLimit and re-render, update render() to refresh/disable control and simplify the mode button label, and destroy the control on teardown.
ImportExportControls & Workspace Wiring
packages/core-ui/js/gui_components/app/import-export-controls.js, packages/core-ui/js/gui_components/app/import-export-workspace/import-export-workspace-view.js, packages/core-ui/js/gui_components/app/import-export-workspace/index.js
Add ImportExportControls.setPreviewRowLimit() to normalize/clamp inputs; add workspace syncPreviewRowLimit and onPreviewRowLimitChange wiring to update legacy controls and controller props during mount and updates.
Story Harness & Interaction Tests
apps/web/src/stories/export-preview-story-harness.js, apps/web/src/stories/export-format-interactions.js
Refactor harness setPreviewRowLimit() to set #previewRowsCount and dispatch input; pass previewRowLimit via component props; update play interactions to use role-based Preview button and assert the Preview row count spinbutton value.
Storybook Meta / Controls / Docs
apps/web/src/stories/import-export-workspace.stories.js, apps/web/src/stories/text-preview-editor.stories.js
Add meta.args.previewRowLimit = 10 plus numeric argType (min 1, max 50, step 1); update docs text and play functions to assert the spinbutton value and the simplified Preview button.
Tests: Controller, View, Workspace, Integration
packages/core-ui/src/tests/app/text-preview-editor-controller.test.js, packages/core-ui/src/tests/app/text-preview-editor.test.js, packages/core-ui/src/tests/app/import-export-workspace.test.js, packages/core-ui/src/tests/utils/import-export-controls-mode.test.js
Add tests for previewRowLimit normalization, controller setPreviewRowLimit callback, view help text and disabled state, workspace delegation and runtime updates, and preview-then-import respecting the updated limit.
Styles, Docs, Agent Note
apps/web/styles.css, docs/frontend-legacy-ui-elimination-plan.md, AGENTS.md
Narrow preview row count input width to 3.25rem; add migration plan doc for legacy UI elimination; update AGENTS.md to reference the plan for legacy control changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A spinbutton springs to life so neat,
No longer hiding in the label's seat,
Row counts dance in their own small hole,
Service-injected, tidy and whole,
Hooray — the preview hops on its own soul!

🚥 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.
Title check ✅ Passed The title 'configurable row count' directly reflects the main change of making the preview row count configurable instead of fixed at 10.
Linked Issues check ✅ Passed The PR successfully implements issue #140 by adding a configurable previewRowLimit control that replaces the fixed value of 10 with user-adjustable input.
Out of Scope Changes check ✅ Passed All changes support the configurable row count objective. The documentation update and agent guidelines are minor supporting additions that facilitate future maintainability.

✏️ 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 140-text-to-control-auto-preview-number-rather-than-fix-10-as-default

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/src/stories/export-format-interactions.js

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

apps/web/src/stories/import-export-workspace.stories.js

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

apps/web/src/stories/text-preview-editor.stories.js

Oops! Something went wrong! :(

ESLint: 10.2.1

A config object is using the "root" key, which is not supported in flat config system.

Flat configs always act as if they are the root config file, so this key can be safely removed.

  • 5 others

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.

@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: 5bc0ca5185

ℹ️ 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".

Comment thread packages/core-ui/js/gui_components/app/import-export-workspace/index.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a configurable “preview row count” control to the import/export text preview experience so the preview sample size is no longer fixed at 10 rows (closes #140).

Changes:

  • Introduces a compact row-count input (min/max constrained) alongside the Preview/Edit toggle and wires it through the app-side workspace into legacy ImportExportControls.
  • Updates preview/edit help text and Storybook interaction harnesses to use the new row-count input (instead of embedding the count in the Preview button label).
  • Adds/updates Jest tests to cover runtime changes to the preview row limit and basic accessibility (aria-label) for the new control.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/core-ui/src/tests/utils/import-export-controls-mode.test.js Adds coverage that ImportExportControls respects a runtime-updated preview row limit.
packages/core-ui/src/tests/app/text-preview-editor.test.js Verifies the preview row-count control renders, updates help text, and disables in edit mode.
packages/core-ui/src/tests/app/import-export-workspace.test.js Verifies workspace wires the row-count input into state + legacy controls.
packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-view.js Adds optional aria-label handling on the shared numeric input for accessibility.
packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-controller.js Extends row-count control props normalization to include inputAriaLabel.
packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-view.js Renders and updates the row-count control in the preview editor UI; updates help text accordingly.
packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-controller.js Adds a controller API to update previewRowLimit at runtime.
packages/core-ui/js/gui_components/app/text-preview-editor/index.js Wires in the shared row-count control via services injection (defaulting to shared implementation).
packages/core-ui/js/gui_components/app/import-export-workspace/index.js Propagates preview row-limit changes from the preview editor into legacy controls and workspace state.
packages/core-ui/js/gui_components/app/import-export-workspace/import-export-workspace-view.js Passes the new preview row-limit change callback through to the preview editor component.
packages/core-ui/js/gui_components/app/import-export-controls.js Adds setPreviewRowLimit with clamping/normalization for legacy preview-limited rendering paths.
apps/web/styles.css Styles the preview row-count input more compactly for the app preview editor context.
apps/web/src/stories/text-preview-editor.stories.js Updates Storybook assertions for the Preview button and new row-count spinbutton.
apps/web/src/stories/import-export-workspace.stories.js Adds Storybook control for initial previewRowLimit and asserts row-count input presence/value.
apps/web/src/stories/export-preview-story-harness.js Updates story harness to set preview row limit via the input instead of mutating button text/state.
apps/web/src/stories/export-format-interactions.js Updates interaction flows to click “Preview” (no embedded count) and assert row-count control.

Comment thread apps/web/src/stories/import-export-workspace.stories.js

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/stories/text-preview-editor.stories.js (1)

43-48: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Story description is stale. The PR moves the row count out of the toggle button into a dedicated spinbutton, so this description no longer matches what the story demonstrates.

📝 Suggested wording
-        story:
-          'Preview-mode state with Auto Preview enabled and the preview-row count reflected in the toggle button label.',
+        story:
+          'Preview-mode state with Auto Preview enabled and the preview-row count shown in the dedicated "Preview row count" spinbutton (default 10).',

Based on learnings: "Add story descriptions to Storybook stories that explain what the story demonstrates, which defaults or limits matter, what the reviewer should try in the UI, and what outcome they should expect."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/stories/text-preview-editor.stories.js` around lines 43 - 48,
Update the story description string (docs.description.story) in
text-preview-editor.stories.js to reflect that the row count is no longer part
of the toggle button but is now controlled by a dedicated spinbutton; change the
text to briefly state what the story demonstrates (preview mode with Auto
Preview enabled, the presence and purpose of the spinbutton controlling
preview-row count), note any defaults/limits the spinbutton enforces, and
suggest what the reviewer should try in the UI and the expected outcome (e.g.,
toggling Auto Preview and adjusting the spinbutton updates the preview row
count).
🧹 Nitpick comments (1)
apps/web/src/stories/export-format-interactions.js (1)

51-51: ⚡ Quick win

No ambiguity risk from the new spinbutton’s label text for getByText('Preview')TextPreviewEditorView passes label: '' into createRowCountControl, and RowCountControlView renders that as an empty <span data-role="label">, while the spinbutton’s “Preview row count” text exists only as the input’s aria-label. So the only visible “Preview” text should be the mode button, keeping getByText('Preview') unambiguous (e.g., in playCsvRoundTrip and playPreviewEditMode). Consider using getByRole('button', { name: 'Preview' }) for consistency with the existing role-based queries.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/stories/export-format-interactions.js` at line 51, The test uses
getByText('Preview') which is safe here but inconsistent and slightly fragile
because RowCountControlView renders an empty label span while the spinbutton's
visible label is only aria-label; update the test to query the preview mode
button by role instead of text. Replace occurrences of getByText('Preview') in
the playCsvRoundTrip and playPreviewEditMode flows with getByRole('button', {
name: 'Preview' }), and ensure any helper or wrapper utilities that reference
getByText for this control are updated; verify
TextPreviewEditorView/createRowCountControl/RowCountControlView behavior remains
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/core-ui/src/tests/app/text-preview-editor.test.js`:
- Line 49: The test is using previewButton.innerText which is undefined under
jsdom; update the assertions in the test file to read previewButton.textContent
(and call .trim() if whitespace-sensitive) instead of previewButton.innerText
for both occurrences (the checks comparing to 'Preview' and the other
assertion), ensuring the test uses textContent.trim() where needed to match the
expected string.

---

Outside diff comments:
In `@apps/web/src/stories/text-preview-editor.stories.js`:
- Around line 43-48: Update the story description string
(docs.description.story) in text-preview-editor.stories.js to reflect that the
row count is no longer part of the toggle button but is now controlled by a
dedicated spinbutton; change the text to briefly state what the story
demonstrates (preview mode with Auto Preview enabled, the presence and purpose
of the spinbutton controlling preview-row count), note any defaults/limits the
spinbutton enforces, and suggest what the reviewer should try in the UI and the
expected outcome (e.g., toggling Auto Preview and adjusting the spinbutton
updates the preview row count).

---

Nitpick comments:
In `@apps/web/src/stories/export-format-interactions.js`:
- Line 51: The test uses getByText('Preview') which is safe here but
inconsistent and slightly fragile because RowCountControlView renders an empty
label span while the spinbutton's visible label is only aria-label; update the
test to query the preview mode button by role instead of text. Replace
occurrences of getByText('Preview') in the playCsvRoundTrip and
playPreviewEditMode flows with getByRole('button', { name: 'Preview' }), and
ensure any helper or wrapper utilities that reference getByText for this control
are updated; verify
TextPreviewEditorView/createRowCountControl/RowCountControlView behavior remains
unchanged.
🪄 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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 825d6e90-64fa-483d-a4c4-187555e7775b

📥 Commits

Reviewing files that changed from the base of the PR and between 70bed06 and 5bc0ca5.

📒 Files selected for processing (16)
  • apps/web/src/stories/export-format-interactions.js
  • apps/web/src/stories/export-preview-story-harness.js
  • apps/web/src/stories/import-export-workspace.stories.js
  • apps/web/src/stories/text-preview-editor.stories.js
  • apps/web/styles.css
  • packages/core-ui/js/gui_components/app/import-export-controls.js
  • packages/core-ui/js/gui_components/app/import-export-workspace/import-export-workspace-view.js
  • packages/core-ui/js/gui_components/app/import-export-workspace/index.js
  • packages/core-ui/js/gui_components/app/text-preview-editor/index.js
  • packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-controller.js
  • packages/core-ui/js/gui_components/app/text-preview-editor/text-preview-editor-view.js
  • packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-controller.js
  • packages/core-ui/js/gui_components/shared/row-count-control/row-count-control-view.js
  • packages/core-ui/src/tests/app/import-export-workspace.test.js
  • packages/core-ui/src/tests/app/text-preview-editor.test.js
  • packages/core-ui/src/tests/utils/import-export-controls-mode.test.js

Comment thread packages/core-ui/src/tests/app/text-preview-editor.test.js Outdated
@eviltester eviltester merged commit d48a049 into master Jun 3, 2026
14 checks passed
@eviltester eviltester deleted the 140-text-to-control-auto-preview-number-rather-than-fix-10-as-default branch June 3, 2026 10:37
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.

text to control auto preview number rather than fix 10 as default

2 participants