fix(logbook): 'All' filter shows every log including system entries
Drop the 'non-system' default filter; 'All' now means all log types.
This commit is contained in:
@ -20,7 +20,7 @@ interface LogbookProps {
|
|||||||
|
|
||||||
export default function Logbook({ logs, devices, users, currentUser, onAddLog }: LogbookProps) {
|
export default function Logbook({ logs, devices, users, currentUser, onAddLog }: LogbookProps) {
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
const [searchTerm, setSearchTerm] = useState('');
|
||||||
const [typeFilter, setTypeFilter] = useState<string>('non-system');
|
const [typeFilter, setTypeFilter] = useState<string>('all');
|
||||||
|
|
||||||
// Custom Maintenance Log state
|
// Custom Maintenance Log state
|
||||||
const [showAddLog, setShowAddLog] = useState(false);
|
const [showAddLog, setShowAddLog] = useState(false);
|
||||||
@ -35,7 +35,6 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }:
|
|||||||
const matchesSearch = log.message.toLowerCase().includes(searchTerm.toLowerCase());
|
const matchesSearch = log.message.toLowerCase().includes(searchTerm.toLowerCase());
|
||||||
const matchesType =
|
const matchesType =
|
||||||
typeFilter === 'all' ? true :
|
typeFilter === 'all' ? true :
|
||||||
typeFilter === 'non-system' ? log.type !== 'system' :
|
|
||||||
log.type === typeFilter;
|
log.type === typeFilter;
|
||||||
return matchesSearch && matchesType;
|
return matchesSearch && matchesType;
|
||||||
});
|
});
|
||||||
@ -126,7 +125,7 @@ export default function Logbook({ logs, devices, users, currentUser, onAddLog }:
|
|||||||
</div>
|
</div>
|
||||||
<div className="flex gap-1 shrink-0 text-xs font-medium flex-wrap">
|
<div className="flex gap-1 shrink-0 text-xs font-medium flex-wrap">
|
||||||
{[
|
{[
|
||||||
{ key: 'non-system', label: 'All' },
|
{ key: 'all', label: 'All' },
|
||||||
{ key: 'booking', label: 'Booking' },
|
{ key: 'booking', label: 'Booking' },
|
||||||
{ key: 'maintenance',label: 'Maintenance' },
|
{ key: 'maintenance',label: 'Maintenance' },
|
||||||
{ key: 'status', label: 'Status' },
|
{ key: 'status', label: 'Status' },
|
||||||
|
|||||||
Reference in New Issue
Block a user