Skip to content

feat(new-webui): Add compression job table to Ingest page.#848

Merged
davemarco merged 6 commits into
y-scope:mainfrom
davemarco:ingestTable
May 1, 2025
Merged

feat(new-webui): Add compression job table to Ingest page.#848
davemarco merged 6 commits into
y-scope:mainfrom
davemarco:ingestTable

Conversation

@davemarco

@davemarco davemarco commented Apr 24, 2025

Copy link
Copy Markdown
Contributor

Description

Adds a table for ingestion jobs into main dashboard.

The data for the jobs is fake. Once the database is implemented, some more work may need to be done
to process the data from database, but that can dealt with in a future PR.

In addition, some of the grid settings were tweaked slightly.

Screenshot 2025-04-24 at 1 11 10 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

Table renders and squishes to two columns to one column

Summary by CodeRabbit

  • New Features
    • Added a new "Jobs" section to the Ingest page, displaying a table of ingestion job details such as job ID, status, speed, data ingested, and compressed size.
  • Style
    • Improved grid layouts for better responsiveness and flexibility on the Ingest page and its detail sections.
    • Introduced new styling for the Jobs section to ensure consistent appearance within the page layout.

@davemarco davemarco requested a review from a team as a code owner April 24, 2025 17:17
@coderabbitai

coderabbitai Bot commented Apr 24, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

This update introduces a new "Jobs" feature to the IngestPage of the log viewer web UI. It adds a new React component to display a table of ingestion job data, supported by a new TypeScript typings module and associated CSS styles. The IngestPage layout and grid CSS are updated to accommodate and style the new Jobs section, which currently displays hardcoded job data. Additional CSS refinements are made to the Details section and the main page grid for improved layout flexibility.

Changes

File(s) Change Summary
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx Added a new Jobs React component rendering a table of dummy ingestion job data using Ant Design, with styling and a placeholder for future API integration.
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx Introduced a TypeScript typings module defining the JobData interface and jobColumns table configuration for use with the Jobs component.
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.module.css Added a new CSS module defining a .jobs class with top padding for the Jobs component.
components/log-viewer-webui/client/src/pages/IngestPage/index.tsx Imported the new Jobs component and added it to the IngestPage layout within a styled div. No other logic changes.
components/log-viewer-webui/client/src/pages/IngestPage/index.module.css Updated grid layout for .ingestPageGrid to use flexible columns and a max width, and added a .jobs class to span the Jobs section across all columns.
components/log-viewer-webui/client/src/pages/IngestPage/Details/index.module.css Modified the .detailsGrid CSS rule to use flexible column sizing instead of fixed widths, allowing responsive expansion.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IngestPage
    participant Jobs
    participant AntDesignTable

    User->>IngestPage: Loads IngestPage
    IngestPage->>Jobs: Renders Jobs component
    Jobs->>AntDesignTable: Passes jobColumns and DUMMY_DATA
    AntDesignTable-->>Jobs: Renders job table
    Jobs-->>IngestPage: Table displayed in grid layout
Loading

Suggested reviewers

  • junhaoliao

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3fbb5a9 and 1e00100.

📒 Files selected for processing (2)
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx
✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 April 24, 2025 17:18

@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: 1

🧹 Nitpick comments (5)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx (1)

26-57: Well-configured table columns with proper typing

The column definitions are properly typed using Ant Design's TableProps with appropriate fields. The custom render function for the status badge is a good approach for visual indication.

A minor formatting suggestion:

            <Badge
                status={status}
-                text={status}/>
+                text={status} />
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx (4)

1-8: Imports look good, but consider organizing them more consistently.

The imports are functionally correct, but consider grouping them by type (external libraries, internal components, types, styles) with a blank line between groups for better readability.

 import {Table} from "antd";
 
 import {DashboardCard} from "../../../components/DashboardCard";
 import styles from "./index.module.css";
+
 import {
     jobColumns,
     JobData,
 } from "./typings";

11-70: Consider adding pagination or virtualization for the job table.

The dummy data array is well-structured, but having 7 items displayed without pagination might not scale well when real data is implemented. Consider implementing pagination or virtualization for better performance with larger datasets.

Also, the jobId and key properties have the same values. When you implement the real data, ensure that this pattern continues or consider generating the key values separately.


82-82: Defensive coding with styles fallback could be improved.

Using styles["jobs"] || "" is a good defensive approach, but there's a more TypeScript-friendly way to handle this that avoids potential runtime issues.

-    className={styles["jobs"] || ""}
+    className={styles.jobs}

The TypeScript compiler should correctly type-check the styles object, and modern CSS module implementations automatically generate type definitions that make this safe.


73-78: JSDoc is missing a return type.

The JSDoc comment for the Jobs component is incomplete. The @return tag should specify what the component returns.

 /**
  * Renders table with ingestion jobs inside a card.
  *
  * @return
+ * @returns {JSX.Element} A React component displaying job data in a table
  */
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6300fa5 and 3fbb5a9.

📒 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/Jobs/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/index.module.css (1 hunks)
  • components/log-viewer-webui/client/src/pages/IngestPage/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/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx
  • components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx
🧬 Code Graph Analysis (1)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.tsx (2)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx (2)
  • JobData (59-59)
  • jobColumns (61-61)
