feat(N4): Restliche Module — Tasks/Kommunikation/Wiki/Reports/Agents/Tags/Search + Navigation + Dashboard-Schnittstelle (#368)
Check Cross-Plugin Imports / check (push) Has been cancelled

- Scope-Deklarationen: tasks only_mine, kommunikation conversation_ids, wiki category_ids (NEUE contracts.py), report_generator template_ids, automation agent_ids (module_key agents), tags tag_ids, unified_search entity_types dynamisch aus Provider-Registry
- Core-Beiträge: navigation default_route (Startseite) + dashboard widget_app_ids (Widget-TYP-Angebot, Layout bleibt Phase M)
- Backend-Filter (additive UND): /tasks (only_mine), /comm/conversations, /wiki/articles+/categories (Subtree), /reports/print-templates, /agents, /tags, /search GET+POST (entity_types-Schnitt), /miniapps?host=dashboard
- apply_entity_type_scope-Helper (requested ∧ scope)
- Frontend: WorkspaceSwitcher default_route-Navigation, Sidebar workspace-menu_order-Sortierung, workspaceStore moduleMenuOrder()
- Tests: 18/18 Deklarationen + 11/11 Filter (TDD), Frontend 2/2 + Store 18/18, tsc clean, Build OK
- Regression 64 passed (4 Kombi-Failures = Suite-Isolation, solo-bewiesen); Checker 0; Ruff = Vorbestand (Stash-bewiesen)
This commit is contained in:
Agent Zero
2026-09-01 23:23:15 +02:00
parent 26506a5027
commit 03dd477899
26 changed files with 1335 additions and 24 deletions
+12 -1
View File
@@ -30,6 +30,7 @@ const ICON_MAP: Record<string, React.ComponentType<{ className?: string }>> = {
import { useMenuOrder } from '@/api/users';
import { usePermission } from '@/hooks/usePermission';
import { useWorkspace } from '@/hooks/useWorkspace';
import { useWorkspaceStore } from '@/store/workspaceStore';
import { useAuthStore } from '@/store/authStore';
interface NavSingleItem {
@@ -68,6 +69,7 @@ export function Sidebar() {
const { hasPermission } = usePermission();
const user = useAuthStore((state) => state.user);
const { isModuleVisible } = useWorkspace();
const moduleMenuOrder = useWorkspaceStore(s => s.moduleMenuOrder());
// Use hasPermission directly — permissions are loaded via useUserPermissions hook
const canAccess = (perm?: string): boolean => {
@@ -136,10 +138,19 @@ export function Sidebar() {
}
return workspaceFiltered.sort((a, b) => {
// N4: workspace menu_order is the admin-defined fallback order —
// the personal savedOrder above stays the user override.
const wsOrder = moduleMenuOrder;
const aWs = wsOrder.get(a.path.replace(/^\//, '').split('/')[0]);
const bWs = wsOrder.get(b.path.replace(/^\//, '').split('/')[0]);
if (aWs !== undefined && bWs !== undefined && aWs !== bWs) return aWs - bWs;
if (aWs !== undefined && bWs === undefined) return -1;
if (aWs === undefined && bWs !== undefined) return 1;
// Fall back to order field + label (backward compatible)
if (a.order !== b.order) return a.order - b.order;
return a.label.localeCompare(b.label);
});
}, [manifests, menuOrderData, user, isModuleVisible]);
}, [manifests, menuOrderData, user, isModuleVisible, moduleMenuOrder]);
const [expandedItems, setExpandedItems] = useState<Set<string>>(new Set());
@@ -1,10 +1,12 @@
import { useState, useRef, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { useWorkspace } from '@/hooks/useWorkspace';
import { LayoutGrid, ChevronDown, Check } from 'lucide-react';
export function WorkspaceSwitcher() {
const { t } = useTranslation();
const navigate = useNavigate();
const { myWorkspaces, activeWorkspaceId, switchWorkspace, hasWorkspaces } = useWorkspace();
const [open, setOpen] = useState(false);
const ref = useRef<HTMLDivElement>(null);
@@ -23,6 +25,21 @@ export function WorkspaceSwitcher() {
const activeWs = myWorkspaces.find(w => w.id === activeWorkspaceId);
const handleSwitch = (wsId: string) => {
switchWorkspace(wsId);
setOpen(false);
// N4: navigate to the workspace default_route (admin-defined per
// workspace). The route comes from the target workspace's context —
// read via the workspace store so the fresh context applies after the
// switch (the store resolves config synchronously from myWorkspaces).
const target = myWorkspaces.find(w => w.id === wsId);
const navConfig = target?.modules?.find((m: any) => m.module_key === 'navigation');
const route = navConfig?.config?.default_route;
if (typeof route === 'string' && route.startsWith('/')) {
navigate(route);
}
};
return (
<div className="relative" ref={ref}>
<button
@@ -43,10 +60,7 @@ export function WorkspaceSwitcher() {
{myWorkspaces.map(ws => (
<button
key={ws.id}
onClick={() => {
switchWorkspace(ws.id);
setOpen(false);
}}
onClick={() => handleSwitch(ws.id)}
className="w-full flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 text-sm text-gray-700 dark:text-gray-300 transition-colors"
>
<span className="flex-1 text-left">