A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat(app): update custom types
dextmorgn9d1d5c1416dd
diff --git a/flowsint-app/src/api/custom-type-service.ts b/flowsint-app/src/api/custom-type-service.tsindex c174cbdb..7b47030f 100644--- a/flowsint-app/src/api/custom-type-service.ts+++ b/flowsint-app/src/api/custom-type-service.ts@@ -8,6 +8,8 @@ export interface CustomType {status: 'draft' | 'published' | 'archived'checksum?: stringdescription?: string+ icon?: string+ color?: stringcreated_at: stringupdated_at: string}@@ -16,6 +18,8 @@ export interface CustomTypeCreate {name: stringschema: Record<string, any>description?: string+ icon?: string+ color?: stringstatus?: 'draft' | 'published'}@@ -23,6 +27,8 @@ export interface CustomTypeUpdate {name?: stringschema?: Record<string, any>description?: string+ icon?: string+ color?: stringstatus?: 'draft' | 'published' | 'archived'}diff --git a/flowsint-app/src/components/custom-types/field-row.tsx b/flowsint-app/src/components/custom-types/field-row.tsxnew file mode 100644index 00000000..76a41d98--- /dev/null+++ b/flowsint-app/src/components/custom-types/field-row.tsx@@ -0,0 +1,186 @@+import { Input } from '@/components/ui/input'+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from '@/components/ui/select'+import { Button } from '@/components/ui/button'+import { GripVertical, Trash2, ChevronRight, Asterisk } from 'lucide-react'+import { cn } from '@/lib/utils'+import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'+import { Textarea } from '@/components/ui/textarea'+import { Switch } from '@/components/ui/switch'+import { useState } from 'react'+import { Reorder, useDragControls } from 'framer-motion'++export interface SchemaField {+ id: string+ key: string+ title: string+ type: string+ format?: string+ description?: string+ required: boolean+}++const FIELD_TYPES = [+ { value: 'string', label: 'Text' },+ { value: 'number', label: 'Number' },+ { value: 'integer', label: 'Integer' },+ { value: 'boolean', label: 'Boolean' },+ { value: 'array', label: 'List' },+ { value: 'object', label: 'Object' }+] as const++const FIELD_FORMATS = [+ { value: 'none', label: 'None' },+ { value: 'email', label: 'Email' },+ { value: 'uri', label: 'URL' },+ { value: 'date', label: 'Date' },+ { value: 'date-time', label: 'Date & Time' },+ { value: 'ipv4', label: 'IPv4' },+ { value: 'ipv6', label: 'IPv6' }+] as const++interface FieldRowProps {+ field: SchemaField+ onUpdate: (updates: Partial<SchemaField>) => void+ onDelete: () => void+}++export function FieldRow({ field, onUpdate, onDelete }: FieldRowProps) {+ const [expanded, setExpanded] = useState(false)+ const dragControls = useDragControls()++ return (+ <Reorder.Item+ value={field}+ dragListener={false}+ dragControls={dragControls}+ className="list-none"+ // whileDrag={{ scsale: 1.01, boxShadow: '0 4px 16px rgba(0,0,0,0.08)', zIndex: 50 }}+ transition={{ duration: 0.15 }}+ >+ <Collapsible open={expanded} onOpenChange={setExpanded}>+ <div+ className={cn(+ 'group rounded-lg border bg-background relative',+ field.required && 'border-primary/20 bg-primary/3'+ )}+ >+ {field.required && (+ <div className="absolute -top-2 -left-2 rounded-full border border-primary/50 bg-card">+ <Asterisk className="h-4 w-4 text-primary" />+ </div>+ )}+ <div className="flex items-center gap-2 px-2 py-1.5">+ <div className="flex items-center gap-1 shrink-0">+ <button+ className="touch-none p-0.5 rounded hover:bg-muted transition-colors cursor-grab active:cursor-grabbing"+ onPointerDown={(e) => dragControls.start(e)}+ >+ <GripVertical className="h-3.5 w-3.5 text-muted-foreground/40 group-hover:text-muted-foreground/70 transition-colors" />+ </button>+ <CollapsibleTrigger asChild>+ <button className="p-1 rounded hover:bg-muted transition-colors">+ <ChevronRight+ className={cn(+ 'h-3.5 w-3.5 text-muted-foreground transition-transform',+ expanded && 'rotate-90'+ )}+ />+ </button>+ </CollapsibleTrigger>+ </div>++ <div className="flex-1 grid grid-cols-[1fr_1fr_120px_120px] gap-2 items-center">+ <Input+ value={field.key}+ onChange={(e) =>+ onUpdate({ key: e.target.value.toLowerCase().replace(/\s+/g, '_') })+ }+ placeholder="field_key"+ className="h-8 text-sm border-transparent bg-transparent hover:border-border focus:border-border focus:bg-background transition-colors"+ />+ <Input+ value={field.title}+ onChange={(e) => onUpdate({ title: e.target.value })}+ placeholder="Display name"+ className="h-8 text-sm border-transparent bg-transparent hover:border-border focus:border-border focus:bg-background transition-colors"+ />+ <Select value={field.type} onValueChange={(v: string) => onUpdate({ type: v })}>+ <SelectTrigger className="h-8 text-sm border-transparent bg-transparent hover:border-border transition-colors">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {FIELD_TYPES.map((t) => (+ <SelectItem key={t.value} value={t.value}>+ {t.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ <Select+ value={field.format || 'none'}+ onValueChange={(v: string) => onUpdate({ format: v === 'none' ? undefined : v })}+ >+ <SelectTrigger className="h-8 text-sm border-transparent bg-transparent hover:border-border transition-colors">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {FIELD_FORMATS.map((f) => (+ <SelectItem key={f.value} value={f.value}>+ {f.label}+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div>++ <div className="flex items-center gap-1 shrink-0">+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive"+ onClick={onDelete}+ >+ <Trash2 className="h-3.5 w-3.5" />+ </Button>+ </div>+ </div>++ {/* Expanded details */}+ <CollapsibleContent>+ <div className="px-10 pb-3 space-y-3">+ <div className="grid grid-cols-2 gap-4">+ <div className="space-y-1.5">+ <label className="text-xs font-medium text-muted-foreground">Description</label>+ <Textarea+ value={field.description || ''}+ onChange={(e) => onUpdate({ description: e.target.value })}+ placeholder="Describe what this field is for..."+ rows={2}+ className="text-sm resize-none"+ />+ </div>+ <div className="space-y-3">+ <div className="flex items-center justify-between">+ <label className="text-xs font-medium text-muted-foreground">+ Required field+ </label>+ <Switch+ checked={field.required}+ onCheckedChange={(checked: boolean) => onUpdate({ required: checked })}+ />+ </div>+ </div>+ </div>+ </div>+ </CollapsibleContent>+ </div>+ </Collapsible>+ </Reorder.Item>+ )+}diff --git a/flowsint-app/src/components/custom-types/icon-picker-trigger.tsx b/flowsint-app/src/components/custom-types/icon-picker-trigger.tsxnew file mode 100644index 00000000..b3327404--- /dev/null+++ b/flowsint-app/src/components/custom-types/icon-picker-trigger.tsx@@ -0,0 +1,50 @@+import { useState } from 'react'+import * as LucideIcons from 'lucide-react'+import { cn } from '@/lib/utils'+import IconPicker from '@/components/shared/icon-picker/popup'++interface IconPickerTriggerProps {+ icon: string+ color: string+ onIconChange: (icon: string) => void+}++export function IconPickerTrigger({ icon, color, onIconChange }: IconPickerTriggerProps) {+ const [open, setOpen] = useState(false)++ const Icon = (LucideIcons as any)[icon] || LucideIcons.FileQuestion++ return (+ <>+ <button+ onClick={() => setOpen(true)}+ className={cn(+ 'group relative flex items-center justify-center rounded-full transition-all',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'+ )}+ style={{+ backgroundColor: color,+ width: 52,+ height: 52+ }}+ >+ <Icon className="text-white" size={26} />+ <div+ className={cn(+ 'absolute inset-0 rounded-xl bg-black/0 transition-colors',+ 'group-hover:bg-black/10'+ )}+ />+ </button>++ <IconPicker+ iconType={null}+ open={open}+ setOpen={setOpen}+ onIconChange={(_type, iconName) => {+ onIconChange(iconName as string)+ }}+ />+ </>+ )+}diff --git a/flowsint-app/src/components/custom-types/type-preview.tsx b/flowsint-app/src/components/custom-types/type-preview.tsxnew file mode 100644index 00000000..5116d1f6--- /dev/null+++ b/flowsint-app/src/components/custom-types/type-preview.tsx@@ -0,0 +1,111 @@+import * as LucideIcons from 'lucide-react'+import { Badge } from '@/components/ui/badge'+import type { SchemaField } from './field-row'++interface TypePreviewProps {+ name: string+ description: string+ icon: string+ color: string+ fields: SchemaField[]+ status: 'draft' | 'published'+}++export function TypePreview({ name, description, icon, color, fields, status }: TypePreviewProps) {+ const Icon = (LucideIcons as any)[icon] || LucideIcons.FileQuestion+ const validFields = fields.filter((f) => f.key.trim())++ return (+ <div className="space-y-6">+ {/* Entity card preview */}+ <div>+ <p className="text-xs font-medium text-muted-foreground mb-3">Entity card</p>+ <div className="border border-border/60 rounded-xl p-5 bg-card max-w-sm">+ <div className="flex items-start gap-3.5">+ <div+ className="rounded-full flex items-center justify-center shrink-0"+ style={{ backgroundColor: color, width: 44, height: 44 }}+ >+ <Icon className="text-white" size={22} />+ </div>+ <div className="min-w-0 flex-1">+ <div className="flex items-center gap-2">+ <h4 className="font-semibold text-sm truncate">{name || 'Untitled type'}</h4>+ </div>+ <p className="text-xs text-muted-foreground mt-0.5 line-clamp-2">+ {description || 'No description'}+ </p>+ </div>+ </div>++ {validFields.length > 0 && (+ <div className="mt-4 pt-3 border-t border-border/40 space-y-2">+ {validFields.slice(0, 4).map((field) => (+ <div key={field.id} className="flex items-center justify-between">+ <span className="text-xs text-muted-foreground">{field.title || field.key}</span>+ <span className="text-xs text-muted-foreground/60 font-mono">+ {field.type}+ {field.format && field.format !== 'none' ? `:${field.format}` : ''}+ </span>+ </div>+ ))}+ {validFields.length > 4 && (+ <p className="text-[10px] text-muted-foreground/50">+ +{validFields.length - 4} more fields+ </p>+ )}+ </div>+ )}+ </div>+ </div>++ {/* Graph node preview */}+ <div>+ <p className="text-xs font-medium text-muted-foreground mb-3">Graph node</p>+ <div className="flex items-center gap-3 p-4 border border-border/60 rounded-xl bg-card max-w-[200px]">+ <div+ className="rounded-full flex items-center justify-center shrink-0"+ style={{ backgroundColor: color, width: 36, height: 36 }}+ >+ <Icon className="text-white" size={18} />+ </div>+ <div className="min-w-0">+ <p className="text-xs font-medium truncate">{name || 'Untitled'}</p>+ <p className="text-[10px] text-muted-foreground">+ {validFields.length} field{validFields.length !== 1 ? 's' : ''}+ </p>+ </div>+ </div>+ </div>++ {/* Schema preview */}+ <div>+ <p className="text-xs font-medium text-muted-foreground mb-3">JSON Schema</p>+ <pre className="p-4 bg-muted/50 rounded-lg text-xs font-mono overflow-x-auto text-muted-foreground leading-relaxed">+ {JSON.stringify(buildSchema(name, fields), null, 2)}+ </pre>+ </div>+ </div>+ )+}++function buildSchema(name: string, fields: SchemaField[]) {+ const properties: Record<string, any> = {}+ const required: string[] = []++ fields.forEach((field) => {+ if (!field.key.trim()) return+ const prop: any = { type: field.type, title: field.title || field.key }+ if (field.description) prop.description = field.description+ if (field.format && field.format !== 'none') prop.format = field.format+ properties[field.key] = prop+ if (field.required) required.push(field.key)+ })++ return {+ title: name || 'MyCustomType',+ type: 'object',+ properties,+ required+ }+}diff --git a/flowsint-app/src/components/flows/controls.tsx b/flowsint-app/src/components/flows/controls.tsxindex 76e700a6..36a97b0c 100644--- a/flowsint-app/src/components/flows/controls.tsx+++ b/flowsint-app/src/components/flows/controls.tsx@@ -70,7 +70,13 @@ export function FlowControls({<Tooltip><TooltipTrigger asChild>- <Button variant="outline" size="icon" className="bg-card" onClick={onLayout} data-tour-id="layout-button">+ <Button+ variant="outline"+ size="icon"+ className="bg-card"+ onClick={onLayout}+ data-tour-id="layout-button"+ ><LayoutGrid className="h-4 w-4" /></Button></TooltipTrigger>diff --git a/flowsint-app/src/components/flows/editor.tsx b/flowsint-app/src/components/flows/editor.tsxindex f808b5f7..5c953ebc 100644--- a/flowsint-app/src/components/flows/editor.tsx+++ b/flowsint-app/src/components/flows/editor.tsx@@ -95,7 +95,6 @@ const FlowEditor = memo(({ initialEdges, initialNodes, theme, flow }: FlowEditorconst setLoading = useFlowStore((state) => state.setLoading)const colors = useNodesDisplaySettings((s) => s.colors)- // #### TanStack Query Mutations ####// Create flow mutationconst createFlowMutation = useMutation({mutationFn: flowService.create,@@ -254,7 +253,7 @@ const FlowEditor = memo(({ initialEdges, initialNodes, theme, flow }: FlowEditor})const newNode: FlowNode = {id: `${enricherData.name}-${Date.now()}`,- type: enricherData.type === 'type' ? 'type' : 'request',+ type: enricherData.type === 'type' ? 'type' : 'enricher',position,data: {id: enricherData.id,diff --git a/flowsint-app/src/components/flows/flow-sheet.tsx b/flowsint-app/src/components/flows/flow-sheet.tsxindex 409f4165..bba19f77 100644--- a/flowsint-app/src/components/flows/flow-sheet.tsx+++ b/flowsint-app/src/components/flows/flow-sheet.tsx@@ -61,7 +61,7 @@ const FlowSheet = ({ onLayout }: { onLayout: () => void }) => {const position = { x: selectedNode.position.x + 350, y: selectedNode.position.y }const newNode: FlowNode = {id: `${enricher.name}-${Date.now()}`,- type: enricher.type === 'type' ? 'type' : 'request',+ type: enricher.type === 'type' ? 'type' : 'enricher',position,data: {id: enricher.id,diff --git a/flowsint-app/src/components/flows/raw-material.tsx b/flowsint-app/src/components/flows/raw-material.tsxindex f37243b2..c0737b55 100644--- a/flowsint-app/src/components/flows/raw-material.tsx+++ b/flowsint-app/src/components/flows/raw-material.tsx@@ -19,6 +19,8 @@ export default function RawMaterial() {})const [searchTerm, setSearchTerm] = useState<string>('')+ console.log(materials)+const filteredEnrichers = useMemo(() => {if (!materials?.items) return {}const result: Record<string, Enricher[]> = {}@@ -58,7 +60,7 @@ export default function RawMaterial() {<Inputtype="text"placeholder="Search enrichers..."- className="pl-8 !border border-border"+ className="pl-8 border! border-border"value={searchTerm}onChange={(e) => setSearchTerm(e.target.value)}/>diff --git a/flowsint-app/src/components/layout/sidebar.tsx b/flowsint-app/src/components/layout/sidebar.tsxindex e1ddea51..0c969040 100644--- a/flowsint-app/src/components/layout/sidebar.tsx+++ b/flowsint-app/src/components/layout/sidebar.tsx@@ -6,6 +6,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../ui/import { memo } from 'react'import { isMac } from '@/lib/utils'import { NavUser } from '../nav-user'+import { CONFIG } from '@/config'interface NavItem {icon: LucideIcon@@ -18,12 +19,14 @@ export const Sidebar = memo(() => {const navItems: NavItem[] = [{ icon: Home, label: 'Dashboard', href: '/dashboard/' },- // { icon: Puzzle, label: 'Enrichers', href: '/dashboard/enrichers' },{ icon: Workflow, label: 'Flows', href: '/dashboard/flows' },{ icon: Shapes, label: 'Custom types', href: '/dashboard/custom-types' },{ icon: Lock, label: 'Vault', href: '/dashboard/vault' }]+ if (CONFIG.ENRICHER_TEMPLATES_FEATURE_FLAG)+ navItems.push({ icon: Puzzle, label: 'Enrichers', href: '/dashboard/enrichers' })+const commonClasses = 'flex items-center justify-center h-12 w-full rounded-sm hover:bg-muted'return (diff --git a/flowsint-app/src/components/map/map.tsx b/flowsint-app/src/components/map/map.tsxindex 9ced8113..27449826 100644--- a/flowsint-app/src/components/map/map.tsx+++ b/flowsint-app/src/components/map/map.tsx@@ -207,22 +207,24 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({const geocodeQuery = useQuery({queryKey: ['geocode', locationsToGeocode.map((loc) => loc.address)],queryFn: async () => {- const results: ({ lat: number; lon: number } | null)[] = []- for (const location of locationsToGeocode) {- if (!location.address) continue- const res = await fetch(- `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(location.address)}`- )- const json = await res.json()- if (!json || json.length === 0) {- results.push(null)- } else {- results.push({- lat: parseFloat(json[0].lat),- lon: parseFloat(json[0].lon)- })- }- }+ const results = await Promise.all(+ locationsToGeocode.map(async (location) => {+ if (!location.address) return null+ try {+ const res = await fetch(+ `https://nominatim.openstreetmap.org/search?format=json&q=${encodeURIComponent(location.address)}`+ )+ const json = await res.json()+ if (!json || json.length === 0) return null+ return {+ lat: parseFloat(json[0].lat),+ lon: parseFloat(json[0].lon)+ }+ } catch {+ return null+ }+ })+ )return results},enabled: locationsToGeocode.length > 0@@ -433,6 +435,22 @@ export const MapFromAddress: React.FC<MapFromAddressProps> = ({registerMapImages()applyProjection()})+ // Handle missing images on-demand to avoid race conditions+ map.on('styleimagemissing', async (e: { id: string }) => {+ const id = e.id+ if (id === 'pulsing-dot' || map.hasImage(id)) return+ const match = id.match(/^marker-icon-(.+)$/)+ if (!match) return+ const nodeType = match[1]+ try {+ const img = await preloadImage(nodeType, '#ffffff')+ if (!map.hasImage(id)) {+ map.addImage(id, img, { sdf: false })+ }+ } catch {+ // Icon not available, ignore silently+ }+ })}, [registerMapImages, applyProjection])// Wire up zoom actions to the shared toolbar controlsdiff --git a/flowsint-app/src/components/shared/color-picker.tsx b/flowsint-app/src/components/shared/color-picker.tsxnew file mode 100644index 00000000..7b2d872a--- /dev/null+++ b/flowsint-app/src/components/shared/color-picker.tsx@@ -0,0 +1,130 @@+import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover'+import { cn } from '@/lib/utils'+import { useState, useEffect } from 'react'+import { Input } from '@/components/ui/input'+import { Check } from 'lucide-react'++const PRESET_COLORS = [+ // Row 1 - Muted naturals+ '#9B8E7E',+ '#A89F91',+ '#8E9E8C',+ '#7E9BA3',+ '#8A8DA3',+ '#9E8A9E',+ '#A3908A',+ '#8C9696',+ '#A39882',+ '#7E8F9E',+ // Row 2 - Soft pastels+ '#66A892',+ '#8E7CC3',+ '#5AA1C8',+ '#4CB5AE',+ '#8B83C1',+ '#BCA18A',+ '#4C8EDA',+ '#A76DAA',+ '#D97474',+ '#80BF80',+ // Row 3 - Warm tones+ '#D4B030',+ '#E3A857',+ '#CC7A7A',+ '#D279A6',+ '#E98973',+ '#C7BF50',+ '#A8BF50',+ '#6FA8DC',+ '#7C9CBF',+ '#897FC9'+]++interface ColorPickerProps {+ value: string+ onChange: (color: string) => void+ /** Size of the trigger swatch */+ triggerSize?: 'sm' | 'md'+ /** Popover alignment */+ align?: 'start' | 'center' | 'end'+}++export function ColorPicker({+ value,+ onChange,+ triggerSize = 'md',+ align = 'start'+}: ColorPickerProps) {+ const [open, setOpen] = useState(false)+ const [customColor, setCustomColor] = useState(value)++ useEffect(() => {+ setCustomColor(value)+ }, [value])++ const handleCustomColorChange = (hex: string) => {+ setCustomColor(hex)+ if (/^#[0-9A-Fa-f]{6}$/.test(hex)) {+ onChange(hex)+ }+ }++ const sizeClasses = triggerSize === 'sm' ? 'h-6 w-6 rounded-md' : 'h-8 w-8 rounded-lg'++ return (+ <Popover open={open} onOpenChange={setOpen} modal>+ <PopoverTrigger asChild>+ <button+ className={cn(+ sizeClasses,+ 'border border-border/50 transition-colors',+ 'hover:border-border',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring'+ )}+ style={{ backgroundColor: value }}+ />+ </PopoverTrigger>+ <PopoverContent className="w-[280px] p-3" align={align}>+ <div className="space-y-3">+ <p className="text-xs font-medium text-muted-foreground">Color</p>+ <div className="grid grid-cols-10 gap-1.5">+ {PRESET_COLORS.map((color) => (+ <button+ key={color}+ className={cn(+ 'h-6 w-6 rounded-md transition-colors',+ 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',+ value === color && 'ring-2 ring-foreground ring-offset-2 ring-offset-background'+ )}+ style={{ backgroundColor: color }}+ onClick={() => {+ onChange(color)+ setCustomColor(color)+ }}+ >+ {value === color && <Check className="h-3 w-3 text-white mx-auto" />}+ </button>+ ))}+ </div>+ <div className="flex items-center gap-2">+ <input+ type="color"+ value={customColor}+ onChange={(e) => {+ setCustomColor(e.target.value)+ onChange(e.target.value)+ }}+ className="h-8 w-8 rounded-md border border-border/50 shrink-0 cursor-pointer bg-transparent p-0.5"+ />+ <Input+ value={customColor}+ onChange={(e) => handleCustomColorChange(e.target.value)}+ placeholder="#000000"+ className="h-8 text-xs font-mono"+ />+ </div>+ </div>+ </PopoverContent>+ </Popover>+ )+}diff --git a/flowsint-app/src/components/sketches/add-item-dialog.tsx b/flowsint-app/src/components/sketches/add-item-dialog.tsxindex 0330468e..a157ad22 100644--- a/flowsint-app/src/components/sketches/add-item-dialog.tsx+++ b/flowsint-app/src/components/sketches/add-item-dialog.tsx@@ -1,7 +1,7 @@import { useState, useCallback } from 'react'import { v4 as uuidv4 } from 'uuid'import { Button } from '@/components/ui/button'-import { ArrowLeft, ArrowRight, Upload } from 'lucide-react'+import { ArrowLeft, ArrowRight, Download, Upload } from 'lucide-react'import { toast } from 'sonner'import { cn, flattenObj } from '@/lib/utils'import { Dialog, DialogContent, DialogDescription, DialogTitle } from '@/components/ui/dialog'@@ -247,9 +247,14 @@ export default function AddItemDialog() {)}</div><div className="pt-6">- <Button size="sm" onClick={handleImportData} className="flex items-center gap-2">- <Upload className="h-4 w-4" />- Import+ <Button+ variant="outline"+ size="sm"+ onClick={handleImportData}+ className="flex items-center gap-2 rounded"+ >+ <Download className="h-4 w-4" />+ Import entities</Button></div></DialogTitle>@@ -307,7 +312,7 @@ interface ActionCardProps {}function ActionCard({ item, onSelect }: ActionCardProps) {- const IconComponent = useIcon(item.icon)+ const IconComponent = useIcon(item.icon, { nodeIcon: item.icon, nodeColor: item.color })return (<Carddiff --git a/flowsint-app/src/components/sketches/details-panel/details-panel.tsx b/flowsint-app/src/components/sketches/details-panel/details-panel.tsxindex 758e7053..46a3d1be 100644--- a/flowsint-app/src/components/sketches/details-panel/details-panel.tsx+++ b/flowsint-app/src/components/sketches/details-panel/details-panel.tsx@@ -136,7 +136,6 @@ const DetailsPanel = memo(() => {const node = useGraphStore((s) => s.getCurrentNode())const setCurrentNodeId = useGraphStore((s) => s.setCurrentNodeId)const updateNode = useGraphStore((s) => s.updateNode)- console.log(node)const [openIconPicker, setOpenIconPicker] = useState(false)const [isSaving, setIsSaving] = useState(false)const [hasChanges, setHasChanges] = useState(false)@@ -320,7 +319,7 @@ const DetailsPanel = memo(() => {<TooltipTrigger asChild><div><LaunchFlow values={[node.id]} type={node.nodeType}>- <Button className="rounded-xl h-7" size={'sm'}>+ <Button className="rounded-full h-7" size={'sm'}>Enrich <Rocket className="h-4 w-4 opacity-70" strokeWidth={1.7} /></Button></LaunchFlow>diff --git a/flowsint-app/src/components/sketches/draggable-item.tsx b/flowsint-app/src/components/sketches/draggable-item.tsxindex 7f791830..a43eba7b 100644--- a/flowsint-app/src/components/sketches/draggable-item.tsx+++ b/flowsint-app/src/components/sketches/draggable-item.tsx@@ -32,7 +32,7 @@ export const DraggableItem = memo(function DraggableItem({const colors = useNodesDisplaySettings((s) => s.colors)// @ts-ignoreconst colorStr = colors[icon as string] || color- const IconComponent = useIcon(icon)+ const IconComponent = useIcon(icon, { nodeIcon: icon, nodeColor: color })const handleDragStart = (e: React.DragEvent<HTMLButtonElement>) => {const itemData = JSON.stringify({ label, type, color, description, itemKey })diff --git a/flowsint-app/src/components/sketches/graph/node/actions/node-actions.tsx b/flowsint-app/src/components/sketches/graph/node/actions/node-actions.tsxindex b2331e1d..68499df9 100644--- a/flowsint-app/src/components/sketches/graph/node/actions/node-actions.tsx+++ b/flowsint-app/src/components/sketches/graph/node/actions/node-actions.tsx@@ -109,7 +109,7 @@ const NodeActions = memo(return (<DropdownMenu><DropdownMenuTrigger asChild>- <Button variant="ghost" size="icon" className="h-6 w-6 opacity-70">+ <Button variant="ghost" size="icon" className="h-6 w-6"><MoreHorizontal className="h-3.5 w-3.5" /></Button></DropdownMenuTrigger>@@ -126,12 +126,7 @@ const NodeActions = memo()}<DropdownMenuSub><DropdownMenuSubTrigger>- <Flag- className={cn(- 'h-3.5 w-3.5 mr-2',- flagValue ? flagColors[flagValue] : ''- )}- />+ <Flag className={cn('h-3.5 w-3.5 mr-2', flagValue ? flagColors[flagValue] : '')} />Flag</DropdownMenuSubTrigger><DropdownMenuSubContent>diff --git a/flowsint-app/src/components/sketches/graph/panels/items-panel.tsx b/flowsint-app/src/components/sketches/graph/panels/items-panel.tsxindex 5641aab0..10997008 100644--- a/flowsint-app/src/components/sketches/graph/panels/items-panel.tsx+++ b/flowsint-app/src/components/sketches/graph/panels/items-panel.tsx@@ -63,7 +63,7 @@ export const ItemsPanel = memo(function LeftPanel() {<div><ButtononClick={handleOpenNewAddItemDialog}- className="h-7 !w-7"+ className="h-7 w-7!"size="icon"variant={'ghost'}>@@ -81,8 +81,10 @@ export const ItemsPanel = memo(function LeftPanel() {/></div></div>- <div className='my-1'>- <Button onClick={handleOpenImportModal} className="w-full shadow-none" variant={"outline"}><Download /> Import entities</Button>+ <div className="my-1">+ <Button onClick={handleOpenImportModal} className="w-full shadow-none" variant={'outline'}>+ <Download /> Import entities+ </Button></div><div className="flex flex-col gap-3">{isLoading ? (diff --git a/flowsint-app/src/components/sketches/graph/utils/constants.ts b/flowsint-app/src/components/sketches/graph/utils/constants.tsindex 66ef584f..375192b4 100644--- a/flowsint-app/src/components/sketches/graph/utils/constants.ts+++ b/flowsint-app/src/components/sketches/graph/utils/constants.ts@@ -34,7 +34,7 @@ export const CONSTANTS = {MIN_ZOOM: 0.1,MAX_ZOOM: 12,ZOOM_NODE_DETAIL_THRESHOLD: 2,- ZOOM_EDGE_DETAIL_THRESHOLD: 1,+ ZOOM_EDGE_DETAIL_THRESHOLD: 0.4,ZOOMED_OUT_SIZE_MULTIPLIER: 2.5}diff --git a/flowsint-app/src/components/sketches/settings/settings.tsx b/flowsint-app/src/components/sketches/settings/settings.tsxindex 5b80ecf8..51ebb568 100644--- a/flowsint-app/src/components/sketches/settings/settings.tsx+++ b/flowsint-app/src/components/sketches/settings/settings.tsx@@ -33,6 +33,7 @@ import { queryKeys } from '@/api/query-keys'import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'import { useNodesDisplaySettings, ITEM_TYPES, ItemType } from '@/stores/node-display-settings'import IconPicker, { NodeIconTrigger } from '@/components/shared/icon-picker'+import { ColorPicker } from '@/components/shared/color-picker'// SettingItem Componentsinterface SettingItemProps {@@ -165,21 +166,7 @@ function DynamicSetting({ categoryId, settingKey, setting, onValueChange }: Dynacase 'color':return (<SettingItem label={displayName} description={setting.description} inline={true}>- <div className="flex items-center space-x-2">- <Input- type="color"- value={setting.value}- onChange={(e) => onValueChange(e.target.value)}- className="h-9 w-12 p-1"- />- <Input- type="text"- value={setting.value}- onChange={(e) => onValueChange(e.target.value)}- placeholder="#000000"- className="h-9 w-24"- />- </div>+ <ColorPicker value={setting.value} onChange={onValueChange} align="end" /></SettingItem>)@@ -318,21 +305,12 @@ function NodeColorsSection() {{itemType.replace(/_/g, ' ')}</Label></div>- <div className="flex items-center gap-2">- <Input- type="color"- value={localColors[itemType]}- onChange={(e) => handleColorChange(itemType, e.target.value)}- className="h-9 w-12 p-1 cursor-pointer"- />- <Input- type="text"- value={localColors[itemType]}- onChange={(e) => handleColorChange(itemType, e.target.value)}- placeholder="#000000"- className="h-9 w-24 font-mono text-xs"- />- </div>+ <ColorPicker+ value={localColors[itemType]}+ onChange={(color) => handleColorChange(itemType, color)}+ triggerSize="sm"+ align="end"+ /></div>))}</div>diff --git a/flowsint-app/src/components/terminal/log-formatter.ts b/flowsint-app/src/components/terminal/log-formatter.tsindex c90e38ec..e6c5e82e 100644--- a/flowsint-app/src/components/terminal/log-formatter.ts+++ b/flowsint-app/src/components/terminal/log-formatter.ts@@ -24,7 +24,7 @@ export const ANSI = {BRIGHT_BLUE: '\x1b[94m',BRIGHT_MAGENTA: '\x1b[95m',BRIGHT_CYAN: '\x1b[96m',- BRIGHT_WHITE: '\x1b[97m',+ BRIGHT_WHITE: '\x1b[97m'}// Log level configuration with ANSI colors@@ -91,11 +91,7 @@ export const formatTime = (date: string): string => {})}-export const formatLogEntry = (- timestamp: string,- level: EventLevel,- message: string-): string => {+export const formatLogEntry = (timestamp: string, level: EventLevel, message: string): string => {const config = logLevelColors[level] || defaultColorsconst time = formatTime(timestamp)@@ -113,9 +109,9 @@ export const clearScreen = (): string => {export const formatWelcomeMessage = (): string => {return (- `${ANSI.BRIGHT_CYAN}${ANSI.BOLD}╭───────────────────────────────────────────╮${ANSI.RESET}\r\n` +- `${ANSI.BRIGHT_CYAN}${ANSI.BOLD}│${ANSI.RESET} ${ANSI.BRIGHT_WHITE}⚡ Flowsint enrichers terminal${ANSI.RESET} ${ANSI.BRIGHT_CYAN}${ANSI.BOLD}│${ANSI.RESET}\r\n` +- `${ANSI.BRIGHT_CYAN}${ANSI.BOLD}╰───────────────────────────────────────────╯${ANSI.RESET}\r\n` ++ `${ANSI.BRIGHT_RED}${ANSI.BOLD}╭───────────────────────────────────────────╮${ANSI.RESET}\r\n` ++ `${ANSI.BRIGHT_RED}${ANSI.BOLD}│${ANSI.RESET} ${ANSI.BRIGHT_WHITE}⚡ Flowsint enrichers terminal${ANSI.RESET} ${ANSI.BRIGHT_RED}${ANSI.BOLD}│${ANSI.RESET}\r\n` ++ `${ANSI.BRIGHT_RED}${ANSI.BOLD}╰───────────────────────────────────────────╯${ANSI.RESET}\r\n` +`${ANSI.DIM}Waiting for investigation activity...${ANSI.RESET}\r\n\r\n`)}diff --git a/flowsint-app/src/components/ui/badge.tsx b/flowsint-app/src/components/ui/badge.tsxindex c6e06f87..91f554eb 100644--- a/flowsint-app/src/components/ui/badge.tsx+++ b/flowsint-app/src/components/ui/badge.tsx@@ -9,7 +9,8 @@ const badgeVariants = cva({variants: {variant: {- default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',+ default:+ 'border-transparent dark:bg-primary/40 bg-primary/80 border-primary text-white [a&]:hover:bg-primary/90',secondary:'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',destructive:diff --git a/flowsint-app/src/components/ui/textarea.tsx b/flowsint-app/src/components/ui/textarea.tsxindex 6b1ef4b6..5d841174 100644--- a/flowsint-app/src/components/ui/textarea.tsx+++ b/flowsint-app/src/components/ui/textarea.tsx@@ -7,7 +7,7 @@ function Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {<textareadata-slot="textarea"className={cn(- 'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',+ 'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',className)}{...props}diff --git a/flowsint-app/src/config.ts b/flowsint-app/src/config.tsnew file mode 100644index 00000000..f5735e85--- /dev/null+++ b/flowsint-app/src/config.ts@@ -0,0 +1,3 @@+export const CONFIG = {+ ENRICHER_TEMPLATES_FEATURE_FLAG: true+}diff --git a/flowsint-app/src/hooks/use-icon.tsx b/flowsint-app/src/hooks/use-icon.tsxindex 74440028..d8e2ec82 100644--- a/flowsint-app/src/hooks/use-icon.tsx+++ b/flowsint-app/src/hooks/use-icon.tsx@@ -7,7 +7,7 @@ export type IconType = stringexport type UseIconOptions = {nodeColor?: string | null- nodeIcon?: keyof typeof LucideIcons | null+ nodeIcon?: string | nullnodeImage?: string | null}@@ -33,8 +33,12 @@ export const useIcon = (type: IconType, options?: UseIconOptions) => {const colors = useNodesDisplaySettings((s) => s.colors)const customIcons = useNodesDisplaySettings((s) => s.customIcons)- // Priority: nodeIcon -> customIcons[type] -> TYPE_TO_ICON[type] -> default- const iconName = nodeIcon || customIcons[type] || TYPE_TO_ICON[type] || TYPE_TO_ICON.default+ // Priority: nodeIcon (if valid Lucide) -> customIcons[type] -> TYPE_TO_ICON[type] -> default+ const iconName =+ (nodeIcon && nodeIcon in LucideIcons ? nodeIcon : null) ||+ customIcons[type] ||+ TYPE_TO_ICON[type] ||+ TYPE_TO_ICON.defaultreturn useCallback(({diff --git a/flowsint-app/src/routeTree.gen.ts b/flowsint-app/src/routeTree.gen.tsindex 3ce0c82e..8b1fa422 100644--- a/flowsint-app/src/routeTree.gen.ts+++ b/flowsint-app/src/routeTree.gen.ts@@ -24,7 +24,7 @@ import { Route as AuthDashboardCustomTypesIndexRouteImport } from './routes/_autimport { Route as AuthDashboardFlowsFlowIdRouteImport } from './routes/_auth.dashboard.flows.$flowId'import { Route as AuthDashboardEnrichersNewRouteImport } from './routes/_auth.dashboard.enrichers.new'import { Route as AuthDashboardEnrichersEnricherIdRouteImport } from './routes/_auth.dashboard.enrichers.$enricherId'-import { Route as AuthDashboardCustomTypesIdRouteImport } from './routes/_auth.dashboard.custom-types.$id'+import { Route as AuthDashboardCustomTypesTypeIdRouteImport } from './routes/_auth.dashboard.custom-types.$typeId'import { Route as AuthDashboardInvestigationsInvestigationIdIndexRouteImport } from './routes/_auth.dashboard.investigations.$investigationId.index'import { Route as AuthDashboardInvestigationsInvestigationIdTypeIdRouteImport } from './routes/_auth.dashboard.investigations.$investigationId.$type.$id'@@ -107,10 +107,10 @@ const AuthDashboardEnrichersEnricherIdRoute =path: '/enrichers/$enricherId',getParentRoute: () => AuthDashboardRoute,} as any)-const AuthDashboardCustomTypesIdRoute =- AuthDashboardCustomTypesIdRouteImport.update({- id: '/custom-types/$id',- path: '/custom-types/$id',+const AuthDashboardCustomTypesTypeIdRoute =+ AuthDashboardCustomTypesTypeIdRouteImport.update({+ id: '/custom-types/$typeId',+ path: '/custom-types/$typeId',getParentRoute: () => AuthDashboardRoute,} as any)const AuthDashboardInvestigationsInvestigationIdIndexRoute =@@ -135,14 +135,14 @@ export interface FileRoutesByFullPath {'/dashboard/tools': typeof AuthDashboardToolsRoute'/dashboard/vault': typeof AuthDashboardVaultRoute'/dashboard/': typeof AuthDashboardIndexRoute- '/dashboard/custom-types/$id': typeof AuthDashboardCustomTypesIdRoute+ '/dashboard/custom-types/$typeId': typeof AuthDashboardCustomTypesTypeIdRoute'/dashboard/enrichers/$enricherId': typeof AuthDashboardEnrichersEnricherIdRoute'/dashboard/enrichers/new': typeof AuthDashboardEnrichersNewRoute'/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute- '/dashboard/custom-types/': typeof AuthDashboardCustomTypesIndexRoute- '/dashboard/enrichers/': typeof AuthDashboardEnrichersIndexRoute- '/dashboard/flows/': typeof AuthDashboardFlowsIndexRoute- '/dashboard/investigations/$investigationId/': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute+ '/dashboard/custom-types': typeof AuthDashboardCustomTypesIndexRoute+ '/dashboard/enrichers': typeof AuthDashboardEnrichersIndexRoute+ '/dashboard/flows': typeof AuthDashboardFlowsIndexRoute+ '/dashboard/investigations/$investigationId': typeof AuthDashboardInvestigationsInvestigationIdIndexRoute'/dashboard/investigations/$investigationId/$type/$id': typeof AuthDashboardInvestigationsInvestigationIdTypeIdRoute}export interface FileRoutesByTo {@@ -153,7 +153,7 @@ export interface FileRoutesByTo {'/dashboard/tools': typeof AuthDashboardToolsRoute'/dashboard/vault': typeof AuthDashboardVaultRoute'/dashboard': typeof AuthDashboardIndexRoute- '/dashboard/custom-types/$id': typeof AuthDashboardCustomTypesIdRoute+ '/dashboard/custom-types/$typeId': typeof AuthDashboardCustomTypesTypeIdRoute'/dashboard/enrichers/$enricherId': typeof AuthDashboardEnrichersEnricherIdRoute'/dashboard/enrichers/new': typeof AuthDashboardEnrichersNewRoute'/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute@@ -174,7 +174,7 @@ export interface FileRoutesById {'/_auth/dashboard/tools': typeof AuthDashboardToolsRoute'/_auth/dashboard/vault': typeof AuthDashboardVaultRoute'/_auth/dashboard/': typeof AuthDashboardIndexRoute- '/_auth/dashboard/custom-types/$id': typeof AuthDashboardCustomTypesIdRoute+ '/_auth/dashboard/custom-types/$typeId': typeof AuthDashboardCustomTypesTypeIdRoute'/_auth/dashboard/enrichers/$enricherId': typeof AuthDashboardEnrichersEnricherIdRoute'/_auth/dashboard/enrichers/new': typeof AuthDashboardEnrichersNewRoute'/_auth/dashboard/flows/$flowId': typeof AuthDashboardFlowsFlowIdRoute@@ -195,14 +195,14 @@ export interface FileRouteTypes {| '/dashboard/tools'| '/dashboard/vault'| '/dashboard/'- | '/dashboard/custom-types/$id'+ | '/dashboard/custom-types/$typeId'| '/dashboard/enrichers/$enricherId'| '/dashboard/enrichers/new'| '/dashboard/flows/$flowId'- | '/dashboard/custom-types/'- | '/dashboard/enrichers/'- | '/dashboard/flows/'- | '/dashboard/investigations/$investigationId/'+ | '/dashboard/custom-types'+ | '/dashboard/enrichers'+ | '/dashboard/flows'+ | '/dashboard/investigations/$investigationId'| '/dashboard/investigations/$investigationId/$type/$id'fileRoutesByTo: FileRoutesByToto:@@ -213,7 +213,7 @@ export interface FileRouteTypes {| '/dashboard/tools'| '/dashboard/vault'| '/dashboard'- | '/dashboard/custom-types/$id'+ | '/dashboard/custom-types/$typeId'| '/dashboard/enrichers/$enricherId'| '/dashboard/enrichers/new'| '/dashboard/flows/$flowId'@@ -233,7 +233,7 @@ export interface FileRouteTypes {| '/_auth/dashboard/tools'| '/_auth/dashboard/vault'| '/_auth/dashboard/'- | '/_auth/dashboard/custom-types/$id'+ | '/_auth/dashboard/custom-types/$typeId'| '/_auth/dashboard/enrichers/$enricherId'| '/_auth/dashboard/enrichers/new'| '/_auth/dashboard/flows/$flowId'@@ -278,7 +278,7 @@ declare module '@tanstack/react-router' {'/_auth': {id: '/_auth'path: ''- fullPath: '/'+ fullPath: ''preLoaderRoute: typeof AuthRouteImportparentRoute: typeof rootRouteImport}@@ -320,21 +320,21 @@ declare module '@tanstack/react-router' {'/_auth/dashboard/flows/': {id: '/_auth/dashboard/flows/'path: '/flows'- fullPath: '/dashboard/flows/'+ fullPath: '/dashboard/flows'preLoaderRoute: typeof AuthDashboardFlowsIndexRouteImportparentRoute: typeof AuthDashboardRoute}'/_auth/dashboard/enrichers/': {id: '/_auth/dashboard/enrichers/'path: '/enrichers'- fullPath: '/dashboard/enrichers/'+ fullPath: '/dashboard/enrichers'preLoaderRoute: typeof AuthDashboardEnrichersIndexRouteImportparentRoute: typeof AuthDashboardRoute}'/_auth/dashboard/custom-types/': {id: '/_auth/dashboard/custom-types/'path: '/custom-types'- fullPath: '/dashboard/custom-types/'+ fullPath: '/dashboard/custom-types'preLoaderRoute: typeof AuthDashboardCustomTypesIndexRouteImportparentRoute: typeof AuthDashboardRoute}@@ -359,17 +359,17 @@ declare module '@tanstack/react-router' {preLoaderRoute: typeof AuthDashboardEnrichersEnricherIdRouteImportparentRoute: typeof AuthDashboardRoute}- '/_auth/dashboard/custom-types/$id': {- id: '/_auth/dashboard/custom-types/$id'- path: '/custom-types/$id'- fullPath: '/dashboard/custom-types/$id'- preLoaderRoute: typeof AuthDashboardCustomTypesIdRouteImport+ '/_auth/dashboard/custom-types/$typeId': {+ id: '/_auth/dashboard/custom-types/$typeId'+ path: '/custom-types/$typeId'+ fullPath: '/dashboard/custom-types/$typeId'+ preLoaderRoute: typeof AuthDashboardCustomTypesTypeIdRouteImportparentRoute: typeof AuthDashboardRoute}'/_auth/dashboard/investigations/$investigationId/': {id: '/_auth/dashboard/investigations/$investigationId/'path: '/investigations/$investigationId'- fullPath: '/dashboard/investigations/$investigationId/'+ fullPath: '/dashboard/investigations/$investigationId'preLoaderRoute: typeof AuthDashboardInvestigationsInvestigationIdIndexRouteImportparentRoute: typeof AuthDashboardRoute}@@ -387,7 +387,7 @@ interface AuthDashboardRouteChildren {AuthDashboardToolsRoute: typeof AuthDashboardToolsRouteAuthDashboardVaultRoute: typeof AuthDashboardVaultRouteAuthDashboardIndexRoute: typeof AuthDashboardIndexRoute- AuthDashboardCustomTypesIdRoute: typeof AuthDashboardCustomTypesIdRoute+ AuthDashboardCustomTypesTypeIdRoute: typeof AuthDashboardCustomTypesTypeIdRouteAuthDashboardEnrichersEnricherIdRoute: typeof AuthDashboardEnrichersEnricherIdRouteAuthDashboardEnrichersNewRoute: typeof AuthDashboardEnrichersNewRouteAuthDashboardFlowsFlowIdRoute: typeof AuthDashboardFlowsFlowIdRoute@@ -402,7 +402,7 @@ const AuthDashboardRouteChildren: AuthDashboardRouteChildren = {AuthDashboardToolsRoute: AuthDashboardToolsRoute,AuthDashboardVaultRoute: AuthDashboardVaultRoute,AuthDashboardIndexRoute: AuthDashboardIndexRoute,- AuthDashboardCustomTypesIdRoute: AuthDashboardCustomTypesIdRoute,+ AuthDashboardCustomTypesTypeIdRoute: AuthDashboardCustomTypesTypeIdRoute,AuthDashboardEnrichersEnricherIdRoute: AuthDashboardEnrichersEnricherIdRoute,AuthDashboardEnrichersNewRoute: AuthDashboardEnrichersNewRoute,AuthDashboardFlowsFlowIdRoute: AuthDashboardFlowsFlowIdRoute,diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.$id.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.$id.tsxdeleted file mode 100644index eeccb5dd..00000000--- a/flowsint-app/src/routes/_auth.dashboard.custom-types.$id.tsx+++ /dev/null@@ -1,575 +0,0 @@-import { createFileRoute, useNavigate } from '@tanstack/react-router'-import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'-import { useState, useEffect } from 'react'-import { Button } from '@/components/ui/button'-import { Input } from '@/components/ui/input'-import { Label } from '@/components/ui/label'-import { Textarea } from '@/components/ui/textarea'-import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'-import { customTypeService, CustomType } from '@/api/custom-type-service'-import { toast } from 'sonner'-import { ArrowLeft, Save, Plus, Trash2, AlertCircle, ChevronDown, ChevronRight } from 'lucide-react'-import { Badge } from '@/components/ui/badge'-import {- Select,- SelectContent,- SelectItem,- SelectTrigger,- SelectValue-} from '@/components/ui/select'-import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'-import { Switch } from '@/components/ui/switch'-import {- Table,- TableBody,- TableCell,- TableHead,- TableHeader,- TableRow-} from '@/components/ui/table'-import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible'--export const Route = createFileRoute('/_auth/dashboard/custom-types/$id')({- component: CustomTypeEditor-})--interface SchemaField {- id: string- key: string- title: string- type: string- format?: string- description?: string- required: boolean-}--function CustomTypeEditor() {- const { id } = Route.useParams()- const navigate = useNavigate()- const queryClient = useQueryClient()- const isNew = id === 'new'-- // Form state- const [name, setName] = useState('')- const [description, setDescription] = useState('')- const [status, setStatus] = useState<'draft' | 'published'>('draft')- const [fields, setFields] = useState<SchemaField[]>([])- const [expandedFields, setExpandedFields] = useState<Set<string>>(new Set())-- // Load existing type if editing- const { data: existingType, isLoading } = useQuery<CustomType>({- queryKey: ['custom-type', id],- queryFn: () => customTypeService.getById(id),- enabled: !isNew- })-- useEffect(() => {- if (existingType) {- setName(existingType.name)- setDescription(existingType.description || '')- setStatus(existingType.status === 'archived' ? 'draft' : existingType.status)- parseSchemaToFields(existingType.schema)- } else if (isNew) {- // Start with one empty field- addField()- }- }, [existingType, isNew])-- // Parse JSON Schema to fields array- const parseSchemaToFields = (schema: any) => {- const properties = schema.properties || {}- const required = schema.required || []- const parsedFields: SchemaField[] = Object.entries(properties).map(- ([key, value]: [string, any]) => ({- id: Math.random().toString(36).substr(2, 9),- key,- title: value.title || key,- type: value.type || 'string',- format: value.format,- description: value.description,- required: required.includes(key)- })- )- setFields(parsedFields)- }-- // Convert fields array to JSON Schema- const fieldsToSchema = () => {- const properties: any = {}- const required: string[] = []-- fields.forEach((field) => {- if (!field.key.trim()) return // Skip empty keys-- const prop: any = {- type: field.type,- title: field.title || field.key- }- if (field.description) prop.description = field.description- if (field.format && field.format !== 'none') prop.format = field.format-- properties[field.key] = prop-- if (field.required) {- required.push(field.key)- }- })-- return {- title: name || 'MyCustomType',- type: 'object',- properties,- required- }- }-- // Add new field- const addField = () => {- const newField: SchemaField = {- id: Math.random().toString(36).substr(2, 9),- key: '',- title: '',- type: 'string',- required: false- }- setFields([...fields, newField])- }-- // Update field- const updateField = (id: string, updates: Partial<SchemaField>) => {- setFields(fields.map((f) => (f.id === id ? { ...f, ...updates } : f)))- }-- // Delete field- const deleteField = (id: string) => {- setFields(fields.filter((f) => f.id !== id))- }-- // Toggle field expansion- const toggleFieldExpansion = (fieldId: string) => {- const newExpanded = new Set(expandedFields)- if (newExpanded.has(fieldId)) {- newExpanded.delete(fieldId)- } else {- newExpanded.add(fieldId)- }- setExpandedFields(newExpanded)- }-- // Create mutation- const createMutation = useMutation({- mutationFn: (data: any) => customTypeService.create(data),- onSuccess: () => {- queryClient.invalidateQueries({ queryKey: ['custom-types'] })- toast.success('Custom type created successfully')- navigate({ to: '/dashboard/custom-types' })- },- onError: (error: Error) => {- toast.error(`Failed to create custom type: ${error.message}`)- }- })-- // Update mutation- const updateMutation = useMutation({- mutationFn: (data: any) => customTypeService.update(id, data),- onSuccess: () => {- queryClient.invalidateQueries({ queryKey: ['custom-types'] })- queryClient.invalidateQueries({ queryKey: ['custom-type', id] })- toast.success('Custom type updated successfully')- },- onError: (error: Error) => {- toast.error(`Failed to update custom type: ${error.message}`)- }- })-- const handleSave = () => {- if (!name.trim()) {- toast.error('Please enter a name for the custom type')- return- }-- // Check for duplicate or empty keys- const keys = fields.map((f) => f.key.trim()).filter((k) => k)- const uniqueKeys = new Set(keys)- if (keys.length !== uniqueKeys.size) {- toast.error('Field keys must be unique')- return- }-- if (fields.length === 0 || fields.every((f) => !f.key.trim())) {- toast.error('Please add at least one field')- return- }-- const schema = fieldsToSchema()-- const data = {- name: name.trim(),- description: description.trim() || undefined,- schema,- status- }-- if (isNew) {- createMutation.mutate(data)- } else {- updateMutation.mutate(data)- }- }-- if (!isNew && isLoading) {- return (- <div className="h-full w-full flex items-center justify-center">- <div className="text-muted-foreground">Loading...</div>- </div>- )- }-- return (- <div className="h-full w-full overflow-y-auto bg-background">- {/* Header */}- <div className="sticky top-0 z-10 border-b border-border bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">- <div className="max-w-7xl mx-auto px-8 py-4">- <div className="flex items-center justify-between">- <div className="flex items-center gap-4">- <Button- variant="ghost"- size="sm"- onClick={() => navigate({ to: '/dashboard/custom-types' })}- >- <ArrowLeft className="w-4 h-4 mr-2" />- Back- </Button>- <div className="border-l pl-4">- <h1 className="text-2xl font-bold text-foreground">- {isNew ? 'New custom type' : name || 'Edit custom type'}- </h1>- <p className="text-sm text-muted-foreground">- {isNew- ? 'Define your custom data structure'- : 'Update your custom type definition'}- </p>- </div>- </div>- <Button- onClick={handleSave}- disabled={createMutation.isPending || updateMutation.isPending}- >- <Save className="w-4 h-4 mr-2" />- {isNew ? 'Create' : 'Save changes'}- </Button>- </div>- </div>- </div>-- {/* Content */}- <div className="max-w-7xl mx-auto p-8">- <Tabs defaultValue="basic" className="w-full">- <TabsList className="mb-6">- <TabsTrigger value="basic">Basic Information</TabsTrigger>- <TabsTrigger value="fields">- Fields{' '}- {fields.filter((f) => f.key.trim()).length > 0 && (- <Badge variant="secondary" className="ml-2">- {fields.filter((f) => f.key.trim()).length}- </Badge>- )}- </TabsTrigger>- <TabsTrigger value="preview">Preview</TabsTrigger>- </TabsList>-- {/* Basic Info Tab */}- <TabsContent value="basic" className="space-y-6">- <Card>- <CardHeader>- <CardTitle>Type details</CardTitle>- <CardDescription>- Configure the basic properties of your custom type- </CardDescription>- </CardHeader>- <CardContent className="space-y-4">- <div className="grid grid-cols-2 gap-4">- <div className="space-y-2">- <Label htmlFor="name">Name *</Label>- <Input- id="name"- value={name}- onChange={(e) => setName(e.target.value)}- placeholder="e.g., Contact, Asset, Threat Actor"- />- <p className="text-xs text-muted-foreground">- A descriptive name for this type- </p>- </div>-- <div className="space-y-2">- <Label htmlFor="status">Status</Label>- <Select value={status} onValueChange={(v: any) => setStatus(v)}>- <SelectTrigger>- <SelectValue />- </SelectTrigger>- <SelectContent>- <SelectItem value="draft">Draft</SelectItem>- <SelectItem value="published">Published</SelectItem>- </SelectContent>- </Select>- <p className="text-xs text-muted-foreground">- Only published types are available for use- </p>- </div>- </div>-- <div className="space-y-2">- <Label htmlFor="description">Description</Label>- <Textarea- id="description"- value={description}- onChange={(e) => setDescription(e.target.value)}- placeholder="Describe what this custom type represents and how it should be used..."- rows={4}- />- </div>- </CardContent>- </Card>- </TabsContent>-- {/* Fields Tab */}- <TabsContent value="fields" className="space-y-6">- <Card>- <CardHeader>- <div className="flex items-center justify-between">- <div>- <CardTitle>Field Definitions</CardTitle>- <CardDescription>Define the properties that make up this type</CardDescription>- </div>- <Button onClick={addField} size="sm">- <Plus className="w-4 h-4 mr-2" />- Add Field- </Button>- </div>- </CardHeader>- <CardContent>- {fields.length === 0 ? (- <div className="text-center py-12 border-2 border-dashed rounded-lg">- <p className="text-muted-foreground mb-4">No fields defined yet</p>- <Button onClick={addField} variant="outline" size="sm">- <Plus className="w-4 h-4 mr-2" />- Add Your First Field- </Button>- </div>- ) : (- <div className="space-y-3">- {fields.map((field, index) => (- <Collapsible- key={field.id}- open={expandedFields.has(field.id)}- onOpenChange={() => toggleFieldExpansion(field.id)}- >- <div className="border rounded-lg">- {/* Collapsed view */}- <div className="flex items-center gap-3 p-3">- <CollapsibleTrigger asChild>- <Button variant="ghost" size="sm" className="h-8 w-8 p-0">- {expandedFields.has(field.id) ? (- <ChevronDown className="h-4 w-4" />- ) : (- <ChevronRight className="h-4 w-4" />- )}- </Button>- </CollapsibleTrigger>-- <div className="flex-1 grid grid-cols-5 gap-3 items-center">- <Input- value={field.key}- onChange={(e) => updateField(field.id, { key: e.target.value })}- placeholder="field_key"- className="h-9"- />- <Input- value={field.title}- onChange={(e) => updateField(field.id, { title: e.target.value })}- placeholder="Display Name"- className="h-9"- />- <Select- value={field.type}- onValueChange={(v) => updateField(field.id, { type: v })}- >- <SelectTrigger className="h-9">- <SelectValue />- </SelectTrigger>- <SelectContent>- <SelectItem value="string">String</SelectItem>- <SelectItem value="number">Number</SelectItem>- <SelectItem value="integer">Integer</SelectItem>- <SelectItem value="boolean">Boolean</SelectItem>- <SelectItem value="array">Array</SelectItem>- <SelectItem value="object">Object</SelectItem>- </SelectContent>- </Select>- <Select- value={field.format || 'none'}- onValueChange={(v) =>- updateField(field.id, { format: v === 'none' ? undefined : v })- }- >- <SelectTrigger className="h-9">- <SelectValue />- </SelectTrigger>- <SelectContent>- <SelectItem value="none">-</SelectItem>- <SelectItem value="email">Email</SelectItem>- <SelectItem value="uri">URI</SelectItem>- <SelectItem value="date">Date</SelectItem>- <SelectItem value="date-time">DateTime</SelectItem>- <SelectItem value="ipv4">IPv4</SelectItem>- <SelectItem value="ipv6">IPv6</SelectItem>- </SelectContent>- </Select>- <div className="flex items-center gap-2">- <Switch- checked={field.required}- onCheckedChange={(checked) =>- updateField(field.id, { required: checked })- }- />- <span className="text-xs text-muted-foreground">Required</span>- </div>- </div>-- <Button- variant="ghost"- size="sm"- onClick={() => deleteField(field.id)}- className="h-9 w-9 p-0"- >- <Trash2 className="w-4 h-4 text-muted-foreground hover:text-destructive" />- </Button>- </div>-- {/* Expanded view with description */}- <CollapsibleContent>- <div className="px-3 pb-3 pt-0 border-t mt-3">- <div className="pt-3 space-y-2">- <Label htmlFor={`desc-${field.id}`} className="text-xs">- Description (optional)- </Label>- <Textarea- id={`desc-${field.id}`}- value={field.description || ''}- onChange={(e) =>- updateField(field.id, { description: e.target.value })- }- placeholder="Describe this field's purpose and expected values..."- rows={3}- className="text-sm"- />- </div>- </div>- </CollapsibleContent>- </div>- </Collapsible>- ))}-- <Button onClick={addField} variant="outline" className="w-full">- <Plus className="w-4 h-4 mr-2" />- New field- </Button>- </div>- )}- </CardContent>- </Card>-- {fields.length > 0 && (- <Card className="border-blue-200 bg-blue-50/50 dark:bg-blue-950/20 dark:border-blue-900">- <CardContent className="pt-6">- <div className="flex gap-3">- <AlertCircle className="w-5 h-5 text-blue-600 dark:text-blue-400 shrink-0 mt-0.5" />- <div className="space-y-1">- <p className="text-sm font-medium text-blue-900 dark:text-blue-100">- Tips for defining fields- </p>- <ul className="text-xs text-blue-700 dark:text-blue-300 space-y-1">- <li>- • Field keys should be lowercase with underscores (e.g., email_address)- </li>- <li>• Display names are shown to users in forms and tables</li>- <li>• Use formats to enable validation (e.g., email, date, ipv4)</li>- <li>• Mark critical fields as required to ensure data quality</li>- </ul>- </div>- </div>- </CardContent>- </Card>- )}- </TabsContent>-- {/* Preview Tab */}- <TabsContent value="preview" className="space-y-6">- <Card>- <CardHeader>- <CardTitle>Schema Preview</CardTitle>- <CardDescription>JSON Schema representation of your custom type</CardDescription>- </CardHeader>- <CardContent>- <pre className="p-4 bg-muted rounded-lg text-sm overflow-x-auto">- {JSON.stringify(fieldsToSchema(), null, 2)}- </pre>- </CardContent>- </Card>-- <Card>- <CardHeader>- <CardTitle>Field Summary</CardTitle>- <CardDescription>Overview of all defined fields</CardDescription>- </CardHeader>- <CardContent>- {fields.filter((f) => f.key.trim()).length === 0 ? (- <p className="text-sm text-muted-foreground">No fields defined yet</p>- ) : (- <div className="space-y-3">- {fields- .filter((f) => f.key.trim())- .map((field) => (- <div- key={field.id}- className="flex items-start justify-between p-3 border rounded-lg"- >- <div className="space-y-1">- <div className="flex items-center gap-2">- <span className="font-medium text-sm">- {field.title || field.key}- </span>- {field.required && (- <Badge variant="outline" className="text-xs">- Required- </Badge>- )}- </div>- <p className="text-xs text-muted-foreground">Key: {field.key}</p>- {field.description && (- <p className="text-xs text-muted-foreground">{field.description}</p>- )}- </div>- <div className="flex flex-col items-end gap-1">- <Badge variant="secondary" className="text-xs">- {field.type}- </Badge>- {field.format && (- <Badge variant="outline" className="text-xs">- {field.format}- </Badge>- )}- </div>- </div>- ))}- </div>- )}- </CardContent>- </Card>- </TabsContent>- </Tabs>- </div>- </div>- )-}diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsxnew file mode 100644index 00000000..ddbf0f20--- /dev/null+++ b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx@@ -0,0 +1,407 @@+import { createFileRoute, useNavigate } from '@tanstack/react-router'+import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'+import { useState, useEffect } from 'react'+import { Button } from '@/components/ui/button'+import { customTypeService, CustomType } from '@/api/custom-type-service'+import { toast } from 'sonner'+import { ArrowLeft, Plus, Eye, EyeOff } from 'lucide-react'+import { Reorder } from 'framer-motion'+import {+ Select,+ SelectContent,+ SelectItem,+ SelectTrigger,+ SelectValue+} from '@/components/ui/select'+import { Separator } from '@/components/ui/separator'+import { ColorPicker } from '@/components/shared/color-picker'+import { IconPickerTrigger } from '@/components/custom-types/icon-picker-trigger'+import { FieldRow, type SchemaField } from '@/components/custom-types/field-row'+import { TypePreview } from '@/components/custom-types/type-preview'+import { Skeleton } from '@/components/ui/skeleton'+import { useNodesDisplaySettings } from '@/stores/node-display-settings'+import { clearIconTypeCache } from '@/components/sketches/graph/utils/image-cache'+import { useKeyboardShortcut } from '@/hooks/use-keyboard-shortcut'++export const Route = createFileRoute('/_auth/dashboard/custom-types/$typeId')({+ component: CustomTypeEditor+})++const DEFAULT_COLOR = '#8E7CC3'+const DEFAULT_ICON = 'FileQuestion'++function CustomTypeEditor() {+ const { typeId: id } = Route.useParams()+ const navigate = useNavigate()+ const queryClient = useQueryClient()+ const isNew = id === 'new'++ // Form state+ const [name, setName] = useState('')+ const [description, setDescription] = useState('')+ const [status, setStatus] = useState<'draft' | 'published'>('draft')+ const [icon, setIcon] = useState(DEFAULT_ICON)+ const [color, setColor] = useState(DEFAULT_COLOR)+ const [fields, setFields] = useState<SchemaField[]>([])+ const [showPreview, setShowPreview] = useState(true)++ // Load existing type if editing+ const { data: existingType, isLoading } = useQuery<CustomType>({+ queryKey: ['custom-type', id],+ queryFn: () => customTypeService.getById(id),+ enabled: !isNew+ })++ useEffect(() => {+ if (existingType) {+ setName(existingType.name)+ setDescription(existingType.description || '')+ setStatus(existingType.status === 'archived' ? 'draft' : existingType.status)+ setIcon(existingType.icon || DEFAULT_ICON)+ setColor(existingType.color || DEFAULT_COLOR)+ parseSchemaToFields(existingType.schema)+ } else if (isNew) {+ addField()+ }+ }, [existingType, isNew])++ const parseSchemaToFields = (schema: any) => {+ const properties = schema.properties || {}+ const required = schema.required || []+ const parsedFields: SchemaField[] = Object.entries(properties).map(+ ([key, value]: [string, any]) => ({+ id: Math.random().toString(36).substr(2, 9),+ key,+ title: value.title || key,+ type: value.type || 'string',+ format: value.format,+ description: value.description,+ required: required.includes(key)+ })+ )+ setFields(parsedFields)+ }++ const fieldsToSchema = () => {+ const properties: any = {}+ const required: string[] = []+ fields.forEach((field) => {+ if (!field.key.trim()) return+ const prop: any = { type: field.type, title: field.title || field.key }+ if (field.description) prop.description = field.description+ if (field.format && field.format !== 'none') prop.format = field.format+ properties[field.key] = prop+ if (field.required) required.push(field.key)+ })+ return { title: name || 'MyCustomType', type: 'object', properties, required }+ }++ const addField = () => {+ setFields([+ ...fields,+ {+ id: Math.random().toString(36).substr(2, 9),+ key: '',+ title: '',+ type: 'string',+ required: false+ }+ ])+ }++ const updateField = (id: string, updates: Partial<SchemaField>) => {+ setFields(fields.map((f) => (f.id === id ? { ...f, ...updates } : f)))+ }++ const deleteField = (id: string) => {+ setFields(fields.filter((f) => f.id !== id))+ }++ const { setColor: setDisplayColor, setIcon: setDisplayIcon } = useNodesDisplaySettings()++ const syncDisplaySettings = () => {+ const typeName = name.trim().toLowerCase().replace(/\s+/g, '')+ setDisplayColor(typeName as any, color)+ setDisplayIcon(typeName, icon as any)+ clearIconTypeCache(typeName)+ }++ const createMutation = useMutation({+ mutationFn: (data: any) => customTypeService.create(data),+ onSuccess: () => {+ syncDisplaySettings()+ queryClient.invalidateQueries({ queryKey: ['custom-types'] })+ queryClient.invalidateQueries({ queryKey: ['actionItems'] })+ toast.success('Custom type created')+ navigate({ to: '/dashboard/custom-types' })+ },+ onError: (error: Error) => {+ toast.error(`Failed to create: ${error.message}`)+ }+ })++ const updateMutation = useMutation({+ mutationFn: (data: any) => customTypeService.update(id, data),+ onSuccess: () => {+ syncDisplaySettings()+ queryClient.invalidateQueries({ queryKey: ['custom-types'] })+ queryClient.invalidateQueries({ queryKey: ['custom-type', id] })+ queryClient.invalidateQueries({ queryKey: ['actionItems'] })+ toast.success('Changes saved')+ },+ onError: (error: Error) => {+ toast.error(`Failed to save: ${error.message}`)+ }+ })++ const handleSave = () => {+ if (!name.trim()) {+ toast.error('Please enter a name')+ return+ }+ const keys = fields.map((f) => f.key.trim()).filter((k) => k)+ if (new Set(keys).size !== keys.length) {+ toast.error('Field keys must be unique')+ return+ }+ if (fields.length === 0 || fields.every((f) => !f.key.trim())) {+ toast.error('Add at least one field')+ return+ }++ const data = {+ name: name.trim(),+ description: description.trim() || undefined,+ schema: fieldsToSchema(),+ icon,+ color,+ status+ }++ if (isNew) {+ createMutation.mutate(data)+ } else {+ updateMutation.mutate(data)+ }+ }++ const isSaving = createMutation.isPending || updateMutation.isPending++ useKeyboardShortcut({+ key: 's',+ ctrlOrCmd: true,+ callback: handleSave+ })++ if (!isNew && isLoading) {+ return (+ <div className="h-full w-full overflow-y-auto bg-background">+ <div className="max-w-6xl mx-auto px-8 py-12">+ <div className="flex items-center gap-4 mb-10">+ <Skeleton className="h-[52px] w-[52px] rounded-xl" />+ <div className="space-y-2 flex-1">+ <Skeleton className="h-8 w-64" />+ <Skeleton className="h-4 w-96" />+ </div>+ </div>+ <div className="space-y-3">+ {[1, 2, 3].map((i) => (+ <Skeleton key={i} className="h-10 w-full" />+ ))}+ </div>+ </div>+ </div>+ )+ }++ return (+ <div className="h-full w-full overflow-y-auto bg-background">+ <div className="sticky top-0 z-10 border-b border-border/40 bg-background/80 backdrop-blur-sm">+ <div className="max-w-6xl mx-auto px-8 py-3 flex items-center justify-between">+ <div className="flex items-center gap-3">+ <Button+ variant="ghost"+ size="sm"+ className="text-muted-foreground hover:text-foreground h-8 px-2"+ onClick={() => navigate({ to: '/dashboard/custom-types' })}+ >+ <ArrowLeft className="w-4 h-4 mr-1.5" />+ <span className="text-sm">Types</span>+ </Button>+ <span className="text-muted-foreground/30">/</span>+ <span className="text-sm text-muted-foreground truncate max-w-[200px]">+ {isNew ? 'New type' : name || 'Untitled'}+ </span>+ </div>+ <div className="flex items-center gap-2">+ <Button+ variant="ghost"+ size="sm"+ className="h-8 text-muted-foreground"+ onClick={() => setShowPreview(!showPreview)}+ >+ {showPreview ? (+ <EyeOff className="w-3.5 h-3.5 mr-1.5" />+ ) : (+ <Eye className="w-3.5 h-3.5 mr-1.5" />+ )}+ Preview+ </Button>+ <Button size="sm" className="h-8" onClick={handleSave} disabled={isSaving}>+ {isSaving ? 'Saving...' : isNew ? 'Create' : 'Save'}+ </Button>+ </div>+ </div>+ </div>+ <div className="max-w-6xl mx-auto px-8 py-10">+ <div className={showPreview ? 'flex gap-10' : ''}>+ <div className="space-y-10">+ <div className="space-y-5 flex items-start">+ <div className="flex items-start gap-4">+ <div className="flex flex-col items-center gap-2 pt-1">+ <IconPickerTrigger icon={icon} color={color} onIconChange={setIcon} />+ <ColorPicker value={color} onChange={setColor} />+ </div>+ <div className="flex-1 space-y-2 min-w-0">+ <input+ value={name}+ onChange={(e) => setName(e.target.value)}+ placeholder="Untitled type"+ className="w-full text-3xl font-bold bg-transparent border-none outline-none placeholder:text-muted-foreground/30 text-foreground tracking-tight"+ />+ <textarea+ value={description}+ onChange={(e) => setDescription(e.target.value)}+ placeholder="Add a description..."+ rows={1}+ className="w-full text-sm bg-transparent border-none outline-none placeholder:text-muted-foreground/40 text-muted-foreground resize-none leading-relaxed"+ onInput={(e) => {+ const target = e.target as HTMLTextAreaElement+ target.style.height = 'auto'+ target.style.height = target.scrollHeight + 'px'+ }}+ />+ </div>+ </div>+ <div className="flex items-center gap-3">+ <span className="text-xs text-muted-foreground/60">Status</span>+ <Select value={status} onValueChange={(v: any) => setStatus(v)}>+ <SelectTrigger className="w-[130px] h-7 text-xs border-border/40 bg-transparent">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ <SelectItem value="draft">+ <div className="flex items-center gap-2">+ <div className="w-1.5 h-1.5 rounded-full bg-muted-foreground/40" />+ Draft+ </div>+ </SelectItem>+ <SelectItem value="published">+ <div className="flex items-center gap-2">+ <div className="w-1.5 h-1.5 rounded-full bg-green-500" />+ Published+ </div>+ </SelectItem>+ </SelectContent>+ </Select>+ </div>+ </div>+ <Separator className="opacity-40" />+ <div className="space-y-4">+ <div className="flex items-center justify-between">+ <div>+ <h2 className="text-sm font-semibold text-foreground">Properties</h2>+ <p className="text-xs text-muted-foreground/60 mt-0.5">+ Define the data structure for this entity type+ </p>+ </div>+ <Button+ variant="ghost"+ size="sm"+ className="h-7 text-xs text-muted-foreground hover:text-foreground"+ onClick={addField}+ >+ <Plus className="w-3.5 h-3.5 mr-1" />+ Add property+ </Button>+ </div>++ {fields.length === 0 ? (+ <button+ onClick={addField}+ className="w-full py-10 border border-dashed border-border/50 rounded-lg text-sm text-muted-foreground/50 hover:text-muted-foreground hover:border-border transition-colors"+ >+ <Plus className="w-4 h-4 mx-auto mb-2 opacity-50" />+ Add your first property+ </button>+ ) : (+ <div className="space-y-px">+ {/* Column headers */}+ <div className="flex items-center gap-2 px-2 py-1.5">+ <div className="w-[52px] shrink-0" />+ <div className="flex-1 grid grid-cols-[1fr_1fr_120px_120px] gap-2">+ <span className="text-[10px] font-medium text-muted-foreground/50 uppercase tracking-wider">+ Key+ </span>+ <span className="text-[10px] font-medium text-muted-foreground/50 uppercase tracking-wider">+ Label+ </span>+ <span className="text-[10px] font-medium text-muted-foreground/50 uppercase tracking-wider">+ Type+ </span>+ <span className="text-[10px] font-medium text-muted-foreground/50 uppercase tracking-wider">+ Format+ </span>+ </div>+ <div className="w-9 shrink-0" />+ </div>++ <Reorder.Group+ axis="y"+ values={fields}+ onReorder={setFields}+ className="space-y-1"+ >+ {fields.map((field) => (+ <FieldRow+ key={field.id}+ field={field}+ onUpdate={(updates) => updateField(field.id, updates)}+ onDelete={() => deleteField(field.id)}+ />+ ))}+ </Reorder.Group>++ {/* Add row button */}+ <button+ onClick={addField}+ className="w-full flex items-center gap-2 px-2 py-2 text-xs text-muted-foreground/40 hover:text-muted-foreground hover:bg-muted/30 rounded-lg transition-colors"+ >+ <Plus className="w-3.5 h-3.5" />+ New property+ </button>+ </div>+ )}+ </div>+ </div>++ {/* Right: Preview panel */}+ {showPreview && (+ <div className="border-l border-border/30 pl-8">+ <div className="sticky top-16">+ <TypePreview+ name={name}+ description={description}+ icon={icon}+ color={color}+ fields={fields}+ status={status}+ />+ </div>+ </div>+ )}+ </div>+ </div>+ </div>+ )+}diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsxindex 402c025b..578725a3 100644--- a/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.custom-types.index.tsx@@ -49,6 +49,7 @@ function CustomTypesPage() {mutationFn: (id: string) => customTypeService.delete(id),onSuccess: () => {queryClient.invalidateQueries({ queryKey: ['custom-types'] })+ queryClient.invalidateQueries({ queryKey: ['actionItems'] })toast.success('Custom type deleted successfully')},onError: (error: Error) => {diff --git a/flowsint-app/src/routes/_auth.dashboard.enrichers.$enricherId.tsx b/flowsint-app/src/routes/_auth.dashboard.enrichers.$enricherId.tsxindex 538f7500..64634690 100644--- a/flowsint-app/src/routes/_auth.dashboard.enrichers.$enricherId.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.enrichers.$enricherId.tsx@@ -2,12 +2,11 @@ import { createFileRoute, redirect } from '@tanstack/react-router'import Loader from '@/components/loader'import { templateService } from '@/api/template-service'import { TemplateEditor } from '@/components/templates/template-editor'--const FEATURE_FLAG = true+import { CONFIG } from '@/config'export const Route = createFileRoute('/_auth/dashboard/enrichers/$enricherId')({beforeLoad: async () => {- if (FEATURE_FLAG) {+ if (!CONFIG.ENRICHER_TEMPLATES_FEATURE_FLAG) {throw redirect({to: '/'})diff --git a/flowsint-app/src/routes/_auth.dashboard.enrichers.index.tsx b/flowsint-app/src/routes/_auth.dashboard.enrichers.index.tsxindex 69941892..67b3762b 100644--- a/flowsint-app/src/routes/_auth.dashboard.enrichers.index.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.enrichers.index.tsx@@ -13,11 +13,11 @@ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'import ErrorState from '@/components/shared/error-state'import { PageLayout } from '@/components/layout/page-layout'import { templateService, type Template } from '@/api/template-service'-const FEATURE_FLAG = true+import { CONFIG } from '@/config'export const Route = createFileRoute('/_auth/dashboard/enrichers/')({beforeLoad: async () => {- if (FEATURE_FLAG) {+ if (!CONFIG.ENRICHER_TEMPLATES_FEATURE_FLAG) {throw redirect({to: '/'})diff --git a/flowsint-app/src/routes/_auth.dashboard.enrichers.new.tsx b/flowsint-app/src/routes/_auth.dashboard.enrichers.new.tsxindex 81a7af3b..20050bf4 100644--- a/flowsint-app/src/routes/_auth.dashboard.enrichers.new.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.enrichers.new.tsx@@ -1,10 +1,10 @@import { createFileRoute, useRouterState, redirect } from '@tanstack/react-router'import { TemplateEditor } from '@/components/templates/template-editor'-const FEATURE_FLAG = true+import { CONFIG } from '@/config'export const Route = createFileRoute('/_auth/dashboard/enrichers/new')({beforeLoad: async () => {- if (FEATURE_FLAG) {+ if (!CONFIG.ENRICHER_TEMPLATES_FEATURE_FLAG) {throw redirect({to: '/'})diff --git a/flowsint-app/src/stores/node-display-settings.ts b/flowsint-app/src/stores/node-display-settings.tsindex e74b584a..84661304 100644--- a/flowsint-app/src/stores/node-display-settings.ts+++ b/flowsint-app/src/stores/node-display-settings.ts@@ -42,6 +42,7 @@ export type ItemType =| 'webtracker'| 'weapon'| 'whois'+ | 'custom'export const ITEM_TYPES: ItemType[] = ['domain',@@ -82,7 +83,8 @@ export const ITEM_TYPES: ItemType[] = ['session','webtracker','weapon',- 'whois'+ 'whois',+ 'custom']// Icon mapping for each item type (Lucide icons)@@ -126,7 +128,8 @@ export const TYPE_TO_ICON: Record<string, keyof typeof LucideIcons> = {webtracker: 'Target',weapon: 'Sword',whois: 'Info',- default: 'Circle'+ default: 'FileQuestion',+ custom: 'Cog'}const DEFAULT_COLORS: Record<ItemType, string> = {@@ -168,7 +171,8 @@ const DEFAULT_COLORS: Record<ItemType, string> = {session: '#A8BF50', // lime atténuéwebtracker: '#C7BF50', // jaune douxweapon: '#E98973', // corail brun- whois: '#9B6F9B' // violet doux+ whois: '#9B6F9B', // violet doux+ custom: '#9B6F9B'}const hslToHex = (h: number, s: number, l: number): string => {