feat: CheckMK host link in inventory, system logs hidden by default in logbook

This commit is contained in:
Brückner
2026-06-05 09:16:08 +02:00
parent 20308b53d6
commit ea9e6c1d46
6 changed files with 53 additions and 6 deletions

View File

@ -21,6 +21,7 @@ interface LogbookProps {
export default function Logbook({ logs, devices, users, currentUser, onAddLog }: LogbookProps) {
const [searchTerm, setSearchTerm] = useState('');
const [typeFilter, setTypeFilter] = useState<string>('all');
const [showSystem, setShowSystem] = useState(false);
// Custom Maintenance Log state
const [showAddLog, setShowAddLog] = useState(false);
@ -32,6 +33,7 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }:
// Filter logs
const filteredLogs = sortedLogs.filter(log => {
if (!showSystem && log.type === 'system') return false;
const matchesSearch = log.message.toLowerCase().includes(searchTerm.toLowerCase());
const matchesType = typeFilter === 'all' || log.type === typeFilter;
return matchesSearch && matchesType;
@ -121,8 +123,8 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }:
className="w-full bg-slate-950 text-slate-101 border border-slate-800 rounded-lg pl-9 pr-4 py-1.5 text-xs focus:outline-none"
/>
</div>
<div className="flex gap-1 shrink-0 text-xs font-medium">
{['all', 'booking', 'maintenance'].map((type) => (
<div className="flex gap-1 shrink-0 text-xs font-medium flex-wrap">
{['all', 'booking', 'maintenance', 'status'].map((type) => (
<button
key={type}
onClick={() => setTypeFilter(type)}
@ -135,6 +137,17 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }:
{type === 'all' ? 'All' : getLogTypeLabel(type)}
</button>
))}
<button
onClick={() => setShowSystem(v => !v)}
className={`px-3 py-1.5 rounded-lg text-xs font-medium transition-all ${
showSystem
? 'bg-slate-700/40 border border-slate-600 text-slate-300'
: 'bg-slate-950 text-slate-600 border border-slate-850 hover:text-slate-400'
}`}
title="Show/hide automated system & CheckMK entries"
>
System
</button>
</div>
</div>