Skip to content

feat(new-webui): Add uncompressed and compressed data size cards (resolves #946).#958

Merged
davemarco merged 8 commits into
y-scope:mainfrom
davemarco:size
Jun 10, 2025
Merged

feat(new-webui): Add uncompressed and compressed data size cards (resolves #946).#958
davemarco merged 8 commits into
y-scope:mainfrom
davemarco:size

Conversation

@davemarco

@davemarco davemarco commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Description

Add compressed and uncompressed size cards. Originally wanted to put them on the right but then they wouldnt have access to size query. I would either have to query twice, or move state out of widget. Neither were desirable. So i moved to space savings side. Also, tried different background colours but they looked worse than just white.

Screenshot 2025-06-03 at 3 32 07 PM

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

Values appeared on cards

Summary by CodeRabbit

  • New Features
    • Added display of compressed and uncompressed size statistics in a new card-based grid layout on the Space Savings section.
  • Style
    • Updated layouts and card styles for improved visual alignment and spacing, including flexbox and grid enhancements.
    • Increased the maximum width of the dashboard grid for a more spacious layout.
    • Slightly increased font size for statistic text in detail cards.

@davemarco davemarco requested a review from a team as a code owner June 3, 2025 19:37
@coderabbitai

coderabbitai Bot commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces two new React components for displaying compressed and uncompressed sizes, and refactors the SpaceSavings component to present these metrics in a grid layout alongside the existing space savings statistic. Several CSS modules are updated or added to support the new grid and flexbox layouts, and some layout constraints are slightly adjusted.

Changes

File(s) Change Summary
.../IngestPage/SpaceSavings/CompressedSize.tsx
.../UncompressedSize.tsx
Added new React components to display compressed and uncompressed size statistics in cards.
.../IngestPage/SpaceSavings/index.tsx Refactored SpaceSavings to use a grid layout and include new size components; updated imports.
.../IngestPage/SpaceSavings/index.module.css Added new CSS module for grid and card styling in the SpaceSavings section.
.../IngestPage/Details/index.module.css Changed .timeRange to use flexbox and updated card styling within it.
.../IngestPage/index.module.css Increased the maximum width of the main grid container from 1200px to 1250px.
.../IngestPage/Details/DetailsCard.tsx Increased font size of the stat text in the DetailsCard component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant SpaceSavings
    participant UncompressedSize
    participant CompressedSize

    User->>SpaceSavings: Render component (with sizes and savings)
    SpaceSavings->>UncompressedSize: Pass uncompressedSize prop
    SpaceSavings->>CompressedSize: Pass compressedSize prop
    UncompressedSize-->>SpaceSavings: Render DetailsCard (Uncompressed Size)
    CompressedSize-->>SpaceSavings: Render DetailsCard (Compressed Size)
    SpaceSavings-->>User: Render grid with all three cards
Loading

Possibly related PRs

Suggested reviewers

  • junhaoliao

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3d3a361 and b7330ac.

📒 Files selected for processing (3)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx
🔇 Additional comments (4)
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (1)

1-15: Well-structured CSS grid layout.

The grid implementation is solid with responsive columns using minmax(200px, 1fr), appropriate spacing, and proper use of the :global() selector for Ant Design components. The layout structure (main card spanning full width, size cards in columns below) will provide a clean, organized display.

components/log-viewer-webui/client/src/pages/IngestPage/Details/DetailsCard.tsx (1)

25-25: Good readability improvement.

The font size increase from 1.3rem to 1.4rem enhances readability while maintaining visual balance with the new grid layout.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (2)

12-18: Clean import organization.

The new imports are well-organized and properly integrated with the existing component structure.


77-91: Excellent grid layout implementation.

The refactored render structure effectively implements the grid layout while preserving all existing functionality. The StatCard size reduction to "5.5rem" appropriately balances the new multi-card design, and the props are correctly passed to the new size components.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@davemarco davemarco requested a review from junhaoliao June 3, 2025 19:38
@davemarco davemarco changed the title feat(new-webui): Displays uncompressed and compressed data sizes (resolves #946). feat(new-webui): Add uncompressed and compressed data size cards (resolves #946). Jun 3, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 98acf70 and 3d3a361.

📒 Files selected for processing (6)
  • components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/CompressedSize.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (2 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.module.css (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/CompressedSize.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx
🧬 Code Graph Analysis (2)
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/CompressedSize.tsx (2)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/units.ts (1)
  • formatSizeInBytes (40-40)
components/webui/imports/ui/IngestView/panels/IngestionJobs/IngestionJobRow.jsx (1)
  • compressedSize (57-57)
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx (2)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/units.ts (1)
  • formatSizeInBytes (40-40)
components/webui/imports/ui/IngestView/panels/IngestionJobs/IngestionJobRow.jsx (1)
  • uncompressedSize (52-52)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (11)
components/log-viewer-webui/client/src/pages/IngestPage/index.module.css (1)

5-5: LGTM! Layout adjustment supports new grid components.

The increased max-width accommodates the expanded SpaceSavings grid layout with the new compressed and uncompressed size cards.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/CompressedSize.tsx (1)

1-25:

Details

✅ Verification successful

Well-structured component following React best practices.

The component is cleanly implemented with proper TypeScript interfaces, JSDoc documentation, and reuses existing UI components for consistency.

Verify formatSizeInBytes function signature.

Ensure the formatSizeInBytes function accepts the expected parameters (number, boolean) as used on line 19.


🏁 Script executed:

#!/bin/bash
# Description: Verify formatSizeInBytes function signature and usage
# Expected: Function should accept (size: number, showUnit?: boolean) parameters

# Search for formatSizeInBytes function definition
ast-grep --pattern 'function formatSizeInBytes($_, $_) {
  $$$
}'

# Also search for arrow function definition
ast-grep --pattern 'const formatSizeInBytes = ($_, $_) => {
  $$$
}'

# Search for export statement
rg -A 3 "export.*formatSizeInBytes"

Length of output: 274


🏁 Script executed:

#!/bin/bash
# Display lines around the definition of formatSizeInBytes to verify its signature
rg -n -C3 'formatSizeInBytes' components/log-viewer-webui/client/src/pages/IngestPage/Jobs/units.ts

Length of output: 488


Signature Verified

The formatSizeInBytes function is defined as:

const formatSizeInBytes = (
  value: number,
  useSiUnits: boolean = true,
  numFractionalDigits: number = 1
) => {  };

Passing (compressedSize, false) aligns with its (number, boolean?) signature (the third parameter defaults to 1), so no changes are needed.

components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css (2)

8-8: Good flexbox implementation for responsive layout.

Adding display: flex enables the cards to properly expand within the time range container.


12-14: Proper use of global selector for Ant Design components.

The :global(.ant-card) selector correctly targets Ant Design card components and flex: 1 ensures they expand to fill available space evenly.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.module.css (2)

1-6: Excellent CSS Grid implementation for responsive layout.

The grid configuration with minmax(200px, 1fr) provides responsive columns with sensible minimum widths, and align-items: stretch ensures consistent card heights.


8-15: Good use of grid-column span and flexbox for card layout.

The combination of grid-column: span 2 for full-width cards and flex: 1 for equal expansion follows modern CSS layout best practices.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/index.tsx (3)

78-91: Excellent refactor to grid layout with proper component composition.

The transition from a single StatCard to a grid layout with three components is well-implemented:

  • Proper CSS class usage for grid structure
  • Appropriate prop passing to child components
  • Maintained existing StatCard styling with slight size adjustment
  • Clean component composition

84-84: Good adjustment of stat size for new layout.

Increasing the statSize from "6rem" to "6.5rem" likely improves visual balance in the new three-card grid layout.


12-13:

Details

✅ Verification successful

Clean import organization for new components and styles.

The imports are well-organized and follow consistent patterns for component and CSS module imports.

Verify UncompressedSize component implementation.

The UncompressedSize component is imported but not included in the files for review. Ensure it follows the same pattern as CompressedSize.

Also applies to: 18-18


🏁 Script executed:

#!/bin/bash
# Description: Verify UncompressedSize component exists and follows similar pattern
# Expected: Should find UncompressedSize.tsx with similar structure to CompressedSize.tsx

# Search for UncompressedSize component file
fd "UncompressedSize.tsx"

# If found, examine its structure
fd "UncompressedSize.tsx" --exec cat {}

Length of output: 696


Verified UncompressedSize component exists and matches CompressedSize pattern

  • Located at components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx
  • Imports DetailsCard and formatSizeInBytes and defines a numeric prop, mirroring the structure of CompressedSize

No further changes needed.

components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx (2)

5-7: Prop interface is well-defined
The UncompressedSizeProps interface clearly types the uncompressedSize prop as a number. This aligns with TypeScript best practices for component props.


24-24: Default export is acceptable here
Using a default export for a single component file is a common pattern and is consistent with existing code.

Comment on lines +16 to +22
const UncompressedSize = ({uncompressedSize}: UncompressedSizeProps) => {
return (
<DetailsCard
stat={formatSizeInBytes(uncompressedSize, false)}
title={"Uncompressed Size"}/>
);
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Wrap component in React.memo and add unit tests
This pure functional component can benefit from memoization to prevent unnecessary re-renders. Additionally, consider adding a unit test (e.g., with React Testing Library) to verify that the formatted size string renders correctly.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx
around lines 16 to 22, wrap the UncompressedSize functional component with
React.memo to memoize it and avoid unnecessary re-renders. Additionally, create
a unit test using React Testing Library to render the component with a sample
uncompressedSize prop and verify that the formatted size string is displayed
correctly.

Comment on lines +9 to +15
/**
* Renders the uncompressed size statistic.
*
* @param props
* @param props.uncompressedSize
* @return
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Remove or refine redundant JSDoc
The JSDoc comments for this simple React component are redundant with TypeScript typings and prop destructuring. You can remove them or refine them to add context about units (bytes) or edge-case behaviours.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx
around lines 9 to 15, the JSDoc comments are redundant because TypeScript
typings and prop destructuring already provide the necessary information. Remove
the JSDoc comments entirely or refine them to add meaningful context such as
specifying that uncompressedSize is in bytes or describing any edge-case
behaviors related to this prop.

Comment on lines +1 to +2
import DetailsCard from "../Details/DetailsCard";
import {formatSizeInBytes} from "../Jobs/units";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Ensure consistent import paths
Using relative imports can become brittle as the directory structure evolves. If your project is configured with path aliases (e.g., @/pages/...), consider switching to absolute imports for better maintainability.

🤖 Prompt for AI Agents
In
components/log-viewer-webui/client/src/pages/IngestPage/SpaceSavings/UncompressedSize.tsx
at lines 1 to 2, the imports use relative paths which can be fragile as the
project structure changes. Update these imports to use the project's configured
absolute path aliases (e.g., '@/pages/...') instead of relative paths to improve
maintainability and reduce breakage from directory changes.

Comment on lines +16 to +17


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
/* Limits dashboard to two columns */
max-width: 1200px;
max-width: 1250px;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why did we increase this by 50px?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Uncompressed Size was wrapping to two lines, so this lets the cards expand a bit more

junhaoliao
junhaoliao previously approved these changes Jun 9, 2025
@davemarco

Copy link
Copy Markdown
Contributor Author

I made the space savings text a bit smaller, to try and shrink size of cards on right side

@davemarco davemarco requested a review from junhaoliao June 9, 2025 18:02
@davemarco davemarco merged commit 6200636 into y-scope:main Jun 10, 2025
7 checks passed
junhaoliao pushed a commit to junhaoliao/clp that referenced this pull request May 17, 2026
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.

2 participants