A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
Added category to custom types to reorginize into desired categories
Ericf0b0b9bf823e
diff --git a/flowsint-api/alembic/versions/f4d42260273d_add_category_to_custom_types.py b/flowsint-api/alembic/versions/f4d42260273d_add_category_to_custom_types.pynew file mode 100644index 00000000..da320699--- /dev/null+++ b/flowsint-api/alembic/versions/f4d42260273d_add_category_to_custom_types.py@@ -0,0 +1,32 @@+"""add_category_to_custom_types++Revision ID: f4d42260273d+Revises: a1f2b3c4d5e6+Create Date: 2026-06-06 14:47:31.692222++"""+from typing import Sequence, Union++from alembic import op+import sqlalchemy as sa+++# revision identifiers, used by Alembic.+revision: str = 'f4d42260273d'+down_revision: Union[str, None] = 'a1f2b3c4d5e6'+branch_labels: Union[str, Sequence[str], None] = None+depends_on: Union[str, Sequence[str], None] = None+++def upgrade() -> None:+ """Upgrade schema."""+ # ### commands auto generated by Alembic - please adjust! ###+ op.add_column('custom_types', sa.Column('category', sa.String(), server_default='Custom types', nullable=False))+ # ### end Alembic commands ###+++def downgrade() -> None:+ """Downgrade schema."""+ # ### commands auto generated by Alembic - please adjust! ###+ op.drop_column('custom_types', 'category')+ # ### end Alembic commands ###diff --git a/flowsint-api/app/api/routes/custom_types.py b/flowsint-api/app/api/routes/custom_types.pyindex 9457138e..15040ca9 100644--- a/flowsint-api/app/api/routes/custom_types.py+++ b/flowsint-api/app/api/routes/custom_types.py@@ -46,6 +46,7 @@ def create_custom_type(user_id=current_user.id,description=custom_type.description,status=custom_type.status,+ category=custom_type.category,validate_schema_func=validate_json_schema,calculate_checksum_func=calculate_schema_checksum,)@@ -116,6 +117,7 @@ def update_custom_type(json_schema=update_data.json_schema,description=update_data.description,status=update_data.status,+ category=update_data.category,validate_schema_func=validate_json_schema,calculate_checksum_func=calculate_schema_checksum,)diff --git a/flowsint-api/app/api/schemas/custom_type.py b/flowsint-api/app/api/schemas/custom_type.pyindex e8a4b010..429cce3d 100644--- a/flowsint-api/app/api/schemas/custom_type.py+++ b/flowsint-api/app/api/schemas/custom_type.py@@ -19,6 +19,7 @@ class CustomTypeCreate(BaseModel):None, description="Optional description of the custom type")status: str = Field("draft", description="Status of the custom type")+ category: str = Field("Custom types", description="Category of the custom type")color: str = Field("#8E9E8C", description="Default color")icon: str = Field("Minus", description="Default icon")@@ -40,6 +41,7 @@ class CustomTypeUpdate(BaseModel):json_schema: Optional[Dict[str, Any]] = Field(None, alias="schema")description: Optional[str] = Nonestatus: Optional[str] = None+ category: Optional[str] = Nonecolor: Optional[str] = Noneicon: Optional[str] = None@@ -64,6 +66,7 @@ class CustomTypeRead(ORMBase):icon: Optional[str]json_schema: Dict[str, Any] = Field(..., alias="schema")status: str+ category: strchecksum: Optional[str]description: Optional[str]created_at: datetimediff --git a/flowsint-app/src/api/custom-type-service.ts b/flowsint-app/src/api/custom-type-service.tsindex 7b47030f..cabe71ed 100644--- a/flowsint-app/src/api/custom-type-service.ts+++ b/flowsint-app/src/api/custom-type-service.ts@@ -6,6 +6,7 @@ export interface CustomType {owner_id: stringschema: Record<string, any>status: 'draft' | 'published' | 'archived'+ category: stringchecksum?: stringdescription?: stringicon?: string@@ -21,6 +22,7 @@ export interface CustomTypeCreate {icon?: stringcolor?: stringstatus?: 'draft' | 'published'+ category?: string}export interface CustomTypeUpdate {@@ -30,6 +32,7 @@ export interface CustomTypeUpdate {icon?: stringcolor?: stringstatus?: 'draft' | 'published' | 'archived'+ category?: string}export interface ValidatePayload {diff --git a/flowsint-app/src/components/custom-types/type-preview.tsx b/flowsint-app/src/components/custom-types/type-preview.tsxindex 5116d1f6..96cd2ebf 100644--- a/flowsint-app/src/components/custom-types/type-preview.tsx+++ b/flowsint-app/src/components/custom-types/type-preview.tsx@@ -9,9 +9,18 @@ interface TypePreviewProps {color: stringfields: SchemaField[]status: 'draft' | 'published'+ category: string}-export function TypePreview({ name, description, icon, color, fields, status }: TypePreviewProps) {+export function TypePreview({+ name,+ description,+ icon,+ color,+ fields,+ status,+ category+}: TypePreviewProps) {const Icon = (LucideIcons as any)[icon] || LucideIcons.FileQuestionconst validFields = fields.filter((f) => f.key.trim())diff --git a/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsxindex 2545a887..16186937 100644--- a/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx+++ b/flowsint-app/src/routes/_auth.dashboard.custom-types.$typeId.tsx@@ -22,6 +22,7 @@ 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'+import { useActionItems } from '@/hooks/use-action-items'export const Route = createFileRoute('/_auth/dashboard/custom-types/$typeId')({component: CustomTypeEditor@@ -40,11 +41,15 @@ function CustomTypeEditor() {const [name, setName] = useState('')const [description, setDescription] = useState('')const [status, setStatus] = useState<'draft' | 'published'>('draft')+ const [category, setCategory] = useState<string>('custom_types_category')const [icon, setIcon] = useState(DEFAULT_ICON)const [color, setColor] = useState(DEFAULT_COLOR)const [fields, setFields] = useState<SchemaField[]>([])const [showPreview, setShowPreview] = useState(true)+ // Hooks+ const { actionItems, isLoading: actionLoading } = useActionItems()+// Load existing type if editingconst { data: existingType, isLoading } = useQuery<CustomType>({queryKey: ['custom-type', id],@@ -57,6 +62,7 @@ function CustomTypeEditor() {setName(existingType.name)setDescription(existingType.description || '')setStatus(existingType.status === 'archived' ? 'draft' : existingType.status)+ setCategory(existingType.category || 'custom_types_category')setIcon(existingType.icon || DEFAULT_ICON)setColor(existingType.color || DEFAULT_COLOR)parseSchemaToFields(existingType.schema)@@ -179,7 +185,8 @@ function CustomTypeEditor() {schema: fieldsToSchema(),icon,color,- status+ status,+ category}if (isNew) {@@ -287,27 +294,45 @@ function CustomTypeEditor() {/></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 className="flex flex-col gap-3 items-end">+ <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 className="flex items-center gap-3">+ <span className="text-xs text-muted-foreground/60">Category</span>+ <Select value={category} onValueChange={(v: any) => setCategory(v)}>+ <SelectTrigger className="w-[130px] h-7 text-xs border-border/40 bg-transparent">+ <SelectValue />+ </SelectTrigger>+ <SelectContent>+ {!actionLoading &&+ actionItems.map((item) => (+ <SelectItem value={item.type}>+ <div className="flex items-center gap-2">{item.label}</div>+ </SelectItem>+ ))}+ </SelectContent>+ </Select>+ </div></div></div><Separator className="opacity-40" />@@ -400,6 +425,7 @@ function CustomTypeEditor() {color={color}fields={fields}status={status}+ category={category}/></div></div>diff --git a/flowsint-core/src/flowsint_core/core/models.py b/flowsint-core/src/flowsint_core/core/models.pyindex bb7ba5f8..6fc436cc 100644--- a/flowsint-core/src/flowsint_core/core/models.py+++ b/flowsint-core/src/flowsint_core/core/models.py@@ -361,6 +361,9 @@ class CustomType(Base):icon: Mapped[str] = mapped_column(String, nullable=True)color: Mapped[str] = mapped_column(String, nullable=True)status: Mapped[str] = mapped_column(String, server_default="draft", nullable=False)+ category: Mapped[str] = mapped_column(+ String, server_default="Custom types", nullable=False+ )checksum: Mapped[str] = mapped_column(String, nullable=True)description: Mapped[str] = mapped_column(Text, nullable=True)created_at = mapped_column(DateTime(timezone=True), server_default=func.now())diff --git a/flowsint-core/src/flowsint_core/core/services/custom_type_service.py b/flowsint-core/src/flowsint_core/core/services/custom_type_service.pyindex e49dd183..987c934f 100644--- a/flowsint-core/src/flowsint_core/core/services/custom_type_service.py+++ b/flowsint-core/src/flowsint_core/core/services/custom_type_service.py@@ -48,6 +48,7 @@ class CustomTypeService(BaseService):user_id: UUID,description: Optional[str] = None,status: str = "draft",+ category: str = "Custom types",validate_schema_func=None,calculate_checksum_func=None,) -> CustomType:@@ -68,6 +69,7 @@ class CustomTypeService(BaseService):schema=json_schema,description=description,status=status,+ category=category,checksum=checksum,)@@ -85,6 +87,7 @@ class CustomTypeService(BaseService):json_schema: Optional[Dict[str, Any]] = None,description: Optional[str] = None,status: Optional[str] = None,+ category: Optional[str] = None,color: Optional[str] = None,icon: Optional[str] = None,validate_schema_func=None,@@ -111,6 +114,9 @@ class CustomTypeService(BaseService):if status is not None:custom_type.status = status+ if category is not None:+ custom_type.category = category+if icon is not None:custom_type.icon = icondiff --git a/flowsint-core/src/flowsint_core/core/services/type_registry_service.py b/flowsint-core/src/flowsint_core/core/services/type_registry_service.pyindex 0ab4d73e..5dc24814 100644--- a/flowsint-core/src/flowsint_core/core/services/type_registry_service.py+++ b/flowsint-core/src/flowsint_core/core/services/type_registry_service.py@@ -200,29 +200,34 @@ class TypeRegistryService(BaseService):else "value")- custom_types_children.append(- {- "id": custom_type.id,- "type": custom_type.name,- "key": custom_type.name.lower(),- "label_key": label_key,- "icon": custom_type.icon or "custom",- "color": custom_type.color,- "label": custom_type.name,- "description": custom_type.description or "",- "fields": [- {- "name": prop,- "label": info.get("title", prop),- "description": info.get("description", ""),- "type": "text",- "required": prop in required,- }- for prop, info in properties.items()- ],- "custom": True,- }- )+ custom_type_obj = {+ "id": custom_type.id,+ "type": custom_type.category or "custom_types_category",+ "key": custom_type.name.lower(),+ "label_key": label_key,+ "icon": custom_type.icon or "custom",+ "color": custom_type.color,+ "label": custom_type.name,+ "description": custom_type.description or "",+ "fields": [+ {+ "name": prop,+ "label": info.get("title", prop),+ "description": info.get("description", ""),+ "type": "text",+ "required": prop in required,+ }+ for prop, info in properties.items()+ ],+ "custom": True,+ }++ if custom_type.category == "custom_types_category":+ custom_types_children.append(custom_type_obj)+ else:+ for t in types:+ if t["type"] == custom_type.category:+ t["children"].append(custom_type_obj)types.append({@@ -435,7 +440,11 @@ class TypeRegistryService(BaseService):):return True# Direct array (non-optional)- if schema.get("type") == "array" and isinstance(schema.get("items"), dict) and schema["items"].get("type") == "string":+ if (+ schema.get("type") == "array"+ and isinstance(schema.get("items"), dict)+ and schema["items"].get("type") == "string"+ ):return Truereturn Falsediff --git a/uv.lock b/uv.lockindex 2651c287..d0d46c08 100644--- a/uv.lock+++ b/uv.lock@@ -1205,7 +1205,6 @@ dependencies = [{ name = "python-dotenv" },{ name = "python-jose", extra = ["cryptography"] },{ name = "python-multipart" },- { name = "pyyaml" },{ name = "redis" },{ name = "requests" },{ name = "sqlalchemy" },@@ -1244,7 +1243,6 @@ requires-dist = [{ name = "python-dotenv", specifier = ">=1.0,<2.0" },{ name = "python-jose", extras = ["cryptography"], specifier = ">=3.3,<4.0" },{ name = "python-multipart", specifier = ">=0.0.27,<0.1.0" },- { name = "pyyaml", specifier = ">=6.0,<7.0" },{ name = "redis", specifier = ">=5.0,<6.0" },{ name = "requests", specifier = ">=2.31,<3.0" },{ name = "sqlalchemy", specifier = ">=2.0,<3.0" },