mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-12-04 22:21:21 +09:00
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.
93 lines
3.1 KiB
React
93 lines
3.1 KiB
React
import React from 'react';
|
|
import { Input } from '@/components/ui/input';
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
const PRIORITY_OPTIONS = [
|
|
{ value: '', label: 'All' },
|
|
{ value: '0', label: 'Emergency' },
|
|
{ value: '1', label: 'Alert' },
|
|
{ value: '2', label: 'Critical' },
|
|
{ value: '3', label: 'Error' },
|
|
{ value: '4', label: 'Warning' },
|
|
{ value: '5', label: 'Notice' },
|
|
{ value: '6', label: 'Info' },
|
|
{ value: '7', label: 'Debug' },
|
|
];
|
|
|
|
export function JournalControls({
|
|
unit = '',
|
|
onUnitChange,
|
|
unitLabel = 'Service/Unit',
|
|
unitPlaceholder = 'All services',
|
|
quickUnits = [],
|
|
showQuickUnits = true,
|
|
lineCount,
|
|
onLineCountChange,
|
|
lineCountOptions = [50, 100, 200, 500],
|
|
priority,
|
|
onPriorityChange,
|
|
showPriority = true,
|
|
loading = false,
|
|
onLoad,
|
|
loadLabel = 'Load Logs',
|
|
}) {
|
|
return (
|
|
<div className="journal-controls">
|
|
<div className="control-group">
|
|
<label>{unitLabel}</label>
|
|
<div className="input-with-suggestions">
|
|
<Input
|
|
type="text"
|
|
value={unit}
|
|
onChange={(e) => onUnitChange?.(e.target.value)}
|
|
placeholder={unitPlaceholder}
|
|
/>
|
|
{showQuickUnits && quickUnits.length > 0 && (
|
|
<div className="quick-units">
|
|
{quickUnits.map(u => (
|
|
<button
|
|
key={u}
|
|
className={`unit-chip ${unit === u ? 'active' : ''}`}
|
|
onClick={() => onUnitChange?.(unit === u ? '' : u)}
|
|
>
|
|
{u}
|
|
</button>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
</div>
|
|
|
|
{onLineCountChange && (
|
|
<div className="control-group">
|
|
<label>Lines</label>
|
|
<select value={lineCount} onChange={(e) => onLineCountChange(parseInt(e.target.value, 10))}>
|
|
{lineCountOptions.map(n => (
|
|
<option key={n} value={n}>{n}</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
)}
|
|
|
|
{showPriority && onPriorityChange && (
|
|
<div className="control-group">
|
|
<label>Priority</label>
|
|
<select value={priority ?? ''} onChange={(e) => onPriorityChange(e.target.value)}>
|
|
{PRIORITY_OPTIONS.map(o => (
|
|
<option key={o.value} value={o.value}>{o.label}</option>
|
|
))}
|
|
</select>
|
|
</div>
|
|
)}
|
|
|
|
{onLoad && (
|
|
<Button onClick={onLoad} disabled={loading}>
|
|
{loading ? 'Loading...' : loadLabel}
|
|
</Button>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default JournalControls;
|