Skip to content

feat: add preset selector in TasksPage - #19012

Merged
johnstcn merged 17 commits into
mainfrom
cj/tasks-preset-selector
Jul 24, 2025
Merged

johnstcn merged 17 commits into
mainfrom
cj/tasks-preset-selector

Conversation

@johnstcn

@johnstcn johnstcn commented Jul 23, 2025 •

Copy link
Copy Markdown
Member
  • Adds a preset selector in TasksPage that is visible if the selected template version defines presets, with the default preset pre-selected and at the top of the list.
  • If no default preset exists, the user is prompted to select one.
  • If a preset defines an AI Prompt, it will override the textarea.

@johnstcn johnstcn self-assigned this Jul 23, 2025
@johnstcn
johnstcn force-pushed the cj/tasks-preset-selector branch from 0a11e8e to ebeb601 Compare July 24, 2025 11:32
@johnstcn
johnstcn marked this pull request as ready for review July 24, 2025 11:44
@johnstcn
johnstcn requested a review from Copilot July 24, 2025 11:45

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

This PR adds a preset selector to the TasksPage that appears when the selected template version has defined presets. If a preset contains an AI Prompt parameter, it overrides the textarea input and makes it read-only.

  • Adds preset selection functionality with automatic default preset selection
  • Implements AI prompt override behavior when presets contain AI Prompt parameters
  • Refactors test data by moving mock objects to shared test helpers for better reusability

Reviewed Changes

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

File Description
site/src/testHelpers/entities.ts Adds mock preset data and task data for testing preset functionality
site/src/pages/TasksPage/TasksPage.tsx Implements preset selector UI, preset fetching logic, and AI prompt override behavior
site/src/pages/TasksPage/TasksPage.stories.tsx Updates stories to use shared mock data and adds new stories for preset scenarios

Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
Comment thread site/src/pages/TasksPage/TasksPage.tsx Outdated

Copilot AI Jul 24, 2025

Copy link

Choose a reason for hiding this comment

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

The template and preset selectors use identical styling (w-80 text-xs [&_svg]:size-icon-xs border-0 bg-surface-secondary h-8 px-3). Consider extracting this into a CSS class or constant to avoid duplication.

Suggested change
className="w-80 text-xs [&_svg]:size-icon-xs border-0 bg-surface-secondary h-8 px-3"
className="select-trigger-style"

Copilot uses AI. Check for mistakes.
Comment on lines 312 to 342

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

review: moved to entities.ts

@johnstcn
johnstcn requested a review from mtojek July 24, 2025 11:58

@mtojek mtojek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't feel super comfortable with extra useEffects, but I assume that we need to reload it dynamically, right?

Comment thread site/src/pages/TasksPage/TasksPage.tsx Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: maybe extract to a seperate function with a comment?

Comment thread site/src/pages/TasksPage/TasksPage.tsx Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: is it special/magic parameter now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

always has been

Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
@jaaydenh

Copy link
Copy Markdown
Contributor

Is selecting a preset required? On the create workspace page I added a "None" to make it explicit that choosing a preset is not necessary.

Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
@johnstcn

Copy link
Copy Markdown
Member Author

Is selecting a preset required? On the create workspace page I added a "None" to make it explicit that choosing a preset is not necessary.

Right now it technically isn't, although presets are currently the only way to expose parameter values on Tasks page. I can add a "none" option for consistency.

Comment thread site/src/pages/TasksPage/TasksPage.tsx Resolved
Comment thread site/src/pages/TasksPage/TasksPage.tsx Outdated

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.

Maybe this could be done later but it can be confusing for users that the Prompt is disabled because of a preset. In the dynamic parameters create workspace page, I label parameters when they are preset as such so user know why they can't be edited.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I could add a quick tooltip here

@johnstcn johnstcn Jul 24, 2025 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Addressed in 0fd55e2

@johnstcn
johnstcn force-pushed the cj/tasks-preset-selector branch from f6ecc40 to b3916e2 Compare July 24, 2025 17:20

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

LGTM

@johnstcn
johnstcn merged commit 9a05a8a into main Jul 24, 2025
@johnstcn
johnstcn deleted the cj/tasks-preset-selector branch July 24, 2025 19:19
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants