Files
ServerKit/frontend/src/components/ServiceCard.jsx
T
Juan Denis 19c727be4c Add Windows service support and new UI components
Agent: factor run logic into agentMainLoop and detect SCM launch; add Windows service dispatcher (service_windows.go) and POSIX stub (service_other.go) to properly handle SCM lifecycle and avoid Windows SCM error 1053. Frontend: add a set of presentational components (DangerZone, InfoList/InfoItem, JournalControls, LogViewer, MetricRow/MetricItem, ProcessTable, ProgressBar, ServiceCard, StatCard) and wire them into multiple pages and security tabs, replacing many ad-hoc info-list blocks. Also add a route for style-guide/:tab and update AgentFleet to use the new StatCard/StatsGrid layout. These changes improve service reliability on Windows and DRY up UI layouts with reusable components.
2026-04-30 23:11:26 -04:00

65 lines
1.7 KiB
React

import React from 'react';
import { Badge } from '@/components/ui/badge';
export function ServicesGrid({ children, className = '' }) {
return <div className={`services-grid ${className}`.trim()}>{children}</div>;
}
export function ServiceCard({
name,
description,
status,
statusVariant,
meta = [],
actions,
children,
}) {
const variant = statusVariant ?? defaultStatusVariant(status);
return (
<div className="service-card">
<div className="service-header">
<div className="service-info">
<span className={`status-dot ${variant}`} />
<h4>{name}</h4>
</div>
<Badge variant={variant}>{status}</Badge>
</div>
{description && <p className="service-description">{description}</p>}
{meta.length > 0 && (
<div className="service-meta">
{meta.map((m, i) => (
<span key={i} className="meta-item">
<span className="meta-label">{m.label}:</span> {m.value}
</span>
))}
</div>
)}
{(actions || children) && (
<div className="service-actions">
{actions ?? children}
</div>
)}
</div>
);
}
function defaultStatusVariant(status) {
switch (status?.toLowerCase()) {
case 'running':
case 'active':
return 'success';
case 'stopped':
case 'failed':
return 'destructive';
case 'inactive':
return 'secondary';
default:
return 'warning';
}
}
export default ServiceCard;