Repository navigation
feat(new-webui): Add panel to ingest page with mocked compression statistics. #824
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
Changes from all commits
a1171e4
bbda9e4
90230c2
e1bee56
0aca620
4d04da3
0ff2bc8
760d8b2
2cfcbb2
1fac0a6
72bb4be
3ca51e4
0d9a840
00574a0
6a1273a
735c949
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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; |
This file was deleted.
| 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
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify 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
fiLength of output: 203 Implement toggle control for Space Savings / Compression Ratios The Locations needing updates:
Please add the missing toggle functionality and ensure both views can be selected by the user. |
||
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.
Following the direction to make the panels generic, can we do one change to extract the Card component into one with props
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.
I made a new stat card