components/log-viewer-webui/client/src/components/DashboardCard/index.tsx (1)
  • DashboardCard (48-48)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (9)
components/log-viewer-webui/client/src/pages/IngestPage/Jobs/index.module.css (1)

1-3: The CSS looks good!

Simple, clean implementation of padding to create vertical spacing for the Jobs component.

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

3-5: Great responsive grid implementation!

The change to use repeat(auto-fit, minmax(400px, 1fr)) creates a flexible layout that adapts to different screen sizes. Adding the max-width constraint with an explanatory comment is a good practice that clearly communicates the intention to limit the dashboard to two columns.


10-12: Good approach for the jobs section layout

Using grid-column: 1 / -1 for the jobs section ensures it spans the full width of the grid, which is appropriate for displaying tabular data that benefits from maximum available horizontal space.

components/log-viewer-webui/client/src/pages/IngestPage/Jobs/typings.tsx (3)

1-8: Good type definitions using Ant Design components

Clean imports and proper type alias definition for the status colors based on Ant Design's Badge component.


10-20: Well-structured interface with good documentation

The JobData interface clearly defines the structure needed for the table data with appropriate types and JSDoc comments.


59-61: Clean exports

Appropriate exports using named export syntax.

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

3-3: Good responsive grid implementation for details

The change to use repeat(2, minmax(200px, 1fr)) makes the details grid responsive while maintaining a minimum column width. This approach is consistent with the responsive grid changes in the main page, creating a unified responsive experience.

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

3-3: Clean import of the new Jobs component

Import statement follows the established pattern in the file.


17-19: Good integration of the Jobs component

The Jobs component is well-integrated into the page layout with a wrapper div using the appropriate CSS class. This structure allows the component to utilize the grid-column styling defined in the CSS module, ensuring it spans the full width of the grid as intended.

Comment on lines +80 to +86
<DashboardCard title={"Ingestion Jobs"}>
<Table<JobData>
className={styles["jobs"] || ""}
columns={jobColumns}
dataSource={DUMMY_DATA}
pagination={false}/>
</DashboardCard>

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.

🛠️ Refactor suggestion

Table implementation looks good, but consider adding loading state and empty data handling.

The Table component is properly implemented with TypeScript generics, but it lacks handling for loading states, errors, or empty data scenarios which will be important when connecting to a real API.

Consider adding these properties to the Table component:

 <Table<JobData>
     className={styles["jobs"] || ""}
     columns={jobColumns}
     dataSource={DUMMY_DATA}
-    pagination={false}/>
+    pagination={false}
+    loading={false}
+    locale={{ emptyText: "No job data available" }}
+ />

@junhaoliao junhaoliao left a comment

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.

code-wise looks good. will check aesthetics later

Comment on lines +17 to +19
<div className={styles["jobs"]}>
<Jobs/>
</div>

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.

assuming <Jobs/> is only intended to be used in a grid on the Ingestion page, shall we move this style specification into the <Jobs/> component itself?

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 think I prefer the grid settings outside the component, since it is really layout css and not related to the component itself. We could maybe add a className prop, to hide the divs if you think that looks better

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.

add className ... to hide the divs

sounds good

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 will do this.

@davemarco davemarco requested a review from junhaoliao April 29, 2025 17:57

@junhaoliao junhaoliao left a comment

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.

I was thinking if we could make the columns sortable, users will be able to categorize the jobs by their status, or figure out which job has the best / worst compression time. That said, we can (should?) work on that later once we connect the UI with real data.

For the PR title, how about:

feat(new-webui): Add compression job table to Ingest page.

Comment on lines +76 to +93
/**
* Renders table with ingestion jobs inside a card.
*
* @return
*/
const Jobs = ({className}: JobsProps) => {
return (
<div className={className}>
<DashboardCard title={"Ingestion Jobs"}>
<Table<JobData>
className={styles["jobs"] || ""}
columns={jobColumns}
dataSource={DUMMY_DATA}
pagination={false}/>
</DashboardCard>
</div>
);
};

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.

would it be better to write

Suggested change
/**
* Renders table with ingestion jobs inside a card.
*
* @return
*/
const Jobs = ({className}: JobsProps) => {
return (
<div className={className}>
<DashboardCard title={"Ingestion Jobs"}>
<Table<JobData>
className={styles["jobs"] || ""}
columns={jobColumns}
dataSource={DUMMY_DATA}
pagination={false}/>
</DashboardCard>
</div>
);
};
/**
* Renders table with ingestion jobs inside a card.
*
* @return
*/
const Jobs = ({...rest}: JobsProps) => {
return (
<div {...rest}>
<DashboardCard title={"Ingestion Jobs"}>
<Table<JobData>
className={styles["jobs"] || ""}
columns={jobColumns}
dataSource={DUMMY_DATA}
pagination={false}/>
</DashboardCard>
</div>
);
};

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 think because there is only one prop, for now I think its better as is.

@davemarco davemarco changed the title feat(new-webui): Adds job table to Ingestion page. feat(new-webui): Add compression job table to Ingest page. May 1, 2025
@davemarco davemarco merged commit 900ccf9 into y-scope:main May 1, 2025
6 checks passed
@davemarco

Copy link
Copy Markdown
Contributor Author

I agree sorting may be helpful, but we can add a later date. Especially if we want to support server side filtering.

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