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

upcoming: [DI-20934] - Configurable Max limit on resource selection component #11252

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

ankitaakamai
Copy link
Contributor

Description 📝

Introduction of configurable Max limit on resource selection component and other enhancements.

Changes 🔄

  1. SELECT_ALL option in resources list component will not be available if number of resources are higher than the maximum resources selection limit set in launchDarkly.
  2. In resource selection autocomplete, user will be able to select resources up to maximum resource selection limit, all other resources(options) will be disabled after reaching this limit.
  3. Text 'Select up to limit label' is introduced under resource selection autocomplete.

Target release date 🗓️

12-12-2024

Preview 📷

Before After
image image
image image

How to test 🧪

Verification steps

  1. Login as a mock user.
  2. Select any resource type - linode or databases, and the relevant filters.
  3. If you have resources > max resource selection limit, you will not see any 'Select All' tab in resource selection autocomplete.
  4. Try selecting any resource after you have already selected resources up to max limit, you will not be able to select any additional resource as they are disabled after reaching max selection limit.

As an Author, I have considered 🤔

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@ankitaakamai ankitaakamai requested a review from a team as a code owner November 13, 2024 09:28
@ankitaakamai ankitaakamai requested review from mjac0bs and harsh-akamai and removed request for a team November 13, 2024 09:28
Copy link

Coverage Report:
Base Coverage: 87.37%
Current Coverage: 87.37%

@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 445 passing tests on test run #5 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing445 Passing2 Skipped94m 15s

Copy link
Contributor

@mjac0bs mjac0bs left a comment

Choose a reason for hiding this comment

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

Verified:

  • Any selections beyond the max limit are disabled
  • The Select All option is only present when the number of resource options is less than the limit
  • Test coverage is present and passing

Thanks @ankitaakamai, approving pending a couple of comments I left are addressed. I also called out one question about buggy UI behavior to see if the team is aware of it.

Copy link
Contributor

Choose a reason for hiding this comment

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

While reviewing, I noticed some unexpected behavior here: after making a selection and closing the resource select, opening it back up displays a flash of content for the options. This appears to be happening with any number of selections (not just the max) and is happening on the develop branch, so preexisting to this PR. Is this a bug that's already known and there is a ticket to address?

Screen.Recording.2024-11-13.at.9.27.28.AM.mov

"@linode/manager": Upcoming Features
---

Configurable Max limit on resource selection component ([#11252](https://github.com/linode/manager/pull/11252))
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Configurable Max limit on resource selection component ([#11252](https://github.com/linode/manager/pull/11252))
Configurable max limit on CloudPulse resource selection component ([#11252](https://github.com/linode/manager/pull/11252))

Could we mention CloudPulse here? Once this changeset becomes part of a full list of changes in a changelog, it's not always clear at a glance what product was impacted.

/>
);

fireEvent.click(screen.getByRole('button', { name: 'Open' }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use userEvent for the reasons described here in our developer docs. This was a recent update we made to update our best practices, so let's not rely on fireEvent for new test coverage.

We recommend using userEvent rather than fireEvent where possible. This is a React Testing Library best practice, because userEvent more accurately simulates user interactions in a browser and makes the test more reliable in catching unintended event handler behavior.

expect(screen.getByText('Select up to 10 Resources')).toBeInTheDocument();

for (let i = 14; i <= 23; i++) {
fireEvent.click(screen.getByRole('option', { name: `linode-${i}` }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Add'tl Approval Needed Waiting on another approval! CloudPulse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants