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

Refactor Save search modal #603

Merged
merged 37 commits into from
Sep 12, 2024
Merged

Refactor Save search modal #603

merged 37 commits into from
Sep 12, 2024

Conversation

chrtorres
Copy link
Collaborator

@chrtorres chrtorres commented Sep 9, 2024

🗣 Description

  • Refactored Save Search modal from legacy dependency libraries to Material UI.
  • Applied form validation to prevent empty strings or duplicate entries when entering a new saved search.
  • Updated the 'Update Saved Search' functionality.
  • Removed 'vulnerabilityTemplate' and 'createVulnerability' from saved-search. Functionality no longer needed.

💭 Motivation and context

Prior to this fix, save search was reliant on legacy dependency libraries. In an effort to make the application uniform and simplified, this modal has been refactored using Material UI components. Also, When a user is able to save a search, there should be some sort of check to prevent the entry of duplicate names and/or empty names. With this fix, form validation is now present to avoid invalid entries.

This resolves CRASM-629

🧪 Testing

📷 Screenshots

Save Search Modal Before

Screenshot 2024-09-11 at 10 45 40 AM

Save Search Modal Refactored

Screenshot 2024-09-11 at 10 46 16 AM

Inventory page

Screenshot 2024-09-09 at 3 04 52 PM

Saving a new search

  • Apply any filter to enable the "Save Search" button.
Screenshot 2024-09-09 at 3 37 47 PM

Applying saved search

Screenshot 2024-09-09 at 3 06 59 PM

Updating a saved search

  • When updating a saved search, select the search you would like to update, apply or remove desired filters, click "Update Saved Search".
Screenshot 2024-09-11 at 10 47 26 AM

Form Validation against empty strings

Screenshot 2024-09-09 at 3 39 17 PM

Form validation against duplicate entries

Screenshot 2024-09-09 at 3 40 13 PM

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Create a release.

@chrtorres chrtorres self-assigned this Sep 9, 2024
@chrtorres chrtorres added improvement This issue or pull request will add or improve functionality, maintainability, or ease of use frontend labels Sep 9, 2024
@chrtorres chrtorres marked this pull request as ready for review September 9, 2024 20:20
Copy link
Collaborator

@jayjaybunce jayjaybunce left a comment

Choose a reason for hiding this comment

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

Looks and feels great, one small comment on the hard reload of the view.

chrtorres and others added 2 commits September 9, 2024 17:42
- Removed use of local storage.
- No need as search term, filters, and sort are in context and stored in state.
- Saved Searches are in context and have their own state.
- Created boolean based in state to determine if radio button is checked.
hawkishpolicy and others added 3 commits September 10, 2024 10:42
- activeSearch is now stored in SavedSearchContext.
- selectedSearch is now stored in SavedSearchContext.
- activeSearchId is now stored in SavedSearchContext.
- activeSearchId is determined in DrawerInterior and used to determine activeSearch and selectedSearch.
- those are then passed to SaveSearchModal.
@chrtorres chrtorres marked this pull request as draft September 10, 2024 19:31
chrtorres and others added 4 commits September 10, 2024 16:07
- Removed unused state from SavedSearchContext and SavedSearchContextProvider.
- Added boolean check to allow user to resuse a name for a saved search if it is the same search.
- Added disbale props to the update search dialogue.
- Saved Search list is now sorted ascending by name.
- Removed unused imports from SaveSearchModal and Inventory.
- Changed names of dialogs to be more descriptive.
- update handler is now handleUpdate.
@chrtorres chrtorres marked this pull request as ready for review September 11, 2024 13:40
Copy link
Collaborator

@jayjaybunce jayjaybunce left a comment

Choose a reason for hiding this comment

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

Tested locally, LGTM

Copy link
Contributor

@ameliav ameliav left a comment

Choose a reason for hiding this comment

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

Overall the code and UI look a lot cleaner to me. As for the removed functionality "create a vulnerability", we may want to discuss as a team whether we want to keep it commented or completely remove it.

frontend/src/components/DrawerInterior.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@cduhn17 cduhn17 left a comment

Choose a reason for hiding this comment

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

As mentioned in the review. Lets get some comments regarding commented out code i.e. the plan for the deprecation of the commented code.

Copy link
Collaborator

@nickviola nickviola left a comment

Choose a reason for hiding this comment

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

👍 LGTM!

@chrtorres chrtorres assigned chrtorres and unassigned chrtorres Sep 11, 2024
@chrtorres
Copy link
Collaborator Author

As mentioned in the review. Lets get some comments regarding commented out code i.e. the plan for the deprecation of the commented code.

Comments have been added referencing the deprecated code and plans to remove in future versions.

@ameliav ameliav self-requested a review September 11, 2024 18:09
Copy link
Contributor

@ameliav ameliav left a comment

Choose a reason for hiding this comment

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

LGTM with the added reference to the comments!

@schmelz21 schmelz21 merged commit c9983d2 into develop Sep 12, 2024
19 of 22 checks passed
@schmelz21 schmelz21 deleted the save-search-modal branch September 12, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend improvement This issue or pull request will add or improve functionality, maintainability, or ease of use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants