feat(N): workflow pipeline, 3D viewer, worker management, QC tests

- workflow_builder.py: fix broken stubs, add render_order_line_still_task
  (resolves step_path from DB instead of passing order_line_id as step_path)
- domains/rendering/tasks.py: add render_order_line_still_task,
  export_gltf_for_order_line_task, export_blend_for_order_line_task,
  generate_gltf_geometry_task (trimesh STL→GLB, no Blender needed)
- tasks/step_tasks.py: add generate_gltf_geometry_task for CadFile GLB export
- cad router: POST /{id}/generate-gltf-geometry endpoint (admin/PM)
- worker router: GET /celery-workers + POST /scale (docker compose subprocess)
- Dockerfile: pip install -e "[dev]" to enable pytest
- docker-compose.yml: docker socket + compose file mount on backend
- ThreeDViewer.tsx: mode toggle (geometry/production), wireframe, env presets,
  download buttons (GLB + .blend)
- CadPreview.tsx: load gltf_geometry/gltf_production/blend_production assets
  from MediaAsset table and pass URLs to ThreeDViewer
- ProductDetail.tsx: "View 3D" button → /cad/:id, "Generate GLB" button
- media router/service: cad_file_id filter on GET /api/media
- WorkerManagement.tsx: new page with worker status, queue depth, scale controls
- App.tsx + Layout.tsx: /workers route + sidebar link (admin/PM)
- tests: test_rendering_service.py, test_orders_service.py (backend)
- tests: WorkerActivity.test.tsx, WorkerManagement.test.tsx (frontend)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 22:56:53 +01:00
parent 208eb21988
commit a70cb55d01
24 changed files with 1828 additions and 448 deletions
+28 -3
View File
@@ -1,10 +1,10 @@
import { useState, useCallback, useEffect, Fragment, useMemo } from 'react'
import { useParams, Link } from 'react-router-dom'
import { useParams, Link, useNavigate } from 'react-router-dom'
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'
import { useDropzone } from 'react-dropzone'
import {
ArrowLeft, Pencil, Save, X, Box, Image,
RotateCcw, RefreshCw, Upload, ChevronDown, ChevronRight, Wand2, Download, Plus, Trash2, Filter,
RotateCcw, RefreshCw, Upload, ChevronDown, ChevronRight, Wand2, Download, Plus, Trash2, Filter, Cuboid,
} from 'lucide-react'
import { toast } from 'sonner'
import {
@@ -18,7 +18,7 @@ import { listMaterials } from '../api/materials'
import MaterialInput from '../components/shared/MaterialInput'
import MaterialWizard from '../components/MaterialWizard'
import { useAuthStore } from '../store/auth'
import { downloadStl, generateStl } from '../api/cad'
import { downloadStl, generateStl, generateGltfGeometry } from '../api/cad'
function CadStatusBadge({ status }: { status: string | null }) {
if (!status) return (
@@ -48,6 +48,7 @@ const META_FIELDS: Array<{ key: keyof Product; label: string }> = [
export default function ProductDetailPage() {
const { id } = useParams<{ id: string }>()
const navigate = useNavigate()
const qc = useQueryClient()
const user = useAuthStore((s) => s.user)
const isPrivileged = user?.role === 'admin' || user?.role === 'project_manager'
@@ -552,6 +553,30 @@ export default function ProductDetailPage() {
</button>
</>
)}
{product.cad_file_id && (
<button
className="btn-secondary text-xs"
onClick={() => navigate(`/cad/${product.cad_file_id}`)}
title="Open interactive 3D viewer"
>
<Cuboid size={12} />
View 3D
</button>
)}
{product.cad_file_id && isPrivileged && (
<button
className="btn-secondary text-xs"
onClick={() =>
generateGltfGeometry(product.cad_file_id!)
.then(() => toast.info('GLB geometry export queued'))
.catch(() => toast.error('Failed to queue GLB export'))
}
title="Export geometry-only GLB from cached STL (trimesh, no Blender). Requires STL cache."
>
<Download size={12} />
Generate GLB
</button>
)}
{product.cad_file_id && isPrivileged && (
<div className="flex flex-col gap-1 pt-1 border-t border-border-light">
<p className="text-xs text-content-muted font-medium">STL</p>