From b0561ce7142e7b714c6d17ef1119436b1894f64c Mon Sep 17 00:00:00 2001 From: root Date: Fri, 20 Mar 2026 23:32:55 +0000 Subject: [PATCH] feat: Mandanten-Zuordnung sichtbar auf Workflow-Karten + Mandanten-Filter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Mandantenname auf allen Workflow-Karten (Grid + Liste) - Mandantenname im Dashboard bei aktuellen Workflows - Mandanten-Filter-Dropdown in der Workflow-Liste (für Admins/Techniker) - Tenant-Info im Workflow-Typ ergänzt --- frontend/src/pages/Dashboard.tsx | 4 +++ frontend/src/pages/WorkflowList.tsx | 55 +++++++++++++++++++++++------ frontend/src/types/index.ts | 1 + 3 files changed, 50 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 8ef66be..99a49ef 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -217,6 +217,10 @@ export default function Dashboard() { {wf.title}

+ {wf.tenant && ( + {wf.tenant.name} + )} + {wf.tenant && · } {wf._count?.steps ?? wf.steps?.length ?? 0} Schritte · v{wf.version}

diff --git a/frontend/src/pages/WorkflowList.tsx b/frontend/src/pages/WorkflowList.tsx index 2373c33..2ebc9b9 100644 --- a/frontend/src/pages/WorkflowList.tsx +++ b/frontend/src/pages/WorkflowList.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import { Link, useSearchParams } from 'react-router-dom'; import { + Building2, FileText, Grid3X3, List, @@ -8,8 +9,9 @@ import { Tag, } from 'lucide-react'; import toast from 'react-hot-toast'; -import { workflowsApi, categoriesApi } from '../services/api'; -import type { Category, Workflow } from '../types'; +import { workflowsApi, categoriesApi, tenantsApi } from '../services/api'; +import { useAuth } from '../hooks/useAuth'; +import type { Category, Tenant, Workflow } from '../types'; import SearchBar from '../components/SearchBar'; import StatusBadge from '../components/StatusBadge'; import Pagination from '../components/Pagination'; @@ -28,12 +30,16 @@ const statusOptions: { value: string; label: string }[] = [ export default function WorkflowList() { const [searchParams, setSearchParams] = useSearchParams(); const isTemplate = searchParams.get('template') === 'true'; + const { user } = useAuth(); + const isAdmin = user?.role === 'SYSTEM_ADMIN' || user?.role === 'TECHNICIAN'; const [workflows, setWorkflows] = useState([]); const [categories, setCategories] = useState([]); + const [tenants, setTenants] = useState([]); const [search, setSearch] = useState(''); const [statusFilter, setStatusFilter] = useState(''); const [categoryFilter, setCategoryFilter] = useState(''); + const [tenantFilter, setTenantFilter] = useState(''); const [page, setPage] = useState(1); const [totalPages, setTotalPages] = useState(1); const [loading, setLoading] = useState(true); @@ -41,11 +47,14 @@ export default function WorkflowList() { useEffect(() => { categoriesApi.list().then(setCategories).catch(() => {}); - }, []); + if (isAdmin) { + tenantsApi.list({ pageSize: 100 }).then((r) => setTenants(r.data)).catch(() => {}); + } + }, [isAdmin]); useEffect(() => { loadWorkflows(); - }, [search, statusFilter, categoryFilter, page, isTemplate]); + }, [search, statusFilter, categoryFilter, tenantFilter, page, isTemplate]); const loadWorkflows = async () => { setLoading(true); @@ -57,6 +66,7 @@ export default function WorkflowList() { status: statusFilter || undefined, categoryId: categoryFilter || undefined, isTemplate: isTemplate || undefined, + tenantId: tenantFilter || undefined, }; const res = await workflowsApi.list(params); setWorkflows(res.data); @@ -130,6 +140,23 @@ export default function WorkflowList() { ))} + {isAdmin && tenants.length > 0 && ( + + )}
+ {wf.tenant && ( +
+ + {wf.tenant.name} +
+ )} {wf.description && ( -

+

{wf.description}

)} @@ -242,11 +275,13 @@ export default function WorkflowList() {

{wf.title}

- {wf.description && ( -

- {wf.description} -

- )} +

+ {wf.tenant && ( + {wf.tenant.name} + )} + {wf.tenant && wf.description && · } + {wf.description} +

{wf.category && ( diff --git a/frontend/src/types/index.ts b/frontend/src/types/index.ts index 0f4d133..0e6392e 100644 --- a/frontend/src/types/index.ts +++ b/frontend/src/types/index.ts @@ -29,6 +29,7 @@ export interface Workflow { tags: string[]; steps?: WorkflowStep[]; _count?: { steps: number }; + tenant?: Tenant; createdBy: User; createdAt: string; updatedAt: string;