Skip to content

A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.

feat: analysis panel update

dextmorgnb79a8c0602c6
diff --git a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
index 7efb5a79..9c2a53f7 100644
--- a/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
+++ b/flowsint-app/src/renderer/src/components/analyses/analysis-editor.tsx
@@ -1,11 +1,11 @@
-import { useState, useEffect, useCallback } from "react"
+import { useState, useEffect, useCallback, useRef } from "react"
import { useMutation, useQueryClient } from "@tanstack/react-query"
import { MinimalTiptapEditor } from "@/components/analyses/editor"
import { analysisService } from "@/api/analysis-service"
import type { Analysis } from "@/types"
import { Button } from "@/components/ui/button"
import { Skeleton } from "@/components/ui/skeleton"
-import { PlusIcon, Trash2, Save, ChevronDown, ChevronsRight, ExternalLink } from "lucide-react"
+import { PlusIcon, Trash2, Save, ChevronDown, ChevronsRight, ExternalLink, MoreVertical } from "lucide-react"
import { toast } from "sonner"
import { useKeyboardShortcut } from "@/hooks/use-keyboard-shortcut"
import { useConfirm } from "../use-confirm-dialog"
@@ -17,6 +17,13 @@ import {
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from "@/components/ui/dropdown-menu"
interface AnalysisEditorProps {
// Core data
@@ -71,17 +78,28 @@ export const AnalysisEditor = ({
const [titleValue, setTitleValue] = useState("")
const [editor, setEditor] = useState<Editor | undefined>(undefined)
const [isEditingTitle, setIsEditingTitle] = useState(false)
+ const [saveStatus, setSaveStatus] = useState<"saved" | "saving" | "unsaved">("saved")
// Debounced save function
const debouncedSave = useCallback(
debounce(() => {
- if (analysis && editorValue) {
+ if (analysis) {
+ setSaveStatus("saving")
saveMutation.mutate({})
}
}, 1000), // 1 second delay
- [analysis, editorValue]
+ [analysis?.id]
)
+ // Handle editor content changes
+ const handleEditorChange = useCallback((value: any) => {
+ setEditorValue(value)
+ if (analysis) {
+ setSaveStatus("unsaved")
+ debouncedSave()
+ }
+ }, [analysis?.id, debouncedSave])
+
// Debounce function
function debounce(func: Function, wait: number) {
let timeout: NodeJS.Timeout
@@ -132,10 +150,11 @@ export const AnalysisEditor = ({
return oldData.map(item => item.id === data.id ? data : item)
})
onAnalysisUpdate?.(data)
- toast.success("Analysis saved !")
+ setSaveStatus("saved")
},
onError: (error) => {
toast.error("Failed to save analysis: " + (error instanceof Error ? error.message : "Unknown error"))
+ setSaveStatus("unsaved")
}
})
@@ -194,6 +213,13 @@ export const AnalysisEditor = ({
deleteMutation.mutate(analysis.id)
}
+ const handleManualSave = () => {
+ if (analysis) {
+ setSaveStatus("saving")
+ saveMutation.mutate({})
+ }
+ }
+
// Update editor content when analysis changes
useEffect(() => {
if (analysis) {
@@ -222,21 +248,25 @@ export const AnalysisEditor = ({
}
}
setTitleValue(analysis.title || "")
+ setSaveStatus("saved")
} else {
// Reset when no analysis is selected
setEditorValue("")
setTitleValue("")
+ setSaveStatus("saved")
if (editor) {
editor.commands.setContent("")
}
}
}, [analysis?.id, analysis?.content, analysis?.title, editor])
+
+
useKeyboardShortcut({
key: "s",
ctrlOrCmd: true,
callback: () => {
- saveMutation.mutate({})
+ handleManualSave()
},
})
@@ -326,53 +356,75 @@ export const AnalysisEditor = ({
{/* Action buttons */}
{showActions && (
<div className="flex items-center gap-1">
- {analysis && type !== "analysis" && (
- <Link to="/dashboard/investigations/$investigationId/$type/$id" params={{
- investigationId: routeInvestigationId || investigationId,
- type: "analysis",
- id: analysis.id
- }}>
- <Button
- size="icon"
- variant="ghost"
- title="Open in Full Page"
- className="h-8 w-8"
- >
- <ExternalLink className="w-4 h-4" strokeWidth={1.5} />
- </Button>
- </Link>
- )}
- {type !== "analysis" &&
- <Button
- size="icon"
- variant="ghost"
- onClick={() => createMutation.mutate()}
- disabled={createMutation.isPending}
- title="New Analysis"
- className="h-8 w-8"
- >
- <PlusIcon className="w-4 h-4" strokeWidth={1.5} />
- </Button>}
<Button
size="icon"
variant="ghost"
- onClick={() => saveMutation.mutate({})}
+ onClick={handleManualSave}
disabled={!analysis || saveMutation.isPending}
- title="Save"
- className="h-8 w-8"
+ title={saveStatus === "saved" ? "Saved" : saveStatus === "saving" ? "Saving..." : "Save"}
+ className="h-8 w-8 relative"
>
<Save className="w-4 h-4" strokeWidth={1.5} />
+ {saveStatus === "saved" && (
+ <div className="absolute top-1 right-1 w-2 h-2 bg-green-500 rounded-full" />
+ )}
+ {saveStatus === "saving" && (
+ <div className="absolute top-1 right-1 w-2 h-2 bg-yellow-500 rounded-full animate-pulse" />
+ )}
+ {saveStatus === "unsaved" && (
+ <div className="absolute top-1 right-1 w-2 h-2 bg-red-500 rounded-full" />
+ )}
</Button>
- <Button
- size="icon"
- variant="ghost"
- onClick={deleteAnalysis}
- disabled={!analysis || deleteMutation.isPending}
- title="Delete"
- className="h-8 w-8"
- >
- <Trash2 className="w-4 h-4" strokeWidth={1.5} />
- </Button>
+
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <div>
+ <Button
+ size="icon"
+ variant="ghost"
+ className="h-8 w-8"
+ >
+ <MoreVertical className="w-4 h-4" strokeWidth={1.5} />
+ </Button>
+ </div>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end">
+ {analysis && type !== "analysis" && (
+ <DropdownMenuItem asChild>
+ <Link to="/dashboard/investigations/$investigationId/$type/$id" params={{
+ investigationId: routeInvestigationId || investigationId,
+ type: "analysis",
+ id: analysis.id
+ }}>
+ <ExternalLink className="w-4 h-4 mr-2" strokeWidth={1.5} />
+ Open in Full Page
+ </Link>
+ </DropdownMenuItem>
+ )}
+ {type !== "analysis" && (
+ <DropdownMenuItem
+ onClick={() => createMutation.mutate()}
+ disabled={createMutation.isPending}
+ >
+ <PlusIcon className="w-4 h-4 mr-2" strokeWidth={1.5} />
+ New Analysis
+ </DropdownMenuItem>
+ )}
+ {analysis && (
+ <>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ onClick={deleteAnalysis}
+ disabled={deleteMutation.isPending}
+ variant="destructive"
+ >
+ <Trash2 className="w-4 h-4 mr-2" strokeWidth={1.5} />
+ Delete Analysis
+ </DropdownMenuItem>
+ </>
+ )}
+ </DropdownMenuContent>
+ </DropdownMenu>
</div>
)}
</div>
@@ -387,7 +439,7 @@ export const AnalysisEditor = ({
key={analysis.id}
immediatelyRender={true}
value={editorValue}
- onChange={setEditorValue}
+ onChange={handleEditorChange}
className="w-full h-full"
editorContentClassName="p-5 min-h-[300px]"
output="json"
diff --git a/flowsint-app/src/renderer/src/components/chat/chat-history.tsx b/flowsint-app/src/renderer/src/components/chat/chat-history.tsx
index bbcca2b6..75401320 100644
--- a/flowsint-app/src/renderer/src/components/chat/chat-history.tsx
+++ b/flowsint-app/src/renderer/src/components/chat/chat-history.tsx
@@ -90,12 +90,12 @@ const ChatItem = ({ chat, confirm, deleteChatMutation, switchToChat }: { chat: C
}
}, [])
return (
- <button onClick={() => switchToChat(chat.id)} className='flex w-full cursor-pointer justify-between items-center bg-muted-foreground/5 backdrop-blur-sm rounded-xl p-2 px-4 hover:bg-muted-foreground/10 transition-all duration-300'>
- <div className='flex items-start flex-col justify-between'>
- <span className='font-semibold text-md'>{chat.title}</span>
+ <button onClick={() => switchToChat(chat.id)} className='flex w-full cursor-pointer justify-start items-center bg-muted-foreground/5 backdrop-blur-sm rounded-xl p-2 px-4 hover:bg-muted-foreground/10 transition-all duration-300'>
+ <div className='flex items-start flex-col justify-between min-w-0 flex-1 overflow-hidden'>
+ <span className='font-semibold text-md truncate text-left w-full'>{chat.title}</span>
<span className='font-normal text-xs'>{formatDistanceToNow(chat.last_updated_at, { addSuffix: true })}</span>
</div>
- <div className='flex items-center justify-between'>
+ <div className='flex items-center justify-between flex-shrink-0 ml-2'>
<Button variant="ghost" size="icon" className='h-6 w-6' onClick={handleDeleteChat}>
<Trash className='h-3 w-3' />
</Button>
diff --git a/flowsint-app/src/renderer/src/components/graphs/global-settings.tsx b/flowsint-app/src/renderer/src/components/graphs/global-settings.tsx
new file mode 100644
index 00000000..52555a87
--- /dev/null
+++ b/flowsint-app/src/renderer/src/components/graphs/global-settings.tsx
@@ -0,0 +1,113 @@
+import { Button } from "@/components/ui/button"
+import {
+ Dialog,
+ DialogClose,
+ DialogContent,
+ DialogDescription,
+ DialogFooter,
+ DialogHeader,
+ DialogTitle,
+} from "@/components/ui/dialog"
+
+import { useGraphGeneralSettingsStore } from "@/stores/graph-general-store"
+import { isMacOS } from "@/components/analyses/editor/utils"
+
+export default function GlobalSettings() {
+ const settingsModalOpen = useGraphGeneralSettingsStore(s => s.settingsModalOpen)
+ const setSettingsModalOpen = useGraphGeneralSettingsStore(s => s.setSettingsModalOpen)
+
+ return (
+ <Dialog open={settingsModalOpen} onOpenChange={setSettingsModalOpen}>
+ <DialogContent className="sm:max-w-[425px]">
+ <DialogHeader>
+ <DialogTitle>General settings</DialogTitle>
+ <DialogDescription>
+ Make changes to your general settings here. Click save when you&apos;re
+ done.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="grid gap-4">
+ Comming soon.
+ </div>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="outline">Cancel</Button>
+ </DialogClose>
+ <Button type="submit">Save changes</Button>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
+
+export function KeyboardShortcuts() {
+ const keyboardShortcutsOpen = useGraphGeneralSettingsStore(s => s.keyboardShortcutsOpen)
+ const setKeyboardShortcutsOpen = useGraphGeneralSettingsStore(s => s.setKeyboardShortcutsOpen)
+
+ const isMac = isMacOS()
+ const modKey = isMac ? "⌘" : "Ctrl"
+
+ const shortcuts = [
+ {
+ category: "Navigation & Panels",
+ items: [
+ { key: `${modKey}+L`, description: "Toggle Analysis Panel" },
+ { key: `${modKey}+B`, description: "Toggle Panel" },
+ { key: `${modKey}+D`, description: "Toggle Console" },
+ { key: `${modKey}+J`, description: "Open Command Palette" },
+ ]
+ },
+ {
+ category: "Chat & Assistant",
+ items: [
+ { key: `${modKey}+E`, description: "Toggle Chat Assistant" },
+ { key: "Escape", description: "Close Chat Assistant" },
+ ]
+ },
+ {
+ category: "File Operations",
+ items: [
+ { key: `${modKey}+S`, description: "Save (Analysis/Flow)" },
+ ]
+ }
+ ]
+
+ return (
+ <Dialog open={keyboardShortcutsOpen} onOpenChange={setKeyboardShortcutsOpen}>
+ <DialogContent className="sm:max-w-[500px] max-h-[90vh] overflow-y-auto">
+ <DialogHeader>
+ <DialogTitle>Keyboard Shortcuts</DialogTitle>
+ <DialogDescription>
+ Here is the list of all available keyboard shortcuts.
+ </DialogDescription>
+ </DialogHeader>
+ <div className="space-y-6">
+ {shortcuts.map((category) => (
+ <div key={category.category} className="space-y-3">
+ <h3 className="text-sm font-semibold text-foreground/80 uppercase tracking-wide">
+ {category.category}
+ </h3>
+ <div className="space-y-2">
+ {category.items.map((item) => (
+ <div key={item.key} className="flex items-center justify-between py-2 px-3 rounded-md bg-muted/50">
+ <span className="text-sm text-muted-foreground">
+ {item.description}
+ </span>
+ <kbd className="inline-flex items-center gap-1 rounded border bg-background px-2 py-1 text-xs font-mono font-medium text-foreground shadow-sm">
+ {item.key}
+ </kbd>
+ </div>
+ ))}
+ </div>
+ </div>
+ ))}
+ </div>
+ <DialogFooter>
+ <DialogClose asChild>
+ <Button variant="outline">Close</Button>
+ </DialogClose>
+ </DialogFooter>
+ </DialogContent>
+ </Dialog>
+ )
+}
\ No newline at end of file
diff --git a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx b/flowsint-app/src/renderer/src/components/graphs/index.tsx
similarity index 97%
rename from flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
rename to flowsint-app/src/renderer/src/components/graphs/index.tsx
index 0485090d..1ec3f065 100644
--- a/flowsint-app/src/renderer/src/components/graphs/graph-panel.tsx
+++ b/flowsint-app/src/renderer/src/components/graphs/index.tsx
@@ -17,6 +17,7 @@ import MapPanel from '../map/map-panel'
import NewActions from './add-item-dialog'
import GraphSettings from './graph-settings'
import GraphMain from './graph-main'
+import GlobalSettings, { KeyboardShortcuts } from './global-settings'
const RelationshipsTable = lazy(() => import('@/components/table/relationships-view'))
const Graph = lazy(() => import('./graph'))
// const Wall = lazy(() => import('./wall/wall'))
@@ -153,6 +154,8 @@ const GraphPanel = ({ graphData, isLoading }: GraphPanelProps) => {
<CreateRelationDialog />
<NodeEditorModal />
<GraphSettings />
+ <GlobalSettings />
+ <KeyboardShortcuts />
</div>
)
}
diff --git a/flowsint-app/src/renderer/src/components/layout/sidebar.tsx b/flowsint-app/src/renderer/src/components/layout/sidebar.tsx
index d5c2c02d..1b76ab71 100644
--- a/flowsint-app/src/renderer/src/components/layout/sidebar.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/sidebar.tsx
@@ -1,5 +1,4 @@
import {
- Fingerprint,
Home,
Lock,
type LucideIcon,
@@ -16,6 +15,8 @@ import {
TooltipTrigger,
} from "../ui/tooltip"
import { memo } from "react"
+import { isMac } from "@/lib/utils"
+import { NavUser } from "../nav-user"
interface NavItem {
icon: LucideIcon
@@ -78,12 +79,24 @@ export const Sidebar = memo(() => {
})}
</div>
<div className="grow"></div>
- <div className="flex justify-center items-center p-3">
- <Button variant={"ghost"} onClick={togglePanel}>
- <PanelLeft
- className={`h-12 w-12 transition-transform duration-200`}
- />
- </Button>
+ <div className="flex flex-col justify-center items-center p-3 gap-4">
+ <TooltipProvider>
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <div>
+ <Button variant={"ghost"} onClick={togglePanel}>
+ <PanelLeft
+ className={`h-12 w-12 transition-transform duration-200`}
+ />
+ </Button>
+ </div>
+ </TooltipTrigger>
+ <TooltipContent side="right">
+ Toggle panel<span className="text-[.7rem] ml-1 opacity-60">({isMac ? '⌘' : 'ctrl'}B)</span>
+ </TooltipContent>
+ </Tooltip>
+ </TooltipProvider>
+ <NavUser />
</div>
</div>
)
diff --git a/flowsint-app/src/renderer/src/components/layout/status-bar.tsx b/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
index 96467385..d8c5324c 100644
--- a/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/status-bar.tsx
@@ -6,6 +6,7 @@ import Legend from "../graphs/legend"
import { Link, useParams } from "@tanstack/react-router"
import InfoDialog from "./info"
import { memo } from "react"
+import { isMac } from "@/lib/utils"
export const StatusBar = memo(() => {
const { id: sketch_id } = useParams({ strict: false })
@@ -23,7 +24,7 @@ export const StatusBar = memo(() => {
onClick={toggleConsole}
>
<Terminal strokeWidth={1.4} className="h-3 w-3" />
- <span>Console {isOpenConsole ? '(Open)' : ''}</span>
+ <span>Console {isOpenConsole ? '(Open)' : ''} <span className="text-[.7rem] opacity-60">({isMac ? '⌘' : 'ctrl'}D)</span></span>
</Button>}
</div>
<div className="flex-1"></div>
diff --git a/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx b/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
index fd63b186..21d8b0ba 100644
--- a/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
+++ b/flowsint-app/src/renderer/src/components/layout/top-navbar.tsx
@@ -1,5 +1,4 @@
import { Command } from "../command"
-import { NavUser } from "../nav-user"
import { Link, useParams } from "@tanstack/react-router"
import InvestigationSelector from "./investigation-selector"
import SketchSelector from "./sketch-selector"
@@ -14,16 +13,13 @@ import {
DropdownMenuGroup,
DropdownMenuItem,
DropdownMenuLabel,
- DropdownMenuPortal,
DropdownMenuSeparator,
DropdownMenuShortcut,
- DropdownMenuSub,
- DropdownMenuSubContent,
- DropdownMenuSubTrigger,
DropdownMenuTrigger,
} from "@/components/ui/dropdown-menu"
import { Ellipsis } from "lucide-react"
import { isMac } from "@/lib/utils"
+import { useGraphGeneralSettingsStore } from "@/stores/graph-general-store"
export const TopNavbar = memo(() => {
const { investigationId, id, type } = useParams({ strict: false })
@@ -80,8 +76,8 @@ export const TopNavbar = memo(() => {
</>
}
</div>
- <InvestigationMenu />
- <NavUser />
+ {id && <InvestigationMenu />}
+ {/* <NavUser /> */}
</div>
</header>
)
@@ -89,6 +85,9 @@ export const TopNavbar = memo(() => {
export function InvestigationMenu() {
+ const setSettingsModalOpen = useGraphGeneralSettingsStore(s => s.setSettingsModalOpen)
+ const setKeyboardShortcutsOpen = useGraphGeneralSettingsStore(s => s.setKeyboardShortcutsOpen)
+
return (
<DropdownMenu>
<DropdownMenuTrigger asChild>
@@ -99,20 +98,16 @@ export function InvestigationMenu() {
<DropdownMenuContent className="w-56" align="start">
<DropdownMenuLabel>Settings</DropdownMenuLabel>
<DropdownMenuGroup>
- <DropdownMenuItem>
- General
- <DropdownMenuShortcut>⌘G</DropdownMenuShortcut>
- </DropdownMenuItem>
- <DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setSettingsModalOpen(true)}>
Preferences
- <DropdownMenuShortcut>⌘P</DropdownMenuShortcut>
+ <DropdownMenuShortcut>⌘G</DropdownMenuShortcut>
</DropdownMenuItem>
- <DropdownMenuItem>
+ <DropdownMenuItem onClick={() => setKeyboardShortcutsOpen(true)}>
Keyboard shortcuts
<DropdownMenuShortcut>⌘K</DropdownMenuShortcut>
</DropdownMenuItem>
</DropdownMenuGroup>
- <DropdownMenuSeparator />
+ {/* <DropdownMenuSeparator />
<DropdownMenuGroup>
<DropdownMenuItem>Team</DropdownMenuItem>
<DropdownMenuSub>
@@ -130,10 +125,10 @@ export function InvestigationMenu() {
New Team
<DropdownMenuShortcut>⌘T</DropdownMenuShortcut>
</DropdownMenuItem>
- </DropdownMenuGroup>
+ </DropdownMenuGroup> */}
<DropdownMenuSeparator />
- <DropdownMenuItem>GitHub</DropdownMenuItem>
- <DropdownMenuItem>Support</DropdownMenuItem>
+ <DropdownMenuItem><a href="https://github.com/reconurge">GitHub</a></DropdownMenuItem>
+ <DropdownMenuItem><a href="https://github.com/reconurge">Support</a></DropdownMenuItem>
<DropdownMenuItem disabled>API</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem variant="destructive">
diff --git a/flowsint-app/src/renderer/src/components/table/relationships-view.tsx b/flowsint-app/src/renderer/src/components/table/relationships-view.tsx
index 194b03ec..1799374e 100644
--- a/flowsint-app/src/renderer/src/components/table/relationships-view.tsx
+++ b/flowsint-app/src/renderer/src/components/table/relationships-view.tsx
@@ -58,14 +58,13 @@ function RelationshipItem({ relationship, style, onNodeClick }: RelationshipItem
</div>
{/* Relationship Arrow */}
- <div className="flex items-center gap-2 px-2 flex-shrink-0 min-w-0">
- <div className="flex items-center gap-2 px-2 py-1 rounded-full min-w-0">
- <Badge variant="secondary" className="text-xs font-medium truncate">
- <span className="truncate">
- {relationship.edge.label}
- </span>
- <ArrowRight className="h-4 w-4 text-muted-foreground flex-shrink-0" />
- </Badge>
+ <div className="flex items-center justify-center px-2 flex-shrink-0 min-w-0 grow">
+ <div className="flex items-center gap-1 text-xs text-muted-foreground">
+ <div className="h-px bg-muted-foreground/30 flex-1"></div>
+ <span className="px-2 py-1 bg-muted/50 rounded-sm truncate">
+ {relationship.edge.label}
+ </span>
+ <ArrowRight className="h-3 w-3 text-muted-foreground/50" />
</div>
</div>
diff --git a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
index 49adf2a8..3b3fb245 100644
--- a/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
+++ b/flowsint-app/src/renderer/src/routes/_auth.dashboard.investigations.$investigationId.$type.$id.tsx
@@ -1,5 +1,5 @@
import { createFileRoute, useLoaderData } from '@tanstack/react-router'
-import GraphPanel from '@/components/graphs/graph-panel'
+import GraphPanel from '@/components/graphs'
import { sketchService } from '@/api/sketch-service'
import { useQuery } from '@tanstack/react-query'
import Loader from '@/components/loader'
diff --git a/flowsint-app/src/renderer/src/stores/graph-general-store.ts b/flowsint-app/src/renderer/src/stores/graph-general-store.ts
new file mode 100644
index 00000000..96e6af5e
--- /dev/null
+++ b/flowsint-app/src/renderer/src/stores/graph-general-store.ts
@@ -0,0 +1,47 @@
+import { type Settings } from '@/types';
+import { create } from 'zustand';
+import { persist } from 'zustand/middleware';
+
+const DEFAULT_SETTINGS = {
+ prefferedNodesView: {
+ value: "force",
+ options: ["table", "hierarchy", "force", "relationships"],
+ description: "Preferred display for the entities."
+ }
+}
+
+type GraphGeneralSettingsStore = {
+ // Settings state
+ settings: Settings
+ updateSetting: (key: string, val: any) => void
+ // UI State
+ settingsModalOpen: boolean
+ setSettingsModalOpen: (open: boolean) => void
+ keyboardShortcutsOpen: boolean
+ setKeyboardShortcutsOpen: (open: boolean) => void
+};
+
+export const useGraphGeneralSettingsStore = create<GraphGeneralSettingsStore>()(
+ persist((set) => ({
+ settingsModalOpen: false,
+ setSettingsModalOpen: (open) => set({ settingsModalOpen: open }),
+ keyboardShortcutsOpen: false,
+ setKeyboardShortcutsOpen: (open) => set({ keyboardShortcutsOpen: open }),
+ settings: DEFAULT_SETTINGS,
+ updateSetting: (key, val) => set((state) => ({
+ settings: {
+ ...state.settings,
+ [key]: {
+ ...state.settings[key],
+ value: val
+ },
+ },
+ })),
+ }),
+ {
+ name: 'graph-general-storage',
+ partialize: (state) => ({
+ settings: state.settings,
+ }),
+ }
+ ));
diff --git a/flowsint-app/src/renderer/src/types/graph.ts b/flowsint-app/src/renderer/src/types/graph.ts
index a7435a42..ddedf855 100644
--- a/flowsint-app/src/renderer/src/types/graph.ts
+++ b/flowsint-app/src/renderer/src/types/graph.ts
@@ -26,7 +26,7 @@ export type InvestigationGraph = {
edges: Edge[];
};
-export type Setting = {
+export type ForceGraphSetting = {
value: any,
min?: number,
max?: number,
@@ -35,6 +35,12 @@ export type Setting = {
description?: string,
}
+export type GeneralSetting = {
+ value: any,
+ options?: any[]
+ description?: string,
+}
+
export type Settings = {
- [key: string]: Setting,
-}
\ No newline at end of file
+ [key: string]: ForceGraphSetting | GeneralSetting,
+}
diff --git a/flowsint-transforms/src/flowsint_transforms/ip/to_asn.py b/flowsint-transforms/src/flowsint_transforms/ip/to_asn.py
index 85c59210..75364cfe 100644
--- a/flowsint-transforms/src/flowsint_transforms/ip/to_asn.py
+++ b/flowsint-transforms/src/flowsint_transforms/ip/to_asn.py
@@ -10,7 +10,7 @@ from flowsint_core.core.logger import Logger
class IpToAsnScanner(Scanner):
- """Takes an IP address and returns its corresponding ASN."""
+ """[ASNMAP] Takes an IP address and returns its corresponding ASN."""
# Define types as class attributes - base class handles schema generation automatically
InputType = List[Ip]
diff --git a/flowsint-transforms/src/flowsint_transforms/ip/to_geolocation.py b/flowsint-transforms/src/flowsint_transforms/ip/to_geolocation.py
index f8f623dd..5d528206 100644
--- a/flowsint-transforms/src/flowsint_transforms/ip/to_geolocation.py
+++ b/flowsint-transforms/src/flowsint_transforms/ip/to_geolocation.py
@@ -10,7 +10,7 @@ OutputType: TypeAlias = List[Ip]
class GeolocationScanner(Scanner):
- """Get geolocation data for IP addresses."""
+ """[ip-api.com] Get geolocation data for IP addresses."""
# Define types as class attributes - base class handles schema generation automatically
InputType = List[Ip]