feat(sdk): Multi-Projekt-Architektur — mehrere Projekte pro Tenant
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 33s
CI / test-python-backend-compliance (push) Successful in 34s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 19s
Some checks failed
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Failing after 33s
CI / test-python-backend-compliance (push) Successful in 34s
CI / test-python-document-crawler (push) Successful in 23s
CI / test-python-dsms-gateway (push) Successful in 19s
Jeder Tenant kann jetzt mehrere Compliance-Projekte anlegen (z.B. verschiedene Produkte, Tochterunternehmen). CompanyProfile ist pro Projekt kopierbar und danach unabhaengig editierbar. Multi-Tab-Support via separater BroadcastChannel und localStorage Keys pro Projekt. - Migration 039: compliance_projects Tabelle, sdk_states.project_id - Backend: FastAPI CRUD-Routes fuer Projekte mit Tenant-Isolation - Frontend: ProjectSelector UI, SDKProvider mit projectId, URL ?project= - State API: UPSERT auf (tenant_id, project_id) mit Abwaertskompatibilitaet - Tests: pytest fuer Model-Validierung, Row-Konvertierung, Tenant-Isolation - Docs: MKDocs Seite, CLAUDE.md, Backend README Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
'use client'
|
||||
|
||||
import { useEffect, useState } from 'react'
|
||||
import { usePathname } from 'next/navigation'
|
||||
import { usePathname, useSearchParams } from 'next/navigation'
|
||||
import { SDKProvider } from '@/lib/sdk'
|
||||
import { SDKSidebar } from '@/components/sdk/Sidebar/SDKSidebar'
|
||||
import { CommandBar } from '@/components/sdk/CommandBar'
|
||||
@@ -36,7 +36,7 @@ const SYNC_STATUS_CONFIG = {
|
||||
} as const
|
||||
|
||||
function SDKHeader({ sidebarCollapsed }: { sidebarCollapsed: boolean }) {
|
||||
const { state, currentStep, setCommandBarOpen, completionPercentage, syncState } = useSDK()
|
||||
const { state, currentStep, setCommandBarOpen, completionPercentage, syncState, projectId } = useSDK()
|
||||
|
||||
const syncConfig = SYNC_STATUS_CONFIG[syncState.status] || SYNC_STATUS_CONFIG.idle
|
||||
|
||||
@@ -47,6 +47,14 @@ function SDKHeader({ sidebarCollapsed }: { sidebarCollapsed: boolean }) {
|
||||
<div className="flex items-center gap-3">
|
||||
<nav className="flex items-center text-sm text-gray-500">
|
||||
<span>SDK</span>
|
||||
{state.projectInfo && (
|
||||
<>
|
||||
<svg className="w-4 h-4 mx-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
<span className="text-gray-700 font-medium">{state.projectInfo.name}</span>
|
||||
</>
|
||||
)}
|
||||
<svg className="w-4 h-4 mx-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
|
||||
</svg>
|
||||
@@ -102,10 +110,19 @@ function SDKHeader({ sidebarCollapsed }: { sidebarCollapsed: boolean }) {
|
||||
|
||||
{/* Session Info Bar */}
|
||||
<div className="flex items-center gap-4 px-6 py-1.5 bg-gray-50 border-t border-gray-100 text-xs text-gray-500">
|
||||
{/* Projekt + Version */}
|
||||
{/* Projekt-Name */}
|
||||
<span className="text-gray-700 font-medium">
|
||||
{state.companyProfile?.companyName || 'Kein Projekt'}
|
||||
{state.projectInfo?.name || state.companyProfile?.companyName || 'Kein Projekt'}
|
||||
</span>
|
||||
|
||||
{/* Firmenname (falls abweichend vom Projektnamen) */}
|
||||
{state.projectInfo && state.companyProfile?.companyName && state.companyProfile.companyName !== state.projectInfo.name && (
|
||||
<>
|
||||
<span className="text-gray-300">|</span>
|
||||
<span className="text-gray-600">{state.companyProfile.companyName}</span>
|
||||
</>
|
||||
)}
|
||||
|
||||
<span className="font-mono text-gray-400">
|
||||
V{String(state.projectVersion || 1).padStart(3, '0')}
|
||||
</span>
|
||||
@@ -149,7 +166,7 @@ function SDKHeader({ sidebarCollapsed }: { sidebarCollapsed: boolean }) {
|
||||
// =============================================================================
|
||||
|
||||
function SDKInnerLayout({ children }: { children: React.ReactNode }) {
|
||||
const { isCommandBarOpen, setCommandBarOpen } = useSDK()
|
||||
const { isCommandBarOpen, setCommandBarOpen, projectId } = useSDK()
|
||||
const [sidebarCollapsed, setSidebarCollapsed] = useState(false)
|
||||
const pathname = usePathname()
|
||||
|
||||
@@ -172,16 +189,18 @@ function SDKInnerLayout({ children }: { children: React.ReactNode }) {
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
{/* Sidebar */}
|
||||
<SDKSidebar
|
||||
collapsed={sidebarCollapsed}
|
||||
onCollapsedChange={handleCollapsedChange}
|
||||
/>
|
||||
{/* Sidebar — only show when a project is selected */}
|
||||
{projectId && (
|
||||
<SDKSidebar
|
||||
collapsed={sidebarCollapsed}
|
||||
onCollapsedChange={handleCollapsedChange}
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Main Content - dynamic margin based on sidebar state */}
|
||||
<div className={`${sidebarCollapsed ? 'ml-16' : 'ml-64'} flex flex-col min-h-screen transition-all duration-300`}>
|
||||
{/* Header */}
|
||||
<SDKHeader sidebarCollapsed={sidebarCollapsed} />
|
||||
<div className={`${projectId ? (sidebarCollapsed ? 'ml-16' : 'ml-64') : ''} flex flex-col min-h-screen transition-all duration-300`}>
|
||||
{/* Header — only show when a project is selected */}
|
||||
{projectId && <SDKHeader sidebarCollapsed={sidebarCollapsed} />}
|
||||
|
||||
{/* Page Content */}
|
||||
<main className="flex-1 p-6">{children}</main>
|
||||
@@ -191,10 +210,10 @@ function SDKInnerLayout({ children }: { children: React.ReactNode }) {
|
||||
{isCommandBarOpen && <CommandBar onClose={() => setCommandBarOpen(false)} />}
|
||||
|
||||
{/* Pipeline Sidebar (FAB on mobile/tablet, fixed on desktop xl+) */}
|
||||
<SDKPipelineSidebar />
|
||||
{projectId && <SDKPipelineSidebar />}
|
||||
|
||||
{/* Compliance Advisor Widget */}
|
||||
<ComplianceAdvisorWidget currentStep={currentStep} />
|
||||
{projectId && <ComplianceAdvisorWidget currentStep={currentStep} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -208,8 +227,11 @@ export default function SDKRootLayout({
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) {
|
||||
const searchParams = useSearchParams()
|
||||
const projectId = searchParams.get('project') || undefined
|
||||
|
||||
return (
|
||||
<SDKProvider enableBackendSync={true}>
|
||||
<SDKProvider enableBackendSync={true} projectId={projectId}>
|
||||
<SDKInnerLayout>{children}</SDKInnerLayout>
|
||||
</SDKProvider>
|
||||
)
|
||||
|
||||
@@ -4,6 +4,7 @@ import React from 'react'
|
||||
import Link from 'next/link'
|
||||
import { useSDK, SDK_PACKAGES, getStepsForPackage } from '@/lib/sdk'
|
||||
import { CustomerTypeSelector } from '@/components/sdk/CustomerTypeSelector'
|
||||
import { ProjectSelector } from '@/components/sdk/ProjectSelector/ProjectSelector'
|
||||
import type { CustomerType, SDKPackageId } from '@/lib/sdk/types'
|
||||
|
||||
// =============================================================================
|
||||
@@ -42,15 +43,18 @@ function PackageCard({
|
||||
completion,
|
||||
stepsCount,
|
||||
isLocked,
|
||||
projectId,
|
||||
}: {
|
||||
pkg: (typeof SDK_PACKAGES)[number]
|
||||
completion: number
|
||||
stepsCount: number
|
||||
isLocked: boolean
|
||||
projectId?: string
|
||||
}) {
|
||||
const steps = getStepsForPackage(pkg.id)
|
||||
const firstStep = steps[0]
|
||||
const href = firstStep?.url || '/sdk'
|
||||
const baseHref = firstStep?.url || '/sdk'
|
||||
const href = projectId ? `${baseHref}?project=${projectId}` : baseHref
|
||||
|
||||
const content = (
|
||||
<div
|
||||
@@ -133,16 +137,19 @@ function QuickActionCard({
|
||||
icon,
|
||||
href,
|
||||
color,
|
||||
projectId,
|
||||
}: {
|
||||
title: string
|
||||
description: string
|
||||
icon: React.ReactNode
|
||||
href: string
|
||||
color: string
|
||||
projectId?: string
|
||||
}) {
|
||||
const finalHref = projectId ? `${href}?project=${projectId}` : href
|
||||
return (
|
||||
<Link
|
||||
href={href}
|
||||
href={finalHref}
|
||||
className="flex items-center gap-4 p-4 bg-white rounded-xl border border-gray-200 hover:border-purple-300 hover:shadow-md transition-all"
|
||||
>
|
||||
<div className={`p-3 rounded-lg ${color}`}>{icon}</div>
|
||||
@@ -162,7 +169,12 @@ function QuickActionCard({
|
||||
// =============================================================================
|
||||
|
||||
export default function SDKDashboard() {
|
||||
const { state, packageCompletion, completionPercentage, setCustomerType } = useSDK()
|
||||
const { state, packageCompletion, completionPercentage, setCustomerType, projectId } = useSDK()
|
||||
|
||||
// No project selected → show project list
|
||||
if (!projectId) {
|
||||
return <ProjectSelector />
|
||||
}
|
||||
|
||||
// Calculate total steps
|
||||
const totalSteps = SDK_PACKAGES.reduce((sum, pkg) => {
|
||||
@@ -282,7 +294,7 @@ export default function SDKDashboard() {
|
||||
Laden Sie Ihre vorhandenen Compliance-Dokumente hoch. Unsere KI analysiert sie und zeigt Ihnen, welche Erweiterungen fuer KI-Compliance erforderlich sind.
|
||||
</p>
|
||||
<Link
|
||||
href="/sdk/import"
|
||||
href={projectId ? `/sdk/import?project=${projectId}` : '/sdk/import'}
|
||||
className="inline-flex items-center gap-2 mt-4 px-4 py-2 bg-indigo-600 text-white rounded-lg hover:bg-indigo-700 transition-colors"
|
||||
>
|
||||
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
@@ -345,6 +357,7 @@ export default function SDKDashboard() {
|
||||
completion={packageCompletion[pkg.id]}
|
||||
stepsCount={visibleSteps.length}
|
||||
isLocked={isPackageLocked(pkg.id)}
|
||||
projectId={projectId}
|
||||
/>
|
||||
)
|
||||
})}
|
||||
@@ -365,6 +378,7 @@ export default function SDKDashboard() {
|
||||
}
|
||||
href="/sdk/advisory-board"
|
||||
color="bg-purple-50"
|
||||
projectId={projectId}
|
||||
/>
|
||||
<QuickActionCard
|
||||
title="Security Screening"
|
||||
@@ -376,6 +390,7 @@ export default function SDKDashboard() {
|
||||
}
|
||||
href="/sdk/screening"
|
||||
color="bg-red-50"
|
||||
projectId={projectId}
|
||||
/>
|
||||
<QuickActionCard
|
||||
title="DSFA generieren"
|
||||
@@ -387,6 +402,7 @@ export default function SDKDashboard() {
|
||||
}
|
||||
href="/sdk/dsfa"
|
||||
color="bg-blue-50"
|
||||
projectId={projectId}
|
||||
/>
|
||||
<QuickActionCard
|
||||
title="Legal RAG"
|
||||
@@ -398,6 +414,7 @@ export default function SDKDashboard() {
|
||||
}
|
||||
href="/sdk/rag"
|
||||
color="bg-green-50"
|
||||
projectId={projectId}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user