Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.card :global(.ant-card-head) {
border: 0px;
}

.cardContent {
display: flex;
flex-direction: column;
}

.title {
font-size: 1.5rem;
font-weight: 600;
}

.statistic {
font-size: 5rem;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import {
Card,
Typography,
} from "antd";

import styles from "./index.module.css";


const {Text} = Typography;

interface StatCardProps {
title: string;
stat: string;
textColor?: string;
backgroundColor?: string;
}

/**
* Renders a card that dislays a statistic.
*
* @param props
* @param props.title
* @param props.stat
* @param props.textColor
* @param props.backgroundColor
* @return
*/
const StatCard = ({title, stat, textColor, backgroundColor}: StatCardProps) => {
return (
<Card
className={styles["card"] || ""}
hoverable={true}
style={{backgroundColor}}
>
<div className={styles["cardContent"]}>
<Text
className={styles["title"] || ""}
style={{color: textColor}}
>
{title}
</Text>
<Text
className={styles["statistic"] || ""}
style={{color: textColor}}
>
{stat}
</Text>
</div>
</Card>
);
};

export default StatCard;
16 changes: 0 additions & 16 deletions components/log-viewer-webui/client/src/pages/IngestPage.tsx

This file was deleted.

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.

Following the direction to make the panels generic, can we do one change to extract the Card component into one with props

interface StatsProps {
   title: string;
   value: string;
}

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.

I made a new stat card

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {theme} from "antd";

import StatCard from "../../../components/StatCard";


// eslint-disable-next-line no-warning-comments
// TODO: Replace with values from database once api implemented.
const DUMMY_COMPRESSED_SIZE = 1004023;
const DUMMY_UNCOMPRESSED_SIZE = 110300010;

/**
* Presents space savings or compression ratio from the given statistics.
*
* @return
*/
const SpaceSavings = () => {
const {token} = theme.useToken();
const compressedSize = DUMMY_COMPRESSED_SIZE as number;
const uncompressedSize = DUMMY_UNCOMPRESSED_SIZE as number;

const spaceSavingsPercent = (0 === uncompressedSize) ?
100 * (1 - (compressedSize / uncompressedSize)) :
0;

const spaceSavingsPercentText = `${spaceSavingsPercent.toFixed(2)}%`;

return (
<StatCard
backgroundColor={token.colorPrimary}
stat={spaceSavingsPercentText}
textColor={token.colorWhite}
title={"Space Savings"}/>
);
};


export default SpaceSavings;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.ingestPageGrid {
display: grid;
grid-template-columns: repeat(auto-fit, 400px);
padding: 20px;
gap: 20px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styles from "./index.module.css";
import SpaceSavings from "./SpaceSavings";


/**
* Presents compression statistics.
*
* @return
*/
const IngestPage = () => {
return (
<div className={styles["ingestPageGrid"]}>
<SpaceSavings/>
</div>
);
};


export default IngestPage;
Comment on lines +1 to +19

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.

💡 Verification agent

🧩 Analysis chain

Verify this implementation matches the requirements

According to the PR objectives, the panel should include a toggle between space savings and compression ratios. The current implementation only shows the SpaceSavings component without any toggle functionality. Is this planned for a future update?


🏁 Script executed:

#!/bin/bash
# Check if there's any toggle implementation in the SpaceSavings component
cd components/log-viewer-webui/client/src/pages/IngestPage
if [ -d "SpaceSavings" ]; then
  echo "Examining SpaceSavings component:"
  grep -r "toggle\|switch" SpaceSavings
fi

Length of output: 203


Implement toggle control for Space Savings / Compression Ratios

The IngestPage currently renders only the SpaceSavings component and does not include any toggle or switch to show compression ratios as required by the PR objectives.

Locations needing updates:

  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx:
    • Import and render a toggle UI (e.g. tabs, switch)
    • Import and conditionally render a CompressionRatio component alongside SpaceSavings

Please add the missing toggle functionality and ensure both views can be selected by the user.