-
-
Notifications
You must be signed in to change notification settings - Fork 70
Enhance UI #468
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
base: feat/develop
Are you sure you want to change the base?
Enhance UI #468
Changes from 2 commits
d5a45da
a9cf1d0
851eb26
459e420
456e5d0
527204f
de833f9
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,85 @@ | ||
| import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'; | ||
| import { Badge } from '@/components/ui/badge'; | ||
| import { formatDistanceToNow } from 'date-fns'; | ||
| import { Container } from '@/redux/services/container/containerApi'; | ||
| import { Info } from 'lucide-react'; | ||
| import React from 'react'; | ||
|
|
||
| interface ContainerMetadataCardProps { | ||
| container: Container; | ||
| } | ||
|
|
||
| export function ContainerMetadataCard({ container }: ContainerMetadataCardProps) { | ||
| return ( | ||
| <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" /> Container Metadata | ||
| </CardTitle> | ||
| </CardHeader> | ||
| <CardContent className="p-4"> | ||
| <div className="grid grid-cols-1 sm:grid-cols-2 gap-4"> | ||
| {/* Status */} | ||
| <div className="flex justify-between items-center"> | ||
| <span className="text-sm text-muted-foreground font-medium">Status</span> | ||
| <Badge variant={container.status === 'running' ? 'default' : 'secondary'}> | ||
| {container.status} | ||
| </Badge> | ||
| </div> | ||
|
|
||
| {/* Created */} | ||
| <div className="flex justify-between items-center"> | ||
| <span className="text-sm text-muted-foreground font-medium">Created</span> | ||
| <span className="text-sm"> | ||
| {formatDistanceToNow(new Date(container.created), { addSuffix: true })} | ||
| </span> | ||
| </div> | ||
|
|
||
| {/* Container ID */} | ||
| <div className="flex justify-between items-center"> | ||
| <span className="text-sm text-muted-foreground font-medium">Container ID</span> | ||
| <span className="text-sm font-mono truncate">{container.id}</span> | ||
| </div> | ||
|
|
||
| {/* Image */} | ||
| <div className="flex justify-between items-center"> | ||
| <span className="text-sm text-muted-foreground font-medium">Image</span> | ||
| <span className="text-sm font-mono truncate">{container.image}</span> | ||
| </div> | ||
|
|
||
| {/* Command */} | ||
| <div className="flex justify-between items-center col-span-1 sm:col-span-2"> | ||
| <span className="text-sm text-muted-foreground font-medium">Command</span> | ||
| <span className="text-sm font-mono truncate">{container.command}</span> | ||
| </div> | ||
|
|
||
| {/* Ports */} | ||
| {container?.ports?.length > 0 && ( | ||
| <div className="col-span-1 sm:col-span-2"> | ||
| <span className="text-sm text-muted-foreground font-medium">Ports</span> | ||
| <div className="flex flex-wrap gap-2 mt-1"> | ||
| {container.ports.map((port, index) => ( | ||
| <Badge key={`${port.private_port}-${port.public_port}-${index}`} variant="outline"> | ||
| {port.public_port} → {port.private_port} ({port.type}) | ||
| </Badge> | ||
| ))} | ||
| </div> | ||
| </div> | ||
| )} | ||
|
|
||
| {/* Mounts */} | ||
| {container?.mounts?.length > 0 && ( | ||
| <div className="col-span-1 sm:col-span-2"> | ||
| <span className="text-sm text-muted-foreground font-medium">Mounts</span> | ||
| <ul className="list-disc ml-4 mt-1 text-sm font-mono"> | ||
| {container.mounts.map((mount,idx) => ( | ||
| <li key={idx}>{mount.source} → {mount.destination}</li> | ||
| ))} | ||
| </ul> | ||
| </div> | ||
| )} | ||
| </div> | ||
| </CardContent> | ||
| </Card> | ||
| ); | ||
| } | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'; | |
| import { formatDistanceToNow } from 'date-fns'; | ||
| import { Container } from '@/redux/services/container/containerApi'; | ||
| import { useTranslation } from '@/hooks/use-translation'; | ||
| import { ContainerMetadataCard } from './ContainerMetadataCard'; | ||
|
|
||
| interface OverviewTabProps { | ||
| container: Container; | ||
|
|
@@ -97,6 +98,11 @@ export function OverviewTab({ container }: OverviewTabProps) { | |
| </div> | ||
| </CardContent> | ||
| </Card> | ||
| {/* New Metadata Card */} | ||
| <div className="col-span-1 md:col-span-2"> | ||
| <ContainerMetadataCard container={container} /> | ||
| </div> | ||
|
Comment on lines
+101
to
+104
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. Avoid duplicating Overview content.
@@
- {/* Status */}
- <div className="flex justify-between items-center">
- <span className="text-sm text-muted-foreground font-medium">Status</span>
- <Badge variant={container.status === 'running' ? 'default' : 'secondary'}>
- {container.status}
- </Badge>
- </div>
-
- {/* Created */}
- <div className="flex justify-between items-center">
- <span className="text-sm text-muted-foreground font-medium">Created</span>
- <span className="text-sm">
- {formatDistanceToNow(new Date(container.created), { addSuffix: true })}
- </span>
- </div>
-
@@
- {/* Ports */}
- {container?.ports?.length > 0 && (
- <div className="col-span-1 sm:col-span-2">
- <span className="text-sm text-muted-foreground font-medium">Ports</span>
- <div className="flex flex-wrap gap-2 mt-1">
- {container.ports.map((port, index) => (
- <Badge key={`${port.private_port}-${port.public_port}-${index}`} variant="outline">
- {port.public_port} → {port.private_port} ({port.type})
- </Badge>
- ))}
- </div>
- </div>
- )}
+ {/* Labels */}
+ {Object.keys(container.labels ?? {}).length > 0 && (
+ <div className="col-span-1 sm:col-span-2">
+ <span className="text-sm text-muted-foreground font-medium">
+ {t('containers.labels')}
+ </span>
+ <div className="flex flex-wrap gap-2 mt-1">
+ {Object.entries(container.labels).map(([key, value]) => (
+ <Badge key={key} variant="outline">
+ {key}: {value}
+ </Badge>
+ ))}
+ </div>
+ </div>
+ )}
🤖 Prompt for AI Agents |
||
|
|
||
| </div> | ||
| ); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.