-
-
Notifications
You must be signed in to change notification settings - Fork 84
Update container metadata card UI and overview tab #466
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
Conversation
WalkthroughRemoves the Details tab and its component from the container view, adjusts tab layout, introduces a new ContainerMetadataCard used in the Overview tab, and extends the Container interface with labels and mounts to support the new metadata display. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Page as Container Page
participant API as containerApi
participant Overview as OverviewTab
participant Card as ContainerMetadataCard
User->>Page: Open container view
Page->>API: Fetch container data
API-->>Page: Container { status, id, image, command, labels, mounts, ports, createdAt, ... }
Page->>Overview: Render Overview tab
Overview->>Card: Pass container props
Card-->>Overview: Render metadata (status, times, ports, mounts)
Overview-->>User: Display updated Overview (no Details tab)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
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.
Actionable comments posted: 5
🧹 Nitpick comments (2)
view/app/containers/[id]/components/ContainerDetailsLoading.tsx (1)
17-17: Optional whitespace cleanup.These empty lines appear to be leftover formatting from the Details tab removal. Consider removing them for consistency.
Apply this diff to clean up whitespace:
<TabsList> <TabsTrigger value="overview">Overview</TabsTrigger> <TabsTrigger value="logs">Logs</TabsTrigger> - </TabsList></TabsContent> - </Tabs>Also applies to: 65-65
view/app/containers/[id]/components/ContainerMetadataCard.tsx (1)
12-85: Consider i18n for user-facing labels.The component uses hardcoded English labels ("Status", "Created", "Container ID", etc.) while other parts of the codebase use the
useTranslationhook for i18n support (see OverviewTab.tsx). Consider internationalizing these labels for consistency.Example pattern from OverviewTab:
import { useTranslation } from '@/hooks/use-translation'; export function ContainerMetadataCard({ container }: ContainerMetadataCardProps) { const { t } = useTranslation(); return ( // ... <span className="text-sm text-muted-foreground font-medium"> {t('containers.status')} </span>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
view/app/containers/[id]/components/ContainerDetailsLoading.tsx(2 hunks)view/app/containers/[id]/components/ContainerMetadataCard.tsx(1 hunks)view/app/containers/[id]/components/DetailsTab.tsx(0 hunks)view/app/containers/[id]/components/OverviewTab.tsx(2 hunks)view/app/containers/[id]/page.tsx(3 hunks)view/redux/services/container/containerApi.ts(1 hunks)
💤 Files with no reviewable changes (1)
- view/app/containers/[id]/components/DetailsTab.tsx
🧰 Additional context used
🧬 Code graph analysis (3)
view/app/containers/[id]/components/OverviewTab.tsx (1)
view/app/containers/[id]/components/ContainerMetadataCard.tsx (1)
ContainerMetadataCard(12-85)
view/app/containers/[id]/components/ContainerMetadataCard.tsx (1)
view/redux/services/container/containerApi.ts (1)
Container(5-26)
view/app/containers/[id]/page.tsx (2)
view/app/containers/[id]/components/OverviewTab.tsx (1)
OverviewTab(13-108)view/app/containers/[id]/components/LogsTab.tsx (1)
LogsTab(13-31)
🔇 Additional comments (2)
view/app/containers/[id]/components/OverviewTab.tsx (1)
7-7: LGTM!The ContainerMetadataCard is properly imported and integrated into the Overview tab with appropriate responsive grid layout (
col-span-1 md:col-span-2). The placement below existing cards provides a logical flow for the enhanced metadata display.Also applies to: 101-104
view/app/containers/[id]/page.tsx (1)
173-173: LGTM!Correctly adjusted grid columns from 5 to 4 after removing the Details tab.
| <Card className="w-full rounded-lg shadow-md border border-gray-200"> | ||
| <CardHeader> | ||
| <CardTitle className="flex items-center gap-2 text-lg"> | ||
| <Info className="h-5 w-5" /> Label |
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.
Misleading card title.
The card title "Label" doesn't accurately describe the content, which shows comprehensive container metadata including status, creation time, IDs, ports, and mounts. Consider using "Metadata" or "Container Details" instead.
Apply this diff:
<CardHeader>
<CardTitle className="flex items-center gap-2 text-lg">
- <Info className="h-5 w-5" /> Label
+ <Info className="h-5 w-5" /> Container Metadata
</CardTitle>
</CardHeader>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <Info className="h-5 w-5" /> Label | |
| <CardHeader> | |
| <CardTitle className="flex items-center gap-2 text-lg"> | |
| <Info className="h-5 w-5" /> Container Metadata | |
| </CardTitle> | |
| </CardHeader> |
🤖 Prompt for AI Agents
In view/app/containers/[id]/components/ContainerMetadataCard.tsx around line 17,
the visible card title text currently reads "Label" which is misleading for a
card that displays full container metadata; change that text to a clearer title
such as "Container Details" (or "Metadata") by replacing the "Label" text node
with "Container Details", and if present update any accessibility attributes
(aria-label/title) or i18n keys to match the new label so the UI and assistive
tech reflect the corrected title.
| {container.mounts.map((mount: { source: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; destination: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; }, idx: React.Key | null | undefined) => ( | ||
| <li key={idx}>{mount.source} → {mount.destination}</li> | ||
| ))} |
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.
Replace verbose inline type with proper interface.
The inline type annotation for mounts is extremely verbose and unreadable. This should use the properly typed ContainerMount interface from the Container API definition (once fixed per the comment on containerApi.ts).
After fixing the types in containerApi.ts, this code will automatically benefit from proper typing:
- {container.mounts.map((mount: { source: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; destination: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; }, idx: React.Key | null | undefined) => (
+ {container.mounts.map((mount, idx) => (
<li key={idx}>{mount.source} → {mount.destination}</li>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {container.mounts.map((mount: { source: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; destination: string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined; }, idx: React.Key | null | undefined) => ( | |
| <li key={idx}>{mount.source} → {mount.destination}</li> | |
| ))} | |
| {container.mounts.map((mount, idx) => ( | |
| <li key={idx}>{mount.source} → {mount.destination}</li> | |
| ))} |
🤖 Prompt for AI Agents
In view/app/containers/[id]/components/ContainerMetadataCard.tsx around lines
75-77, replace the extremely verbose inline mount type in the map callback with
the proper ContainerMount interface: remove the inline type annotation on the
map parameter, import (or reference) the ContainerMount type from the Container
API types, and rely on container.mounts being typed as ContainerMount[] (fix
containerApi.ts first if needed); ensure the map callback signature is simply
(mount, idx) => (...) and add the ContainerMount import at the top of the file
so IDE/typechecker picks up the correct types.
| import { OverviewTab } from './components/OverviewTab'; | ||
| import { LogsTab } from './components/LogsTab'; | ||
| import { DetailsTab } from './components/DetailsTab'; | ||
| // import { DetailsTab } from './components/DetailsTab'; |
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.
🛠️ Refactor suggestion | 🟠 Major
Remove commented import.
Commented-out code should be deleted rather than kept in the codebase. The Details tab has been removed per PR objectives, so this import is no longer needed.
Apply this diff:
import { LogsTab } from './components/LogsTab';
-// import { DetailsTab } from './components/DetailsTab';
import { Terminal as TerminalComponent } from './components/Terminal';📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // import { DetailsTab } from './components/DetailsTab'; | |
| import { LogsTab } from './components/LogsTab'; | |
| import { Terminal as TerminalComponent } from './components/Terminal'; |
🤖 Prompt for AI Agents
In view/app/containers/[id]/page.tsx around line 28, remove the commented-out
import line "// import { DetailsTab } from './components/DetailsTab';" — delete
the commented code so the file no longer contains the unused commented import
(the Details tab was removed and the import is obsolete).
| {/* <TabsTrigger value="details"> | ||
| <HardDrive className="mr-2 h-4 w-4" /> | ||
| {t('containers.details')} | ||
| </TabsTrigger> | ||
| </TabsTrigger> */} |
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.
🛠️ Refactor suggestion | 🟠 Major
Remove commented tab trigger and content.
Dead code should be removed, not commented out. Version control preserves the history if needed.
Apply this diff:
<TabsTrigger value="logs">
<Terminal className="mr-2 h-4 w-4" />
{t('containers.logs')}
</TabsTrigger>
- {/* <TabsTrigger value="details">
- <HardDrive className="mr-2 h-4 w-4" />
- {t('containers.details')}
- </TabsTrigger> */}
</TabsList> </TabsContent>
- {/* <TabsContent value="details" className="mt-4"> */}
- {/* <DetailsTab container={container} /> */}
- {/* </TabsContent> */}
<TabsContent value="terminal" className="mt-4">Also applies to: 201-203
🤖 Prompt for AI Agents
In view/app/containers/[id]/page.tsx around lines 190-193 (and also apply the
same change at 201-203), there are commented-out TabsTrigger and its related
content blocks that constitute dead code; remove these commented JSX lines
entirely rather than leaving them commented so the file contains only active
code and no commented tab trigger/content. Ensure you delete the commented
block(s) and adjust surrounding whitespace/indentation so the remaining JSX
remains valid and compiles.
| labels: any; | ||
| mounts: any; |
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.
Replace any types with proper TypeScript interfaces.
Using any for labels and mounts eliminates type safety and can lead to runtime errors. Based on how these fields are consumed in ContainerMetadataCard (lines 75-77), proper types should be defined.
Apply this diff to add proper type definitions:
+export interface ContainerMount {
+ source: string;
+ destination: string;
+ mode?: string;
+ rw?: boolean;
+ propagation?: string;
+}
+
export interface Container {
- labels: any;
- mounts: any;
+ labels: Record<string, string>;
+ mounts: ContainerMount[];
id: string;📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| labels: any; | |
| mounts: any; | |
| export interface ContainerMount { | |
| source: string; | |
| destination: string; | |
| mode?: string; | |
| rw?: boolean; | |
| propagation?: string; | |
| } | |
| export interface Container { | |
| labels: Record<string, string>; | |
| mounts: ContainerMount[]; | |
| id: string; | |
| } |
🤖 Prompt for AI Agents
In view/redux/services/container/containerApi.ts around lines 6-7, the
properties labels and mounts are typed as any; replace them with concrete
TypeScript types used by ContainerMetadataCard (lines 75-77). Define labels as
Record<string, string> (or a specific interface if keys are known) and define
mounts as an array of a Mount interface (e.g., { Type: string; Source?: string;
Destination?: string; [key: string]: any } or the exact fields consumed). Add
these type/interface declarations in this file (or a shared types file), update
the container metadata interface to use labels: Record<string,string> and
mounts: Mount[], and adjust any callers if necessary to match the new types.
|
@Yasir761 can you provide a screenshot or screenrecording of the working solution, and kindly address the corerabbitai review's if they are relavant before getting reviewed by one of us, thanks! |
I attached the screenshot to the new PR |
|
closing this as a duplicate of #468 |
This PR is related to issue #458
Enhance the UI as suggested by the issue and remove the Detail component entirely.
Summary by CodeRabbit
New Features
Refactor