Filter the script library and show customer context across pages

This commit is contained in:
2026-11-18 09:28:11 +01:00
parent f8e5865412
commit 97ef5783c1
7 changed files with 97 additions and 22 deletions
+8 -3
View File
@@ -313,7 +313,11 @@ export function Devices({
[query, setQuery] = useState(''),
[status, setStatus] = useState(''),
[history, setHistory] = useState(false);
const [routes, setRoutes] = useState<string[]>([]);
const [trail, setTrail] = useState<{ filter: string; routes: string[] }>({ filter, routes: [] });
const routes = trail.filter === filter ? trail.routes : [];
function setRoutes(next: string[] | ((old: string[]) => string[])) {
setTrail(old => ({ filter, routes: typeof next === 'function' ? next(old.filter === filter ? old.routes : []) : next }));
}
const [customerId, assetId, agentId] = detailPath.split('/');
const target =
customerId && assetId && agentId ? { customer: customerId, asset: assetId, agent: agentId } : null;
@@ -328,6 +332,7 @@ export function Devices({
}, 200);
return () => clearTimeout(timer);
}, [search]);
useEffect(() => setTrail({ filter, routes: [] }), [filter]);
const list = useResource(
async (signal) => {
if (target) return null;
@@ -413,9 +418,9 @@ export function Devices({
/>
</label>
<label>
<span>Kunde</span>
<span>Kunde im Gerätebestand</span>
<select
aria-label="Kunde"
aria-label="Kunde im Gerätebestand"
value={filter}
onChange={(e) => {
setRoutes([]);