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>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user