Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Group URLs in Select component #443

Merged
merged 4 commits into from
Jan 31, 2025

Conversation

cristianoventura
Copy link
Collaborator

@cristianoventura cristianoventura commented Jan 29, 2025

Description

This PR maps the list of allowed requests into a dropdown, so the user can select a URL when defining a new threshold.

How to Test

  • Type the konami code and enable the Thresholds feature
  • Open the Generator > Test Options > Thresholds
  • Check that the URL dropdown contains a list of URLs group by host, similar to the Test Builder
  • Change the form to a valid state and check the console for the result
  • Validations are not yet in place

Checklist

  • I have performed a self-review of my code.
  • I have added tests for my changes.
  • I have run linter locally (npm run lint) and all checks pass.
  • I have run tests locally (npm test) and all tests pass.
  • I have commented on my code, particularly in hard-to-understand areas.

Screenshots (if appropriate):

Screenshot 2025-01-29 at 10 02 51 AM

Related PR(s)/Issue(s)

@cristianoventura cristianoventura self-assigned this Jan 29, 2025
@cristianoventura cristianoventura requested a review from a team as a code owner January 29, 2025 18:13
Llandy3d
Llandy3d previously approved these changes Jan 30, 2025
Copy link
Member

@Llandy3d Llandy3d 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 🙌

A created threshold disappears on closing and reopening the popover but maybe it's expected at this stage.

I would also consider calling the last field in the table STOP TEST like in the cloud or adding a tooltip because on its own it seem confusing being just stop 🤔

Comment on lines 30 to 34
acc.push({
label: host,
value: host,
disabled: true,
})
Copy link
Collaborator

Choose a reason for hiding this comment

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

Semantically, those will still be disabled options, rather than groups.
I suggest one of the following options instead:

  • StyledReactSelect that @e-fisher added recently? It's a wrapper around react-select, which supports groups out of the box.
  • Use <Select.Group> for groups

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@going-confetti I've had some issues with ControlledReactSelect (which implements StyledReactSelect) inside the PopoverDialog. The positioning doesn't work well and when trying to use a portal to render it somewhere else, most of the styles were lost, so I followed your second option here by adding support to Select.Group in the existing ControlledSelect component.

? 'var(--gray-6)'
: 'var(--gray-3)'};
color: var(--sand-12);
font-size: var(--font-size-1);
Copy link
Collaborator

Choose a reason for hiding this comment

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

IMO this should have the same font size as the options, otherwise it looks inconsistent. Though this comment will likely be irrelevant once the other one has been resolved

@cristianoventura
Copy link
Collaborator Author

A created threshold disappears on closing and reopening the popover but maybe it's expected at this stage.

@Llandy3d This is expected at this point, but will be fixed soon ⚔️ 🐛

I would also consider calling the last field in the table STOP TEST like in the cloud or adding a tooltip because on its own it seem confusing being just stop 🤔

I'll do a UI polishment before promoting the feature and made notes of this to address later on! 👍

Copy link
Collaborator

@going-confetti going-confetti left a comment

Choose a reason for hiding this comment

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

LGTM!

@cristianoventura cristianoventura merged commit 14f94da into main Jan 31, 2025
3 checks passed
@cristianoventura cristianoventura deleted the chore/threshold-url-list branch January 31, 2025 16:16
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.

3 participants