mirror of
https://github.com/reconurge/flowsint.git
synced 2026-11-18 06:35:56 -06:00
feat: toggle details on currentNode
This commit is contained in:
@@ -199,6 +199,7 @@ def extract_input_schema(model: Type[BaseModel], label_key:str, icon: Optional[s
|
||||
"label_key": label_key,
|
||||
"icon": icon or type_name.lower(),
|
||||
"label": type_name,
|
||||
"description": details.get("description",""),
|
||||
"fields": [resolve_field(prop, details=info, schema=schema)
|
||||
for prop, info in details.get("properties", {}).items()
|
||||
]
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
from sqlalchemy.orm import DeclarativeBase
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
@@ -1,16 +1,16 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import (
|
||||
String, Text, DateTime, ForeignKey,
|
||||
Index, func, JSON, Column, Enum as SQLEnum
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import UUID as PGUUID, ARRAY, JSONB
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from .base import Base
|
||||
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column, relationship
|
||||
from app.core.enums import EventLevel
|
||||
|
||||
class Base(DeclarativeBase):
|
||||
pass
|
||||
|
||||
|
||||
class Feedback(Base):
|
||||
__tablename__ = "feedbacks"
|
||||
|
||||
@@ -1,14 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<svg width="800px" height="800px" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<!-- Document outline with folded corner -->
|
||||
<rect x="8" y="8" width="40" height="48" rx="4" fill="none" stroke="white" stroke-width="4"/>
|
||||
<!-- <polyline points="40,8 56,8 56,24" fill="none" stroke="white" stroke-width="4"/> -->
|
||||
<!-- <polyline points="56,8 40,24 40,8" fill="none" stroke="white" stroke-width="4"/> -->
|
||||
<!-- Horizontal lines representing text -->
|
||||
<rect x="16" y="20" width="24" height="2.5" rx="1.25" fill="white"/>
|
||||
<rect x="16" y="26" width="24" height="2.5" rx="1.25" fill="white"/>
|
||||
<rect x="16" y="32" width="24" height="2.5" rx="1.25" fill="white"/>
|
||||
<rect x="16" y="38" width="24" height="2.5" rx="1.25" fill="white"/>
|
||||
<!-- ASN text at the bottom -->
|
||||
<text x="32" y="52" text-anchor="middle" font-family="Arial, Helvetica, sans-serif" font-size="10" font-weight="bold" fill="white">ASN</text>
|
||||
</svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-digit-icon lucide-file-digit"><path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><rect width="4" height="6" x="2" y="12" rx="2"/><path d="M10 12h2v6"/><path d="M10 18h4"/></svg>
|
||||
|
Before Width: | Height: | Size: 983 B After Width: | Height: | Size: 424 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-code2-icon lucide-file-code-2"><path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="m5 12-3 3 3 3"/><path d="m9 18 3-3-3-3"/></svg>
|
||||
|
After Width: | Height: | Size: 385 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-digit-icon lucide-file-digit"><path d="M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><rect width="4" height="6" x="2" y="12" rx="2"/><path d="M10 12h2v6"/><path d="M10 18h4"/></svg>
|
||||
|
After Width: | Height: | Size: 424 B |
@@ -1 +1 @@
|
||||
<?xml version="1.0"?><svg height="24" version="1.1" width="24" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><g transform="translate(0 -1028.4)"><path d="m5 1030.4c-1.1046 0-2 0.9-2 2v8 4 6c0 1.1 0.8954 2 2 2h14c1.105 0 2-0.9 2-2v-6-4-4l-6-6h-10z" fill="#95a5a6"/><path d="m5 1029.4c-1.1046 0-2 0.9-2 2v8 4 6c0 1.1 0.8954 2 2 2h14c1.105 0 2-0.9 2-2v-6-4-4l-6-6h-10z" fill="#bdc3c7"/><rect fill="#95a5a6" height="14" transform="translate(0 1028.4)" width="2" x="7" y="5"/><path d="m7 4c-0.5523 0-1 0.4477-1 1v2 1 2 1 2 1 2 1 2c0 0.552 0.4477 1 1 1h2 1 3 1 3c0.552 0 1-0.448 1-1v-2-1-2-3-3-1-2c0-0.5523-0.448-1-1-1h-3-1-4-2zm0 1h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2zm-7 3h2v2h-2v-2zm3 0h3v2h-3v-2zm4 0h3v2h-3v-2z" fill="#7f8c8d" transform="translate(0 1028.4)"/><path d="m21 1035.4-6-6v4c0 1.1 0.895 2 2 2h4z" fill="#95a5a6"/></g></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 333 B |
@@ -228,32 +228,32 @@ function FloatingChat() {
|
||||
</div> */}
|
||||
<div className="space-y-2 max-w-sm">
|
||||
<h3 className="text-lg font-semibold text-foreground">
|
||||
Start your conversation
|
||||
Start your conversation with <span className="text-primary">Flo</span>
|
||||
</h3>
|
||||
<p className="text-sm opacity-70">
|
||||
Ask me anything about your investigation. Here are some examples:
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-6 space-y-3 max-w-md">
|
||||
<div className="text-xs opacity-60 space-y-1">
|
||||
<p className="font-medium">Analysis & Insights:</p>
|
||||
<ul className="space-y-1 text-left">
|
||||
<div className="text-xs space-y-1">
|
||||
<p className="font-medium text-left">Analysis & Insights</p>
|
||||
<ul className="space-y-1 text-left opacity-60">
|
||||
<li>• "Analyze the connections between these entities"</li>
|
||||
<li>• "What patterns do you see in this data?"</li>
|
||||
<li>• "Summarize the key findings from this investigation"</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="text-xs opacity-60 space-y-1">
|
||||
{/* <div className="text-xs opacity-60 space-y-1">
|
||||
<p className="font-medium">Data Exploration:</p>
|
||||
<ul className="space-y-1 text-left">
|
||||
<li>• "Find all IP addresses related to this domain"</li>
|
||||
<li>• "Show me all crypto wallets connected to this address"</li>
|
||||
<li>• "What social media accounts are linked to this email?"</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div className="text-xs opacity-60 space-y-1">
|
||||
<p className="font-medium">Investigation Help:</p>
|
||||
<ul className="space-y-1 text-left">
|
||||
</div> */}
|
||||
<div className="text-xs space-y-1">
|
||||
<p className="font-medium text-left">Investigation Help</p>
|
||||
<ul className="space-y-1 text-left opacity-60">
|
||||
<li>• "Suggest next steps for this investigation"</li>
|
||||
<li>• "What should I look for next?"</li>
|
||||
<li>• "Help me organize this investigation"</li>
|
||||
|
||||
+4
-3
@@ -16,7 +16,7 @@ import { useIcon } from "@/hooks/use-icon"
|
||||
import { useLayoutStore } from "@/stores/layout-store"
|
||||
import { useActionItems } from "@/hooks/use-action-items"
|
||||
|
||||
export default function ActionDialog() {
|
||||
export default function AddItemDialog() {
|
||||
const handleOpenFormModal = useGraphStore(state => state.handleOpenFormModal)
|
||||
const currentNodeType = useGraphStore(state => state.currentNodeType)
|
||||
const setCurrentNode = useGraphStore(state => state.setCurrentNode)
|
||||
@@ -216,7 +216,7 @@ export default function ActionDialog() {
|
||||
<>Add {currentNodeType.label.toLowerCase()}</>
|
||||
)}
|
||||
</DialogTitle>
|
||||
<DialogDescription>Fill the required data.</DialogDescription>
|
||||
<DialogDescription>{currentNodeType?.description}</DialogDescription>
|
||||
{currentNodeType && (
|
||||
<div className="grow overflow-y-auto">
|
||||
<DynamicForm
|
||||
@@ -256,7 +256,8 @@ function ActionCard({ item, onSelect }: ActionCardProps) {
|
||||
<IconComponent style={{ color: item.color }} className={cn("h-12 w-12", item.color ? "" : "text-primary")} />
|
||||
</div>
|
||||
<div className="font-medium text-sm">{item.label}</div>
|
||||
{!item.children && <div className="text-sm mt-2 opacity-60">{item.fields.length} fields</div>}
|
||||
{!item.children && <div className="text-sm mt-2 opacity-60">{item.description}</div>}
|
||||
{!item.children && <Badge variant="outline" className="mt-2">{item.fields.length} fields</Badge>}
|
||||
{item.disabled && (
|
||||
<Badge variant="outline" className="mt-2 absolute top-2 left-2">
|
||||
Soon
|
||||
+27
-10
@@ -2,14 +2,16 @@ import { memo } from "react"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { CopyButton } from "@/components/copy"
|
||||
import { Check, Rocket, X, MousePointer } from "lucide-react"
|
||||
import LaunchTransform from "./launch-transform"
|
||||
import NodeActions from "./node-actions"
|
||||
import LaunchTransform from "../launch-transform"
|
||||
import NodeActions from "../node-actions"
|
||||
import { GraphNode } from "@/stores/graph-store"
|
||||
import { Button } from "../ui/button"
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../ui/tooltip"
|
||||
import { Button } from "../../ui/button"
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip"
|
||||
import { useIcon } from "@/hooks/use-icon"
|
||||
import { useParams } from "@tanstack/react-router"
|
||||
import NeighborsGraph from "./neighbors"
|
||||
import Relationships from "./relationships"
|
||||
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "../../ui/resizable"
|
||||
|
||||
export default function DetailsPanel({ node }: { node: GraphNode | null }) {
|
||||
const { id: sketchId } = useParams({ strict: false })
|
||||
@@ -30,9 +32,9 @@ export default function DetailsPanel({ node }: { node: GraphNode | null }) {
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="overflow-y-auto bg-card overflow-x-hidden w-full min-w-0 h-full min-h-0">
|
||||
<div className="flex flex-col h-full overflow-hidden bg-card">
|
||||
<ItemHero node={node} />
|
||||
<div className="flex items-center sticky w-full top-0 border-b justify-start px-4 py-2 gap-2 z-50">
|
||||
<div className="flex items-center bg-card sticky w-full top-0 border-b justify-start px-4 py-2 gap-2 z-1">
|
||||
<p className="text-md font-semibold truncate">{node.data?.label}</p>
|
||||
<div className="grow" />
|
||||
<div className="flex items-center">
|
||||
@@ -67,9 +69,24 @@ export default function DetailsPanel({ node }: { node: GraphNode | null }) {
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<KeyValueDisplay data={node.data} />
|
||||
<div className="h-[340px] p-3">
|
||||
<NeighborsGraph sketchId={sketchId as string} nodeId={node.id} />
|
||||
<div className="flex-1 min-h-0">
|
||||
<ResizablePanelGroup direction="vertical" className="h-full">
|
||||
<ResizablePanel defaultSize={30} minSize={20}>
|
||||
<div className="h-full overflow-auto">
|
||||
<KeyValueDisplay data={node.data} />
|
||||
</div>
|
||||
</ResizablePanel>
|
||||
<ResizableHandle />
|
||||
<ResizablePanel defaultSize={40} minSize={25}>
|
||||
<div className="h-full p-3">
|
||||
<NeighborsGraph sketchId={sketchId as string} nodeId={node.id} />
|
||||
</div>
|
||||
</ResizablePanel>
|
||||
<ResizableHandle />
|
||||
<ResizablePanel defaultSize={30} minSize={20}>
|
||||
<Relationships sketchId={sketchId as string} nodeId={node.id} />
|
||||
</ResizablePanel>
|
||||
</ResizablePanelGroup>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
@@ -133,7 +150,7 @@ const ItemHero = ({ node }: { node: GraphNode }) => {
|
||||
<p className="text-xl font-semibold truncate text-ellipsis">{node.data.label}</p>
|
||||
<p className="text-sm font-normal opacity-60 truncate text-ellipsis">{node.data.type}</p>
|
||||
</div>
|
||||
<ItemIcon size={70} />
|
||||
<ItemIcon size={50} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
+5
-2
@@ -1,6 +1,6 @@
|
||||
import { sketchService } from "@/api/sketch-service";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import ForceGraphViewer from "./graph-viewer";
|
||||
import ForceGraphViewer from "../graph-viewer";
|
||||
|
||||
const NeighborsGraph = ({ sketchId, nodeId }: { sketchId: string, nodeId: string }) => {
|
||||
|
||||
@@ -12,7 +12,10 @@ const NeighborsGraph = ({ sketchId, nodeId }: { sketchId: string, nodeId: string
|
||||
<div className="overflow-hidden bg-background border relative h-full w-full">
|
||||
{isLoading ? <div>Loading...</div> :
|
||||
<>
|
||||
<div className="top-2 left-2 absolute text-sm"><span className="font-semibold">{neighborsData.nds.length - 1}</span> <span className="opacity-70">neighbor(s)</span></div>
|
||||
<div className="top-0 left-0 bg-card/60 backdrop-blur z-10 p-1 rounded-br-lg absolute text-sm flex gap-1">
|
||||
<span className="font-semibold">{neighborsData.nds.length - 1}</span>
|
||||
<span className="opacity-70">neighbor(s)</span>
|
||||
</div>
|
||||
<ForceGraphViewer
|
||||
nodes={neighborsData.nds}
|
||||
edges={neighborsData.rls}
|
||||
+2
-2
@@ -8,12 +8,12 @@ import { Badge } from "@/components/ui/badge"
|
||||
import { Edit3, Save, X, Hash, Type, FileText, Check, Loader2 } from "lucide-react"
|
||||
import type { NodeData } from "@/types"
|
||||
import { useGraphStore } from "@/stores/graph-store"
|
||||
import { MapFromAddress } from "../map/map"
|
||||
import { MapFromAddress } from "../../map/map"
|
||||
import { sketchService } from "@/api/sketch-service"
|
||||
import { useParams } from "@tanstack/react-router"
|
||||
import { toast } from "sonner"
|
||||
import NeighborsGraph from "./neighbors"
|
||||
import { DraggableCard } from "./draggable-card"
|
||||
import { DraggableCard } from "../draggable-card"
|
||||
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
|
||||
import { useNodeEditorLayoutStore, type CardType } from "@/stores/node-editor-layout-store"
|
||||
import { Reorder } from "framer-motion"
|
||||
@@ -0,0 +1,94 @@
|
||||
import { sketchService } from '@/api/sketch-service';
|
||||
import Loader from '@/components/loader';
|
||||
import { TypeBadge } from '@/components/type-badge';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { GraphEdge, GraphNode, useGraphStore } from '@/stores/graph-store'
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { useVirtualizer } from '@tanstack/react-virtual';
|
||||
import { ArrowRight } from 'lucide-react';
|
||||
import { memo, useCallback, useRef } from 'react';
|
||||
|
||||
type Relation = {
|
||||
target: GraphNode,
|
||||
edge: { label: string }
|
||||
}
|
||||
|
||||
const getInlineRelationships = (nodes: GraphNode[], edges: GraphEdge[]): Relation[] => {
|
||||
const relationships: Relation[] = []
|
||||
edges.forEach((edge) => {
|
||||
const target = nodes.find((n) => (n.id === edge.target))
|
||||
if (!target) return
|
||||
relationships.push({ target, edge: { label: String(edge.caption || 'RELATED_TO') } })
|
||||
})
|
||||
return relationships
|
||||
}
|
||||
|
||||
const Relationships = ({ sketchId, nodeId }: { sketchId: string, nodeId: string }) => {
|
||||
const { data: neighborsData, isLoading } = useQuery({
|
||||
queryKey: ['neighbors', sketchId, nodeId],
|
||||
queryFn: () => sketchService.getNodeNeighbors(sketchId, nodeId),
|
||||
});
|
||||
|
||||
const parentRef = useRef<HTMLDivElement>(null);
|
||||
const relationships = getInlineRelationships(neighborsData?.nds || [], neighborsData?.rls || []);
|
||||
|
||||
const rowVirtualizer = useVirtualizer({
|
||||
count: relationships.length,
|
||||
getScrollElement: () => parentRef.current,
|
||||
estimateSize: () => 40, // Estimate height of each relationship item
|
||||
overscan: 5,
|
||||
});
|
||||
|
||||
if (isLoading) return <div className='flex items-center'><Loader /></div>
|
||||
|
||||
return (
|
||||
<div ref={parentRef} className="h-full overflow-auto py-3">
|
||||
<div
|
||||
style={{
|
||||
height: `${rowVirtualizer.getTotalSize()}px`,
|
||||
width: '100%',
|
||||
position: 'relative',
|
||||
}}
|
||||
>
|
||||
{rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
||||
const rel = relationships[virtualRow.index];
|
||||
return (
|
||||
<div
|
||||
key={virtualRow.index}
|
||||
style={{
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
left: 0,
|
||||
width: '100%',
|
||||
height: `${virtualRow.size}px`,
|
||||
transform: `translateY(${virtualRow.start}px)`,
|
||||
}}
|
||||
className="mb-1 px-3"
|
||||
>
|
||||
<Badge variant={"outline"} className='h-8 truncate justify-between text-ellipsis text-sm w-full'>
|
||||
<span className='opacity-60 truncate text-ellipsis'>{rel.edge.label}</span>
|
||||
<ArrowRight />
|
||||
<RelationshipItem node={rel.target} />
|
||||
</Badge>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Relationships
|
||||
|
||||
|
||||
const RelationshipItem = memo(({ node }: { node: GraphNode }) => {
|
||||
const setCurrentNode = useGraphStore(s => s.setCurrentNode)
|
||||
const handleClick = useCallback(() => {
|
||||
setCurrentNode(node)
|
||||
}, [setCurrentNode])
|
||||
return (
|
||||
<button onClick={handleClick}>
|
||||
<TypeBadge className='hover:underline cursor-pointer' type={node.data.type}>{node.data.label}</TypeBadge>
|
||||
</button>
|
||||
)
|
||||
})
|
||||
@@ -6,7 +6,7 @@ import { useGraphStore } from '@/stores/graph-store'
|
||||
const EmptyState = memo(() => {
|
||||
const setOpenMainDialog = useGraphStore(state => state.setOpenMainDialog)
|
||||
|
||||
const handleOpenNewActionDialog = useCallback(() => {
|
||||
const handleOpenNewAddItemDialog = useCallback(() => {
|
||||
setOpenMainDialog(true)
|
||||
}, [setOpenMainDialog])
|
||||
|
||||
@@ -74,7 +74,7 @@ const EmptyState = memo(() => {
|
||||
{/* Call to action */}
|
||||
<div className="flex flex-col items-center gap-3">
|
||||
<Button
|
||||
onClick={handleOpenNewActionDialog}
|
||||
onClick={handleOpenNewAddItemDialog}
|
||||
className="h-10 px-6 font-medium shadow-lg hover:shadow-xl transition-all duration-200 hover:scale-105"
|
||||
size="default"
|
||||
>
|
||||
|
||||
@@ -8,20 +8,20 @@ import { CreateRelationDialog } from './create-relation'
|
||||
import GraphLoader from './graph-loader'
|
||||
import Loader from '../loader'
|
||||
import { useGraphControls } from '@/stores/graph-controls-store'
|
||||
import { NodeEditorModal } from './node-editor-modal'
|
||||
import { NodeEditorModal } from './details-panel/node-editor-modal'
|
||||
import NodesTable from '../table'
|
||||
import { findActionItemByKey } from '@/lib/action-items'
|
||||
import { useActionItems } from '@/hooks/use-action-items'
|
||||
import { toast } from 'sonner'
|
||||
import MapPanel from '../map/map-panel'
|
||||
import NewActions from './new-actions'
|
||||
import NewActions from './add-item-dialog'
|
||||
import GraphSettings from './graph-settings'
|
||||
import GraphMain from './graph-main'
|
||||
const RelationshipsTable = lazy(() => import('@/components/table/relationships-view'))
|
||||
const Graph = lazy(() => import('./graph'))
|
||||
const Wall = lazy(() => import('./wall/wall'))
|
||||
// const Wall = lazy(() => import('./wall/wall'))
|
||||
|
||||
const NODE_COUNT_THRESHOLD = 2000;
|
||||
const NODE_COUNT_THRESHOLD = 1000;
|
||||
|
||||
// Separate component for the drag overlay
|
||||
const DragOverlay = memo(({ isDragging }: { isDragging: boolean }) => (
|
||||
@@ -57,7 +57,6 @@ const GraphPanel = ({ graphData, isLoading }: GraphPanelProps) => {
|
||||
const [isDraggingOver, setIsDraggingOver] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
updateGraphData([], [])
|
||||
if (graphData?.nds && graphData?.rls) {
|
||||
updateGraphData(graphData.nds, graphData.rls)
|
||||
}
|
||||
@@ -137,9 +136,9 @@ const GraphPanel = ({ graphData, isLoading }: GraphPanelProps) => {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{view === "hierarchy" && <Wall isLoading={false} isRefetching={false} />}
|
||||
{view === "force" && <GraphMain />}
|
||||
{/* {["force", "hierarchy"].includes(view) && <GraphMain />} */}
|
||||
{/* {view === "hierarchy" && <Wall isLoading={false} isRefetching={false} />} */}
|
||||
{/* {view === "force" && <GraphMain />} */}
|
||||
{["force", "hierarchy"].includes(view) && <GraphMain />}
|
||||
{view === "table" && <NodesTable />}
|
||||
{view === "map" && <MapPanel />}
|
||||
{view === "relationships" && <RelationshipsTable />}
|
||||
|
||||
@@ -177,7 +177,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
|
||||
const handleNodeClick = useCallback((node: any) => onNodeClick?.(node), [onNodeClick]);
|
||||
const handleNodeRightClick = useCallback((node: any, event: MouseEvent) => onNodeRightClick?.(node, event), [onNodeRightClick]);
|
||||
const handleBackgroundClick = useCallback(() => onBackgroundClick?.(), [onBackgroundClick]);
|
||||
const handleOpenNewActionDialog = useCallback(() => setOpenMainDialog(true), [setOpenMainDialog]);
|
||||
const handleOpenNewAddItemDialog = useCallback(() => setOpenMainDialog(true), [setOpenMainDialog]);
|
||||
|
||||
// Optimized node rendering
|
||||
const renderNode = useCallback((node: any, ctx: CanvasRenderingContext2D, globalScale: number) => {
|
||||
@@ -207,7 +207,6 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
|
||||
ctx.font = `${fontSize}px Sans-Serif`
|
||||
const bgHeight = CONSTANTS.NODE_FONT_SIZE + 2;
|
||||
const bgY = node.y + size / 2 + 1;
|
||||
|
||||
ctx.fillStyle = theme === "light" ? '#161616' : '#FFFFFF';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'middle';
|
||||
@@ -326,7 +325,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
|
||||
<p><strong>Tip:</strong> Use the search bar to find entities or import data to get started</p>
|
||||
<p><strong>Explore:</strong> Try searching for domains, emails, or other entities</p>
|
||||
</div>
|
||||
<Button onClick={handleOpenNewActionDialog}>
|
||||
<Button onClick={handleOpenNewAddItemDialog}>
|
||||
<svg className="w-4 h-4 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6v6m0 0v6m0-6h6m-6 0H6" />
|
||||
</svg>
|
||||
@@ -364,6 +363,9 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
|
||||
linkCurvature={link => link.curve}
|
||||
linkDirectionalParticles={link => link.__highlighted ? 2 : 0}
|
||||
nodeCanvasObject={renderNode}
|
||||
onNodeHover={(node => {
|
||||
|
||||
})}
|
||||
onNodeDragEnd={(node => {
|
||||
node.fx = node.x;
|
||||
node.fy = node.y;
|
||||
|
||||
@@ -16,7 +16,7 @@ export const ItemsPanel = memo(function LeftPanel() {
|
||||
setSearchQuery(e.target.value)
|
||||
}, [])
|
||||
|
||||
const handleOpenNewActionDialog = useCallback(() => {
|
||||
const handleOpenNewAddItemDialog = useCallback(() => {
|
||||
setOpenMainDialog(true)
|
||||
}, [setOpenMainDialog])
|
||||
|
||||
@@ -27,7 +27,7 @@ export const ItemsPanel = memo(function LeftPanel() {
|
||||
<div className="flex items-center gap-2 mb-3">
|
||||
<div>
|
||||
<Button
|
||||
onClick={handleOpenNewActionDialog}
|
||||
onClick={handleOpenNewAddItemDialog}
|
||||
className="h-7 !w-7"
|
||||
size="icon"
|
||||
variant={"ghost"}
|
||||
@@ -68,7 +68,7 @@ export const ItemsPanel = memo(function LeftPanel() {
|
||||
type={childItem.type}
|
||||
color={childItem.color}
|
||||
disabled={childItem.disabled}
|
||||
description={childItem.fields.map((n) => n.name).join(", ")}
|
||||
description={childItem.description}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -20,10 +20,8 @@ import {
|
||||
import type { GraphNode } from "@/stores/graph-store"
|
||||
import { Checkbox } from "@/components/ui/checkbox"
|
||||
|
||||
// Hauteur fixe pour chaque item (en pixels)
|
||||
const ITEM_HEIGHT = 40
|
||||
|
||||
// Function to extract all leaf-level node types from actionItems
|
||||
const getAllNodeTypes = (actionItems: any[]) => {
|
||||
const types: string[] = []
|
||||
actionItems.forEach(item => {
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"
|
||||
import { useConfirm } from "@/components/use-confirm-dialog"
|
||||
import { useGraphControls } from "@/stores/graph-controls-store"
|
||||
import { useGraphStore } from "@/stores/graph-store"
|
||||
import {
|
||||
Maximize,
|
||||
Minus,
|
||||
Trash,
|
||||
ZoomIn,
|
||||
RotateCw,
|
||||
GitPullRequestCreate,
|
||||
// GitFork,
|
||||
Waypoints,
|
||||
Table,
|
||||
MapPin,
|
||||
List,
|
||||
SlidersHorizontal,
|
||||
@@ -21,11 +15,8 @@ import {
|
||||
ArrowRightLeft
|
||||
} from "lucide-react"
|
||||
import { memo, useCallback } from "react"
|
||||
import { sketchService } from "@/api/sketch-service"
|
||||
import { useParams } from "@tanstack/react-router"
|
||||
import { toast } from "sonner"
|
||||
import { cn } from "@/lib/utils"
|
||||
// import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
|
||||
import ForceControls from './force-controls'
|
||||
|
||||
const isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0
|
||||
@@ -65,20 +56,13 @@ const ToolbarButton = memo(function ToolbarButton({
|
||||
)
|
||||
})
|
||||
export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean }) {
|
||||
const { id: sketchId } = useParams({ from: "/_auth/dashboard/investigations/$investigationId/$type/$id" })
|
||||
const selectedNodes = useGraphStore((state) => state.selectedNodes || [])
|
||||
const view = useGraphControls(s => s.view)
|
||||
const setOpenAddRelationDialog = useGraphStore((state) => state.setOpenAddRelationDialog)
|
||||
const setView = useGraphControls((s) => s.setView)
|
||||
const removeNodes = useGraphStore((state) => state.removeNodes)
|
||||
const zoomToFit = useGraphControls((s) => s.zoomToFit);
|
||||
const zoomIn = useGraphControls((s) => s.zoomIn);
|
||||
const zoomOut = useGraphControls((s) => s.zoomOut);
|
||||
const onLayout = useGraphControls((s) => s.onLayout);
|
||||
const { confirm } = useConfirm()
|
||||
const refetchGraph = useGraphControls((s) => s.refetchGraph)
|
||||
const clearSelectedNodes = useGraphStore((s) => s.clearSelectedNodes)
|
||||
// const nodesLength = useGraphStore((s) => s.getNodesLength())
|
||||
|
||||
const handleRefresh = useCallback(() => {
|
||||
try {
|
||||
@@ -89,32 +73,6 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
|
||||
}
|
||||
}, [refetchGraph, onLayout]);
|
||||
|
||||
const handleOpenRelationshipDialog = useCallback(() => {
|
||||
setOpenAddRelationDialog(true)
|
||||
}, [])
|
||||
|
||||
const handleDeleteNodes = useCallback(async () => {
|
||||
if (!selectedNodes.length) return
|
||||
if (!await confirm({ title: `You are about to delete ${selectedNodes.length} node(s).`, message: "The action is irreversible." })) return
|
||||
|
||||
toast.promise(
|
||||
(async () => {
|
||||
removeNodes(selectedNodes.map((n) => n.id))
|
||||
clearSelectedNodes()
|
||||
return sketchService.deleteNodes(sketchId, JSON.stringify({ nodeIds: selectedNodes.map((n) => n.id) }))
|
||||
})(),
|
||||
{
|
||||
loading: `Deleting ${selectedNodes.length} node(s)...`,
|
||||
success: 'Nodes deleted successfully.',
|
||||
error: 'Failed to delete nodes.'
|
||||
}
|
||||
)
|
||||
}, [selectedNodes, confirm, removeNodes, clearSelectedNodes, sketchId])
|
||||
const isMoreThanZero = selectedNodes.length > 0
|
||||
const isTwo = selectedNodes.length == 2
|
||||
// const isGraphOnly = nodesLength > 500
|
||||
// const isCosmoOnly = nodesLength > 3000
|
||||
|
||||
const handleForceLayout = useCallback(() => {
|
||||
setView("force")
|
||||
}, [setView])
|
||||
@@ -136,60 +94,28 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
|
||||
onLayout && onLayout("dagre-tb")
|
||||
}, [onLayout, setView])
|
||||
|
||||
// const handleDagreLayoutLR = useCallback(() => {
|
||||
// setView("hierarchy")
|
||||
// onLayout && onLayout("dagre-lr")
|
||||
// }, [onLayout, setView])
|
||||
|
||||
// const { isMac } = useKeyboardShortcut({
|
||||
// key: "y",
|
||||
// ctrlOrCmd: true,
|
||||
// callback: handleDagreLayoutTB
|
||||
// })
|
||||
|
||||
return (
|
||||
<div className="flex justify-start gap-2 items-center">
|
||||
<TooltipProvider>
|
||||
{/* <ToolbarButton
|
||||
onClick={handleOpenRelationshipDialog}
|
||||
icon={<GitPullRequestCreate className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Create relation"
|
||||
disabled={!isTwo}
|
||||
< ToolbarButton
|
||||
icon={<ZoomIn className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Zoom In"
|
||||
onClick={zoomIn}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
<ToolbarButton
|
||||
onClick={handleDeleteNodes}
|
||||
icon={<Trash className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Delete"
|
||||
disabled={!isMoreThanZero}
|
||||
badge={isMoreThanZero ? selectedNodes.length : null}
|
||||
/> */}
|
||||
{/* <ToolbarButton disabled icon={<Filter className="h-4 w-4 opacity-70" />} tooltip="Filter" /> */}
|
||||
<>
|
||||
< ToolbarButton
|
||||
icon={<ZoomIn className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Zoom In"
|
||||
onClick={zoomIn}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
<ToolbarButton
|
||||
icon={<Minus className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Zoom Out"
|
||||
onClick={zoomOut}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
<ToolbarButton
|
||||
icon={<Maximize className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Fit to View"
|
||||
onClick={zoomToFit}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
</>
|
||||
{/* <ToolbarButton
|
||||
icon={<GitFork className="h-4 w-4 opacity-70 rotate-90" />}
|
||||
tooltip={isGraphOnly ? "Graph is too large to render in hierarchy layout" : `Hierarchy (${isMac ? '⌘' : 'ctrl'}+Y)`}
|
||||
onClick={handleDagreLayoutLR}
|
||||
disabled={isGraphOnly}
|
||||
/> */}
|
||||
icon={<Minus className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Zoom Out"
|
||||
onClick={zoomOut}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
<ToolbarButton
|
||||
icon={<Maximize className="h-4 w-4 opacity-70" />}
|
||||
tooltip="Fit to View"
|
||||
onClick={zoomToFit}
|
||||
disabled={["table", "relationships"].includes(view)}
|
||||
/>
|
||||
|
||||
<ToolbarButton
|
||||
icon={<GitFork className="h-4 w-4 opacity-70 rotate-180" />}
|
||||
tooltip={`Hierarchy (${isMac ? '⌘' : 'ctrl'}+Y)`}
|
||||
@@ -199,7 +125,6 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
|
||||
icon={<Waypoints className="h-4 w-4 opacity-70" />}
|
||||
tooltip={"Graph view"}
|
||||
onClick={handleForceLayout}
|
||||
// disabled={isCosmoOnly}
|
||||
/>
|
||||
<ToolbarButton
|
||||
icon={<List className="h-4 w-4 opacity-70" />}
|
||||
@@ -216,13 +141,6 @@ export const Toolbar = memo(function Toolbar({ isLoading }: { isLoading: boolean
|
||||
tooltip={"Map view"}
|
||||
onClick={handleMapLayout}
|
||||
/>
|
||||
{/* <ToolbarButton
|
||||
icon={<Rotate3D className="h-4 w-4 opacity-70" />}
|
||||
tooltip={"3D Graph"}
|
||||
onClick={handleForce3DLayout}
|
||||
disabled={isCosmoOnly}
|
||||
/> */}
|
||||
{/* <ToolbarButton onClick={toggleSettings} icon={<Settings className="h-4 w-4 opacity-70" />} tooltip="Settings" /> */}
|
||||
<ToolbarButton
|
||||
onClick={handleRefresh}
|
||||
disabled={isLoading}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
// import { useCallback, useRef } from 'react';
|
||||
|
||||
// export interface ForceGraphControls {
|
||||
// zoomIn: () => void;
|
||||
// zoomOut: () => void;
|
||||
// zoomToFit: () => void;
|
||||
// resetZoom: () => void;
|
||||
// }
|
||||
|
||||
// export const useForceGraphControls = () => {
|
||||
// const graphRef = useRef<any>();
|
||||
|
||||
// const setGraphRef = useCallback((ref: any) => {
|
||||
// graphRef.current = ref;
|
||||
// }, []);
|
||||
|
||||
// const zoomIn = useCallback(() => {
|
||||
// if (graphRef.current) {
|
||||
// const zoom = graphRef.current.zoom();
|
||||
// graphRef.current.zoom(zoom * 1.5);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// const zoomOut = useCallback(() => {
|
||||
// if (graphRef.current) {
|
||||
// const zoom = graphRef.current.zoom();
|
||||
// graphRef.current.zoom(zoom * 0.75);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// const zoomToFit = useCallback(() => {
|
||||
// if (graphRef.current) {
|
||||
// graphRef.current.zoomToFit(400);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// const resetZoom = useCallback(() => {
|
||||
// if (graphRef.current) {
|
||||
// graphRef.current.zoom(1);
|
||||
// graphRef.current.centerAt(0, 0);
|
||||
// }
|
||||
// }, []);
|
||||
|
||||
// const controls: ForceGraphControls = {
|
||||
// zoomIn,
|
||||
// zoomOut,
|
||||
// zoomToFit,
|
||||
// resetZoom,
|
||||
// };
|
||||
|
||||
// return {
|
||||
// controls,
|
||||
// setGraphRef,
|
||||
// };
|
||||
// };
|
||||
@@ -1,4 +1,4 @@
|
||||
import { type ReactNode } from "react"
|
||||
import { useEffect, type ReactNode } from "react"
|
||||
import { Sidebar } from "./sidebar"
|
||||
import { TopNavbar } from "./top-navbar"
|
||||
import { StatusBar } from "./status-bar"
|
||||
@@ -10,7 +10,7 @@ import { useLayoutStore } from "@/stores/layout-store"
|
||||
// import NotesPanel from "../analyses/notes-panel"
|
||||
import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
|
||||
import { useParams } from "@tanstack/react-router"
|
||||
import DetailsPanel from "../graphs/details-panel"
|
||||
import DetailsPanel from "../graphs/details-panel/details-panel"
|
||||
import { useGraphStore } from "@/stores/graph-store"
|
||||
|
||||
interface LayoutProps {
|
||||
@@ -27,11 +27,18 @@ export default function RootLayout({ children }: LayoutProps) {
|
||||
const togglePanel = useLayoutStore(s => s.togglePanel)
|
||||
const closePanel = useLayoutStore(s => s.closePanel)
|
||||
const openPanel = useLayoutStore(s => s.openPanel)
|
||||
const toggleAnalysis = useLayoutStore(s => s.toggleAnalysis)
|
||||
const closeAnalysis = useLayoutStore(s => s.closeAnalysis)
|
||||
const openAnalysis = useLayoutStore(s => s.openAnalysis)
|
||||
const closeDetails = useLayoutStore(s => s.closeDetails)
|
||||
const openDetails = useLayoutStore(s => s.openDetails)
|
||||
const currentNode = useGraphStore((s) => s.currentNode)
|
||||
const { investigationId, id } = useParams({ strict: false })
|
||||
const { id } = useParams({ strict: false })
|
||||
|
||||
useEffect(() => {
|
||||
if (!currentNode) {
|
||||
closeDetails()
|
||||
return
|
||||
}
|
||||
openDetails()
|
||||
}, [currentNode])
|
||||
|
||||
|
||||
// Set up keyboard shortcut for chat panel
|
||||
@@ -102,7 +109,7 @@ export default function RootLayout({ children }: LayoutProps) {
|
||||
<ResizablePanel className="h-full w-full" id="children" order={3}>
|
||||
{children}
|
||||
</ResizablePanel>
|
||||
{isOpenDetails && id && (
|
||||
{isOpenDetails && id && currentNode && (
|
||||
<>
|
||||
<ResizableHandle withHandle />
|
||||
<ResizablePanel
|
||||
@@ -111,8 +118,8 @@ export default function RootLayout({ children }: LayoutProps) {
|
||||
defaultSize={20}
|
||||
minSize={16}
|
||||
maxSize={40}
|
||||
onCollapse={closeAnalysis}
|
||||
onExpand={openAnalysis}
|
||||
onCollapse={closeDetails}
|
||||
onExpand={openDetails}
|
||||
collapsible={true}
|
||||
collapsedSize={2}
|
||||
>
|
||||
|
||||
@@ -69,12 +69,14 @@ export default function NodesTable({ nodes }: NodesTableProps) {
|
||||
const [selectedType, setSelectedType] = useState<string>("all");
|
||||
const parentRef = useRef<HTMLDivElement>(null);
|
||||
const setCurrentNode = useGraphStore(s => s.setCurrentNode)
|
||||
const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal)
|
||||
// const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal)
|
||||
|
||||
const onNodeClick = useCallback((node: GraphNode) => {
|
||||
setCurrentNode(node)
|
||||
setOpenNodeEditorModal(true)
|
||||
}, [setCurrentNode, setOpenNodeEditorModal])
|
||||
// setOpenNodeEditorModal(true)
|
||||
}, [setCurrentNode,
|
||||
// setOpenNodeEditorModal
|
||||
])
|
||||
|
||||
|
||||
// Filter nodes based on search and type
|
||||
|
||||
@@ -18,12 +18,7 @@ import {
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { CopyButton } from "../copy";
|
||||
|
||||
export type RelationshipType = {
|
||||
source: GraphNode
|
||||
target: GraphNode
|
||||
edge: { label: string }
|
||||
}
|
||||
import { RelationshipType } from "@/types";
|
||||
|
||||
const ITEM_HEIGHT = 67; // Balanced spacing between items (55px card + 12px padding)
|
||||
|
||||
@@ -104,12 +99,14 @@ export default function RelationshipsTable() {
|
||||
const [selectedType, setSelectedType] = useState<string>("all");
|
||||
const parentRef = useRef<HTMLDivElement>(null);
|
||||
const setCurrentNode = useGraphStore(s => s.setCurrentNode)
|
||||
const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal)
|
||||
// const setOpenNodeEditorModal = useGraphStore(s => s.setOpenNodeEditorModal)
|
||||
|
||||
const onNodeClick = useCallback((node: GraphNode) => {
|
||||
setCurrentNode(node)
|
||||
setOpenNodeEditorModal(true)
|
||||
}, [setCurrentNode, setOpenNodeEditorModal])
|
||||
// setOpenNodeEditorModal(true)
|
||||
}, [setCurrentNode,
|
||||
// setOpenNodeEditorModal
|
||||
])
|
||||
|
||||
|
||||
// Filter relationships based on search and type
|
||||
|
||||
@@ -35,11 +35,18 @@ export default function ContextMenu({
|
||||
}: GraphContextMenuProps) {
|
||||
|
||||
const setOpenParamsDialog = useTransformStore(s => s.setOpenParamsDialog)
|
||||
const deleteNode = useTransformStore(s => s.deleteNode)
|
||||
|
||||
const handleOpenParamsModal = useCallback(() => {
|
||||
setOpenParamsDialog(true, node as TransformNode)
|
||||
setMenu(null)
|
||||
}, [setOpenParamsDialog, node, setMenu])
|
||||
|
||||
const handleDeleteTransform = useCallback(() => {
|
||||
deleteNode(node.id as string)
|
||||
setMenu(null)
|
||||
}, [deleteNode, node.id, setMenu])
|
||||
|
||||
return (
|
||||
<BaseContextMenu
|
||||
node={node}
|
||||
@@ -66,6 +73,7 @@ export default function ContextMenu({
|
||||
<Pencil className="h-4 w-4 opacity-60" /> Edit
|
||||
</button>
|
||||
<button
|
||||
onClick={handleDeleteTransform}
|
||||
className="w-full flex items-center gap-2 p-2 rounded-sm hover:bg-muted text-left transition-colors"
|
||||
>
|
||||
<Trash className="h-4 w-4 text-red-500 opacity-60" /> Delete
|
||||
|
||||
@@ -314,8 +314,8 @@ const TransformEditorFlow = memo(({ initialEdges, initialNodes, theme, transform
|
||||
if (!transformId) return
|
||||
if (
|
||||
await confirm({
|
||||
title: "Are you sure you want to delete this simulation?",
|
||||
message: "This action is irreversible.",
|
||||
title: "Are you sure you want to delete this flow ?",
|
||||
message: "All of the transforms settings will be lost.",
|
||||
})
|
||||
) {
|
||||
setLoading(true)
|
||||
@@ -603,7 +603,6 @@ const TransformEditorFlow = memo(({ initialEdges, initialNodes, theme, transform
|
||||
fdff</div>
|
||||
</ContextMenu>}
|
||||
<MiniMap className="bg-background" position="bottom-left" pannable zoomable />
|
||||
|
||||
</ReactFlow>
|
||||
</div>
|
||||
<TransformSheet onLayout={onLayout} />
|
||||
|
||||
@@ -6,9 +6,10 @@ import { memo } from "react"
|
||||
type TypeBadgeProps = {
|
||||
type: string
|
||||
className?: string
|
||||
children?: React.ReactNode
|
||||
}
|
||||
|
||||
function TypeBadgeComponent({ type, className }: TypeBadgeProps) {
|
||||
function TypeBadgeComponent({ type, children, className }: TypeBadgeProps) {
|
||||
const colors = useNodesDisplaySettings(s => s.colors)
|
||||
const color = colors[type as keyof typeof colors] || "bg-gray-100 text-gray-800 hover:bg-gray-100/80 dark:bg-gray-800/50 dark:text-gray-300 dark:hover:bg-gray-800/60"
|
||||
return (
|
||||
@@ -17,7 +18,7 @@ function TypeBadgeComponent({ type, className }: TypeBadgeProps) {
|
||||
style={{ backgroundColor: hexToRgba(color, .5) }}
|
||||
className={cn("font-medium border-transparent", className)}
|
||||
>
|
||||
{type}
|
||||
{children ?? type}
|
||||
</Badge>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export interface ActionItem {
|
||||
disabled?: boolean
|
||||
comingSoon?: boolean
|
||||
children?: ActionItem[]
|
||||
description: string
|
||||
}
|
||||
|
||||
export function findActionItemByKey(key: string, actionItems: ActionItem[] | undefined): ActionItem | undefined {
|
||||
|
||||
+7
@@ -6,6 +6,7 @@ import Loader from '@/components/loader'
|
||||
import { analysisService } from '@/api/analysis-service'
|
||||
import { AnalysisPage } from '@/components/analyses/analysis-page'
|
||||
import { useGraphControls } from '@/stores/graph-controls-store'
|
||||
import { useGraphStore } from '@/stores/graph-store'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
const services = {
|
||||
@@ -15,6 +16,7 @@ const services = {
|
||||
|
||||
const GraphPageContent = () => {
|
||||
const setActions = useGraphControls((s) => s.setActions)
|
||||
const reset = useGraphStore((s) => s.reset)
|
||||
const { params: { type, id, investigationId }, sketch } = useLoaderData({
|
||||
from: '/_auth/dashboard/investigations/$investigationId/$type/$id',
|
||||
})
|
||||
@@ -28,6 +30,11 @@ const GraphPageContent = () => {
|
||||
initialData: sketch
|
||||
})
|
||||
|
||||
// Reset graph store when sketchId changes or is null
|
||||
useEffect(() => {
|
||||
reset()
|
||||
}, [id, reset])
|
||||
|
||||
useEffect(() => {
|
||||
setActions({ refetchGraph: refetch })
|
||||
}, [refetch, setActions, id])
|
||||
|
||||
@@ -18,7 +18,7 @@ export type GraphNode = Node<NodeData> & {
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
export type GraphEdge = Edge<EdgeData>
|
||||
export type GraphEdge = Edge<EdgeData> & { caption?: string }
|
||||
|
||||
interface GraphState {
|
||||
// === Graph ===
|
||||
@@ -36,6 +36,7 @@ interface GraphState {
|
||||
onNodesChange: OnNodesChange
|
||||
onEdgesChange: OnEdgesChange
|
||||
onConnect: OnConnect
|
||||
reset: () => void
|
||||
|
||||
// === Selection & Current ===
|
||||
currentNode: GraphNode | null
|
||||
@@ -167,6 +168,21 @@ export const useGraphStore = create<GraphState>()((set, get) => ({
|
||||
edges: [...get().edges, edge],
|
||||
})
|
||||
},
|
||||
reset: () => {
|
||||
set({
|
||||
// nodes: [],
|
||||
// edges: [],
|
||||
currentNode: null,
|
||||
selectedNodes: [],
|
||||
relatedNodeToAdd: null,
|
||||
openMainDialog: false,
|
||||
openFormDialog: false,
|
||||
openAddRelationDialog: false,
|
||||
openNodeEditorModal: false,
|
||||
currentNodeType: null,
|
||||
filters: {},
|
||||
})
|
||||
},
|
||||
|
||||
// === Selection & Current ===
|
||||
currentNode: null,
|
||||
|
||||
@@ -18,8 +18,8 @@ interface LayoutStore {
|
||||
openPanel: () => void
|
||||
closeChat: () => void
|
||||
openChat: () => void
|
||||
openAnalysis: () => void
|
||||
closeAnalysis: () => void
|
||||
openDetails: () => void
|
||||
closeDetails: () => void
|
||||
setChatDimensions: (width: number, height: number) => void
|
||||
activeTab: string
|
||||
activeTransformTab: string
|
||||
@@ -48,8 +48,8 @@ export const useLayoutStore = create<LayoutStore>()(
|
||||
openPanel: () => set({ isOpenPanel: true }),
|
||||
closeChat: () => set({ isOpenChat: false }),
|
||||
openChat: () => set({ isOpenChat: true }),
|
||||
closeAnalysis: () => set({ isOpenAnalysis: false }),
|
||||
openAnalysis: () => set({ isOpenAnalysis: true }),
|
||||
closeDetails: () => set({ isOpenAnalysis: false }),
|
||||
openDetails: () => set({ isOpenAnalysis: true }),
|
||||
setChatDimensions: (width: number, height: number) => set({ chatWidth: width, chatHeight: height }),
|
||||
setActiveTab: (tab: string) => set({ activeTab: tab }),
|
||||
setActiveTransformTab: (tab: string) => set({ activeTransformTab: tab }),
|
||||
|
||||
@@ -11,12 +11,13 @@ export type NodeData = {
|
||||
};
|
||||
|
||||
export type EdgeData = {
|
||||
from: string,
|
||||
to: string,
|
||||
date: string,
|
||||
from: string;
|
||||
to: string;
|
||||
date: string;
|
||||
id: string;
|
||||
label: string;
|
||||
type: string,
|
||||
caption?: string;
|
||||
type: string;
|
||||
confidence_level?: number | string
|
||||
};
|
||||
|
||||
|
||||
@@ -9,4 +9,3 @@ export * from "./sketch";
|
||||
export * from "./table";
|
||||
export * from "./tool";
|
||||
export * from "./transform";
|
||||
export * from "./tabs";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { GraphNode } from "@/stores/graph-store"
|
||||
|
||||
export type Row = {
|
||||
id: string
|
||||
label: string
|
||||
@@ -5,22 +7,8 @@ export type Row = {
|
||||
created_at: string
|
||||
}
|
||||
|
||||
export const rows: Row[] = [
|
||||
{
|
||||
id: "728ed52f",
|
||||
label: "https://alliage.io",
|
||||
type: "wesbite",
|
||||
created_at: "2021-01-01"
|
||||
},
|
||||
{
|
||||
id: "728ed52E",
|
||||
label: "alliage.io",
|
||||
type: "domain",
|
||||
created_at: "2021-01-01"
|
||||
}, {
|
||||
id: "722ed52E",
|
||||
label: "12.32.43.12",
|
||||
type: "ip",
|
||||
created_at: "2021-01-01"
|
||||
},
|
||||
]
|
||||
export type RelationshipType = {
|
||||
source: GraphNode
|
||||
target: GraphNode
|
||||
edge: { label: string }
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export type TabInfo = {
|
||||
id: string
|
||||
name: string
|
||||
mode?: string | null
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
export interface TabInfo {
|
||||
id: string
|
||||
title: string
|
||||
type: "graph" | "wall"
|
||||
investigationId: string
|
||||
data?: any
|
||||
isDirty?: boolean
|
||||
isLoading?: boolean
|
||||
}
|
||||
|
||||
export interface TabsState {
|
||||
items: TabInfo[]
|
||||
selectedTabId: string | null
|
||||
selectedTabIndex: number
|
||||
}
|
||||
|
||||
export interface TabsSlice {
|
||||
tabs: TabsState & {
|
||||
initialize: () => Promise<void>
|
||||
setSelectedTab: (tab: TabInfo) => void
|
||||
remove: (tab: TabInfo) => void
|
||||
add: (params: {
|
||||
id: string
|
||||
type: "graph" | "wall"
|
||||
investigationId: string
|
||||
data?: any
|
||||
title?: string
|
||||
isLoading?: boolean
|
||||
}) => Promise<void>
|
||||
reorder: (tabs: TabInfo[]) => void
|
||||
updateTabData: (id: string, data: any) => void
|
||||
markTabDirty: (id: string, isDirty?: boolean) => void
|
||||
clearTabs: () => void
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user