Skip to content

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

feat(app): sending node ids to api instead of labels for transforms

dextmorgna4614180b41d
diff --git a/flowsint-app/src/components/graphs/context-menu.tsx b/flowsint-app/src/components/graphs/context-menu.tsx
index c1851a4c..f26e9eaa 100644
--- a/flowsint-app/src/components/graphs/context-menu.tsx
+++ b/flowsint-app/src/components/graphs/context-menu.tsx
@@ -82,13 +82,13 @@ export default function ContextMenu({
const handleFlowClick = (e: React.MouseEvent, flowId: string) => {
e.stopPropagation()
- launchFlow([node.data.label], flowId, sketchId)
+ launchFlow([node.id], flowId, sketchId)
setMenu(null)
}
const handleTransformClick = (e: React.MouseEvent, transformName: string) => {
e.stopPropagation()
- launchTransform([node.data.label], transformName, sketchId)
+ launchTransform([node.id], transformName, sketchId)
setMenu(null)
}
diff --git a/flowsint-app/src/components/graphs/details-panel/details-panel.tsx b/flowsint-app/src/components/graphs/details-panel/details-panel.tsx
index b9c464bb..39a707a7 100644
--- a/flowsint-app/src/components/graphs/details-panel/details-panel.tsx
+++ b/flowsint-app/src/components/graphs/details-panel/details-panel.tsx
@@ -42,7 +42,7 @@ const DetailsPanel = memo(({ node }: { node: GraphNode | null }) => {
<Tooltip>
<TooltipTrigger asChild>
<div>
- <LaunchFlow values={[node.data.label]} type={node.data?.type}>
+ <LaunchFlow values={[node.data.id]} type={node.data?.type}>
<Button
variant="ghost"
size="sm"
diff --git a/flowsint-app/src/components/graphs/selected-items-panel.tsx b/flowsint-app/src/components/graphs/selected-items-panel.tsx
index 153212df..898fb478 100644
--- a/flowsint-app/src/components/graphs/selected-items-panel.tsx
+++ b/flowsint-app/src/components/graphs/selected-items-panel.tsx
@@ -124,7 +124,7 @@ const ActionBar = () => {
const type = selectedNodes[0].data.type
const isSametype = (node: GraphNode) => node.data.type === type
const shareSameType = selectedNodes.every(isSametype)
- const values = !shareSameType ? [] : selectedNodes.map((node: GraphNode) => node.data.label)
+ const values = !shareSameType ? [] : selectedNodes.map((node: GraphNode) => node.data.id)
return (
<div className="flex items-center gap-1">
diff --git a/flowsint-app/src/hooks/use-launch-flow.ts b/flowsint-app/src/hooks/use-launch-flow.ts
index 6afed828..ce13fc40 100644
--- a/flowsint-app/src/hooks/use-launch-flow.ts
+++ b/flowsint-app/src/hooks/use-launch-flow.ts
@@ -26,7 +26,7 @@ export function useLaunchFlow(askUser: boolean = false) {
})
const launchFlow = async (
- values: string[],
+ node_ids: string[],
flow_id: string,
sketch_id: string | null | undefined
) => {
@@ -34,18 +34,17 @@ export function useLaunchFlow(askUser: boolean = false) {
if (askUser) {
const confirmed = await confirm({
title: `${flow_id} scan`,
- message: `You're about to launch ${flow_id} flow on ${values.length} items.`
+ message: `You're about to launch ${flow_id} flow on ${node_ids.length} items.`
})
if (!confirmed) return
}
- const body = JSON.stringify({ values, sketch_id })
- const sliced = values.slice(0, 2)
- const left = values.length - sliced.length
+ const body = JSON.stringify({ node_ids, sketch_id })
+ const count = node_ids.length
toast.promise(launchFlowMutation.mutateAsync({ flowId: flow_id, body }), {
loading: 'Loading...',
success: () =>
- `Flow ${flow_id} has been launched on "${sliced.join(',')}" ${left > 0 && ` and ${left} others`}.`,
+ `Flow ${flow_id} has been launched on ${count} node${count > 1 ? 's' : ''}.`,
error: () => `An error occurred launching flow.`
})
return
diff --git a/flowsint-app/src/hooks/use-launch-transform.ts b/flowsint-app/src/hooks/use-launch-transform.ts
index 50bf27b7..e89f9c3e 100644
--- a/flowsint-app/src/hooks/use-launch-transform.ts
+++ b/flowsint-app/src/hooks/use-launch-transform.ts
@@ -8,7 +8,7 @@ export function useLaunchTransform(askUser: boolean = false) {
const openClonsole = useLayoutStore(s => s.openConsole)
const launchTransform = async (
- values: string[],
+ node_ids: string[],
transformName: string,
sketch_id: string | null | undefined
) => {
@@ -16,17 +16,16 @@ export function useLaunchTransform(askUser: boolean = false) {
if (askUser) {
const confirmed = await confirm({
title: `${transformName} scan`,
- message: `You're about to launch ${transformName} transform on ${values.length} items.`
+ message: `You're about to launch ${transformName} transform on ${node_ids.length} items.`
})
if (!confirmed) return
}
- const body = JSON.stringify({ values, sketch_id })
- const sliced = values.slice(0, 2)
- const left = values.length - sliced.length
+ const body = JSON.stringify({ node_ids, sketch_id })
+ const count = node_ids.length
toast.promise(transformService.launch(transformName, body), {
loading: 'Loading...',
success: () =>
- `Transform ${transformName} has been launched on ${sliced.join(', ')}${left > 0 ? ` and ${left} others` : ''}.`,
+ `Transform ${transformName} has been launched on ${count} node${count > 1 ? 's' : ''}.`,
error: () => `An error occurred launching transform.`
})
openClonsole()