feat(insights): Database system selector in Queries module
Adds a new dropdown selector to the Queries module that is responsible for changing the view depending on the currently selected database system,
While the component itself is simple, there is a lot of logic happening behind the scenes that is difficult to follow, here it is broken down;
- Queries the current project's spans to finds all database systems being used, and populates the dropdown selector options with compatible systems, in descending order based on number of spans per system
- defaults to choosing the first option in the list (the system with the most spans)
- Component is disabled when only one database system is being used (consistent with our design philosophy to not hide information / components)
- The most recent option that was selected is saved to
localStorage, so next time you view the page it will maintain your selection - The currently selected system is saved in the URL's query params
- Following a URL with a non-default system selected will maintain this selection, but will not override your selection that is saved to your localStorage
TODO in followup PR
- [ ] Update the view according to which system was selected (mongodb terminology and formatting will be different from SQL)
Bundle Report
Changes will increase total bundle size by 1.51MB :arrow_up:
| Bundle name | Size | Change |
|---|---|---|
| app-webpack-bundle-array-push | 30.23MB | 1.51MB :arrow_up: |
:x: 1 Tests Failed:
| Tests completed | Failed | Passed | Skipped |
|---|---|---|---|
| 7656 | 1 | 7655 | 0 |
View the top 1 failed tests by shortest run time
DatabaseSystemSelector is disabled when only one database system is present and shows that system as selectedDatabaseSystemSelector is disabled when only one database system is present and shows that system as selectedStack Traces | 0.068s run time
Error: expect(element).toHaveTextContent()
Expected element to have text content:
DB SystemPostgreSQL
Received:
DB SystemNone
at Object.<anonymous> (.../database/components/databaseSystemSelector.spec.tsx:46:30)
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard
I'm going to open this PR as is for now since it is getting lengthy, it is hidden behind a feature flag so it will only be visible for internal orgs. In a followup PR I will add the functionality to change the view based on the system that was selected