- Notifications
You must be signed in to change notification settings - Fork 419
RI-7707 update the database analysis page #5189
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
base: main
Are you sure you want to change the base?
RI-7707 update the database analysis page #5189
Conversation
…rybook stories - Migrate BarChart, DonutChart, and database-analysis components to styled-components - Add comprehensive Storybook stories for all major components - Integrate theme system and create reusable styled-components mixins - Fix circular dependencies and TypeScript errors - Remove SCSS modules and barrel exports causing issues
| /** | ||
| * Global styles for the application | ||
| * These styles are applied to the entire application using styled-components | ||
| */ | ||
| export const GlobalStyles = createGlobalStyle<{ theme: Theme }>` | ||
| :root { | ||
| // todo: replace with theme colors at some point | ||
| /* Type colors for Redis data types */ | ||
| --typeHashColor: #364cff; | ||
| --typeListColor: #008556; | ||
| --typeSetColor: #9c5c2b; | ||
| --typeZSetColor: #a00a6b; | ||
| --typeStringColor: #6a1dc3; | ||
| --typeReJSONColor: #3f4b5f; | ||
| --typeStreamColor: #6a741b; | ||
| --typeGraphColor: #14708d; | ||
| --typeTimeSeriesColor: #6e6e6e; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new patterns, affecting the whole app, should be ideally introduced in a separate PR with explanation.
Can't we use @ArtemHoruzhenko 's suggestion about extending theme with custom colors instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally these should not be custom, but I have not gotten a list of theme colors to use.
My suggestion for using css properties instead of even theme overrides is simply practical.
example:
--bg-color-neutral100: ${({ theme }) => theme.semantic.color.background.neutral100}; // .... background-color: ${({ theme }) => theme.semantic.color.background.neutral100}; // vs background-color: var(--bg-color-neutral100);If --var is defined at root level, it is accessible everywhere and is a lot shorter to type.
In this case, the colors defined are used in most if not all "key" related components.
In case of theme changes, this can be the single place where we need to apply the changes.
If we use the approach to override the theme, we should not override it but define our theme based on redis-ui theme. Why? Because in case that redis-ui decides to change the structure from theme.semantic.color.background.neutral100 to just theme.components.page.background, it will not be just matter of changing the override, but also everywhere the old path is used.
Of course this is just an opinion, the team can decide if we want to use any sort of override at all.
redisinsight/ui/src/pages/database-analysis/components/top-namespace/TopNamespace.spec.tsx Outdated Show resolved Hide resolved
| } | ||
| | ||
| const columns: ColumnDefinition<Key>[] = [ | ||
| const columns: ColumnDef<Key>[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is easy to extract columns outside the component - just need to put delimiter in a context or access it by other means
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but lets leave it as is for now, the focus of this PR is visuals
| {icon ? ( | ||
| <Row justify={justify} gap="m" align="center"> | ||
| <ButtonIcon | ||
| buttonSide="left" | ||
| icon={icon} | ||
| iconSide={iconSide} | ||
| loading={loading} | ||
| size={size} | ||
| /> | ||
| {children} | ||
| <ButtonIcon | ||
| buttonSide="right" | ||
| icon={icon} | ||
| iconSide={iconSide} | ||
| loading={loading} | ||
| size={size} | ||
| /> | ||
| </Row> | ||
| ) : ( | ||
| children |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this change needed? Can't you conditionally render just the buttons instead? Also why are both the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its ugly, but allows not to have extra wrapper if you don't pass an icon.
I don't like it as well, maybe we should use different approach.
Right now I need it in order to have "real" text like look of the button
redisinsight/ui/src/pages/database-analysis/DatabaseAnalysisPageView.tsx Outdated Show resolved Hide resolved
| .tooltipAnchor { | ||
| display: inline-flex; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this style reverted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean by reverted, but I needed this style, because without it, the tooltip wrapped content cannot be aligned: center (or otherwise) properly.
In icon that is 20x20 px when wrapped in tooltip, effectively has height of 25 or something like that - the tooltip content container has that size, not the icon, so if it is centerd, it is actually offset by some pixels
- Create DatabaseAnalysisFactory using Fishery and Faker for consistent test data generation - Refactor TopKeys.spec.tsx to use factory instead of plain mock objects - Ensures all DatabaseAnalysis properties are properly set in tests
Code Coverage - Frontend unit tests
Test suite run success5280 tests passing in 689 suites. Report generated by 🧪jest coverage report action from a9b84ea |
What
This PR migrates the database analysis page components from SCSS modules to styled-components, adds comprehensive Storybook stories, and resolves circular dependency issues.
Key Changes:
1. Styled-components Migration
BarChartandDonutChartfrom SCSS to styled-components with theme integrationTopNamespace,TopKeys,TableLoader,SummaryPerData,ExpirationGroupsView,GroupBadge, andTableTextBtnto styled-componentstheme.semantic.color.*,theme.core.space.*)2. Storybook Stories
Added comprehensive interactive stories for:
TopNamespace- 11 stories covering loading, empty states, data views, extrapolation, and custom delimitersTopKeys- 11 stories covering loading, various key types, TTL values, big keys, and custom delimitersGroupBadge- 8 stories covering key types, command groups, compressed mode, delete functionalityExpirationGroupsView- Stories for bar chart TTL visualizationDatabaseAnalysisPageView- Full page component storiesBarChartandDonutChart- Enhanced existing stories3. Styled-components Infrastructure
globalStyles.ts) with CSS variables for Redis data types and command groupsstyles/mixins/styledComponents.ts:truncateText- Text overflow handlingbreakpoint- Responsive media queriesscrollbarStyles- Custom scrollbar stylinginsightsOpen- Insights panel responsive statesCellTextcomponent props overridable while maintaining defaults4. TypeScript & Testing Improvements
TopNamespace.spec.tsxby creatingcreateMockedDatabaseAnalysishelperTopKeysTable.spec.tsxby properly typing Key arraysTable→TopKeysTableandTopNamespacesTableTesting
Manual Testing
Visual Verification
analysis-demo.mov