A modern platform for visual, flexible, and extensible graph-based investigations. For cybersecurity analysts and investigators.
feat: realtime logs
dextmorgnc897ae759e4a
diff --git a/flowsint-api/app/core/__init__.py b/flowsint-api/app/core/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/flowsint-api/app/core/logger.py b/flowsint-api/app/core/logger.pynew file mode 100644index 00000000..53f46e5c--- /dev/null+++ b/flowsint-api/app/core/logger.py@@ -0,0 +1,35 @@+from app.core.db import get_db # Supabase client+from typing import Literal+from uuid import UUID++LogLevel = Literal["info", "warn", "error", "success"]++class Logger:+ def __init__(self, db):+ self.db = db++ def emit(self, scan_id: UUID, sketch_id: UUID, content: str, level: LogLevel = "info"):+ data = {+ "scan_id": str(scan_id),+ "sketch_id": str(sketch_id),+ "type": level.upper(),+ "content": f"[{level.upper()}] {content}",+ }+ try:+ self.db.table("logs").insert(data).execute()+ except Exception as e:+ print(f"[Logger] Failed to emit log: {e}")++ def info(self, scan_id: UUID, sketch_id: UUID, content: str):+ self.emit(scan_id, sketch_id, content, level="info")++ def warn(self, scan_id: UUID, sketch_id: UUID, content: str):+ self.emit(scan_id, sketch_id, content, level="warn")++ def error(self, scan_id: UUID, sketch_id: UUID, content: str):+ self.emit(scan_id, sketch_id, content, level="error")++ def success(self, scan_id: UUID, sketch_id: UUID, content: str):+ self.emit(scan_id, sketch_id, content, level="success")++logger = Logger(get_db())diff --git a/flowsint-api/app/main.py b/flowsint-api/app/main.pyindex 17182c88..181c9e3a 100644--- a/flowsint-api/app/main.py+++ b/flowsint-api/app/main.py@@ -12,6 +12,7 @@ from app.core.celery import celery_appfrom app.types.domain import MinimalDomainfrom app.types.ip import MinimalIpfrom app.types.social import MinimalSocial+from app.types.organization import MinimalOrganizationfrom app.types.email import Emailfrom typing import List, Dict, Anyfrom app.neo4j.connector import Neo4jConnection@@ -80,6 +81,7 @@ async def get_scans_list():extract_input_schema("MinimalIp", MinimalIp),extract_input_schema("MinimalSocial", MinimalSocial),extract_input_schema("Email", Email),+ extract_input_schema("MinimalOrganization", MinimalOrganization)]flattened_scanners["inputs"] = object_inputsdiff --git a/flowsint-api/app/scanners/base.py b/flowsint-api/app/scanners/base.pyindex 39d0cb81..ceee4292 100644--- a/flowsint-api/app/scanners/base.py+++ b/flowsint-api/app/scanners/base.py@@ -1,6 +1,8 @@from abc import ABC, abstractmethodfrom typing import List, Dict, Anyfrom app.neo4j.connector import Neo4jConnection+from app.core.logger import logger+class Scanner(ABC):def __init__(self, sketch_id:str, scan_id: str, neo4j_conn: Neo4jConnection = None):self.scan_id = scan_id@@ -58,14 +60,17 @@ class Scanner(ABC):Execute the scanning process by first preprocessing, then scanning, and finally postprocessing.Tries to call postprocess with (results, preprocessed). Falls back to (results) if needed."""+ if self.name() != "transform_orchestrator":+ logger.info(self.scan_id,self.sketch_id, f"Scanner {self.name()} started.")preprocessed = self.preprocess(values)results = self.scan(preprocessed)-+ processed = self.postprocess(results, preprocessed)try:- # Try calling with both results and preprocessed- return self.postprocess(results, preprocessed)- except TypeError as e:- if "positional argument" in str(e) or "unexpected" in str(e):- return self.postprocess(results)- raise+ if self.name() != "transform_orchestrator":+ logger.success(self.scan_id,self.sketch_id, f"Scanner {self.name()} finished.")+ return processed+ except Exception as e:+ if self.name() != "transform_orchestrator":+ logger.error(self.scan_id,self.sketch_id, f"Scanner {self.name()} errored: '{str(e)}'.")+ return processeddiff --git a/flowsint-api/app/scanners/domains/resolve.py b/flowsint-api/app/scanners/domains/resolve.pyindex a7bba39d..a906acd2 100644--- a/flowsint-api/app/scanners/domains/resolve.py+++ b/flowsint-api/app/scanners/domains/resolve.py@@ -5,6 +5,7 @@ from app.scanners.base import Scannerfrom app.types.domain import MinimalDomainfrom app.types.ip import MinimalIpfrom app.utils import is_valid_domain, resolve_type+from app.core.logger import loggerInputType: TypeAlias = List[MinimalDomain]OutputType: TypeAlias = List[MinimalIp]@@ -62,6 +63,7 @@ class ResolveScanner(Scanner):def postprocess(self, results: OutputType, original_input: InputType) -> OutputType:for domain_obj, ip_obj in zip(original_input, results):+ logger.info(self.scan_id, self.sketch_id, f"{domain_obj.domain} -> {ip_obj.address}.")query = """MERGE (d:domain {domain: $domain})SET d.sketch_id = $sketch_id@@ -83,4 +85,5 @@ class ResolveScanner(Scanner):"caption": ip_obj.address,"type": "ip"})+return results\ No newline at end of filediff --git a/flowsint-api/app/scanners/domains/subdomains.py b/flowsint-api/app/scanners/domains/subdomains.pyindex 3d519f10..487f7d99 100644--- a/flowsint-api/app/scanners/domains/subdomains.py+++ b/flowsint-api/app/scanners/domains/subdomains.py@@ -5,6 +5,7 @@ from app.scanners.base import Scannerfrom app.types.domain import MinimalDomain, Domainfrom app.utils import is_valid_domain, resolve_typefrom pydantic import TypeAdapter+from app.core.logger import loggerInputType: TypeAlias = List[MinimalDomain]OutputType: TypeAlias = List[Domain]@@ -95,7 +96,6 @@ class SubdomainScanner(Scanner):["subfinder", "-silent", "-d", domain],capture_output=True, text=True, timeout=60)- print(result)if result.returncode == 0:for sub in result.stdout.strip().splitlines():sub = sub.strip().lower()@@ -131,5 +131,7 @@ class SubdomainScanner(Scanner):"color": "#865FCD","type": "subdomain"})+ logger.info(self.scan_id, self.sketch_id, f"{domain_obj.domain} -> {len(domain_obj.subdomains)} subdomain(s) found.")+return resultsdiff --git a/flowsint-api/app/scanners/emails/holehe.py b/flowsint-api/app/scanners/emails/holehe.pyindex 943c1877..78356e6d 100644--- a/flowsint-api/app/scanners/emails/holehe.py+++ b/flowsint-api/app/scanners/emails/holehe.py@@ -5,6 +5,7 @@ from app.types.social import Socialfrom pydantic import TypeAdapterfrom app.utils import is_valid_email, resolve_typeimport asyncio+from app.core.logger import loggerInputType: TypeAlias = List[Email]@@ -125,6 +126,7 @@ class HoleheScanner(Scanner):return resultsfor profile in results:+ logger.info(self.scan_id, self.sketch_id, f"{profile.username} -> account found on {profile.platform}")self.neo4j_conn.query("""MERGE (p:social_profile {profile_url: $profile_url})SET p.platform = $platform,diff --git a/flowsint-api/app/scanners/ips/reverse_resolve.py b/flowsint-api/app/scanners/ips/reverse_resolve.pyindex 2649dd75..c6f471b4 100644--- a/flowsint-api/app/scanners/ips/reverse_resolve.py+++ b/flowsint-api/app/scanners/ips/reverse_resolve.py@@ -80,7 +80,6 @@ class ReverseResolveScanner(Scanner):"""candidates: List[str] = []- # 1. PTR lookuptry:answers = dns.resolver.resolve_address(address)ptr = answers[0].to_text().rstrip('.')diff --git a/flowsint-api/app/scanners/organizations/__init__.py b/flowsint-api/app/scanners/organizations/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/flowsint-api/app/scanners/organizations/sirene.py b/flowsint-api/app/scanners/organizations/sirene.pynew file mode 100644index 00000000..c1b25d09--- /dev/null+++ b/flowsint-api/app/scanners/organizations/sirene.py@@ -0,0 +1,138 @@+import requests+from typing import List, Dict, Any, TypeAlias, Union+from pydantic import TypeAdapter+from app.scanners.base import Scanner+from app.types.organization import MinimalOrganization, Organization, Identifier+from app.utils import resolve_type++InputType: TypeAlias = List[MinimalOrganization]+OutputType: TypeAlias = List[Organization]++class SireneScanner(Scanner):+ """Enrich MinimalOrganization with data from SIRENE (France only)."""++ @classmethod+ def name(cls) -> str:+ return "sirene_scanner"++ @classmethod+ def category(cls) -> str:+ return "organizations"++ @classmethod+ def input_schema(cls) -> List[Dict[str, Any]]:+ adapter = TypeAdapter(InputType)+ return [+ {"name": prop, "type": resolve_type(details)}+ for prop, details in adapter.json_schema()["$defs"]["MinimalOrganization"]["properties"].items()+ ]++ @classmethod+ def output_schema(cls) -> List[Dict[str, Any]]:+ adapter = TypeAdapter(OutputType)+ return [+ {"name": prop, "type": resolve_type(details)}+ for prop, details in adapter.json_schema()["$defs"]["Organization"]["properties"].items()+ ]++ def preprocess(self, data: Union[List[str], List[dict], InputType]) -> InputType:+ cleaned: InputType = []+ for item in data:+ if isinstance(item, str):+ cleaned.append(MinimalOrganization(name=item))+ elif isinstance(item, dict) and "name" in item:+ cleaned.append(MinimalOrganization(**item))+ elif isinstance(item, MinimalOrganization):+ cleaned.append(item)+ return cleaned++ def scan(self, data: InputType) -> OutputType:+ results: OutputType = []+ for org in data:+ try:+ enriched = self.query_sirene(org.name)+ if enriched:+ results.append(enriched)+ except Exception as e:+ print(f"Error enriching organization {org.name}: {e}")+ return results++ def query_sirene(self, name: str) -> Organization:+ try:+ params = {"q": name, "per_page": 1}+ resp = requests.get("https://recherche-entreprises.api.gouv.fr/search", params=params, timeout=10)+ resp.raise_for_status()+ data = resp.json()+ if not data.get("results"):+ raise ValueError(f"No match found for {name}")+ company = data["results"][0]++ identifiers = []+ if siren := company.get("siren"):+ identifiers.append(Identifier(type="SIREN", value=siren, country="FR", issued_by="INSEE"))+ if siret := company.get("siege", {}).get("siret"):+ identifiers.append(Identifier(type="SIRET", value=siret, country="FR", issued_by="INSEE"))++ return Organization(+ name=company.get("nom_entreprise") or name,+ founding_date=company.get("date_creation"),+ country="FR",+ description=company.get("categorie_entreprise"),+ identifiers=identifiers or None,+ )+ except Exception as e:+ print(f"SIRENE API query failed for {name}: {e}")+ return Organization(name=name)++ def postprocess(self, results: OutputType, original_input: InputType) -> OutputType:+ if not self.neo4j_conn:+ return results++ for org in results:+ self.neo4j_conn.query("""+ MERGE (o:organization {name: $name})+ SET o.founding_date = $founding_date,+ o.country = $country,+ o.description = $description,+ o.label = $label,+ o.caption = $caption,+ o.color = $color,+ o.type = $type,+ o.sketch_id = $sketch_id+ """, {+ "name": org.name,+ "founding_date": org.founding_date,+ "country": org.country,+ "description": org.description,+ "label": org.name,+ "caption": org.name,+ "color": "#2F80ED",+ "type": "organization",+ "sketch_id": self.sketch_id,+ })++ for identifier in org.identifiers or []:+ self.neo4j_conn.query("""+ MERGE (i:identifier {type: $type, value: $value})+ SET i.country = $country,+ i.issued_by = $issued_by,+ i.sketch_id = $sketch_id,+ i.label = $label,+ i.caption = $label+ WITH i+ MATCH (o:organization {name: $org_name})+ MERGE (o)-[:HAS_IDENTIFIER {sketch_id: $sketch_id}]->(i)+ """, {+ "type": identifier.type.lower(),+ "label": f"{identifier.type}: {identifier.value}",+ "caption": f"{identifier.type}: {identifier.value}",+ "value": identifier.value,+ "country": identifier.country,+ "issued_by": identifier.issued_by,+ "sketch_id": self.sketch_id,+ "org_name": org.name,+ })++ return results++diff --git a/flowsint-api/app/scanners/registry.py b/flowsint-api/app/scanners/registry.pyindex a5e32261..074a75f8 100644--- a/flowsint-api/app/scanners/registry.py+++ b/flowsint-api/app/scanners/registry.py@@ -8,7 +8,7 @@ from app.scanners.ips.reverse_resolve import ReverseResolveScannerfrom app.scanners.ips.geolocation import GeolocationScannerfrom app.scanners.socials.maigret import MaigretScannerfrom app.scanners.emails.holehe import HoleheScanner-+from app.scanners.organizations.sirene import SireneScannerclass ScannerRegistry:_scanners: Dict[str, Type[Scanner]] = {}@@ -66,4 +66,5 @@ ScannerRegistry.register(SubdomainScanner)ScannerRegistry.register(WhoisScanner)ScannerRegistry.register(GeolocationScanner)ScannerRegistry.register(MaigretScanner)-ScannerRegistry.register(HoleheScanner)\ No newline at end of file+ScannerRegistry.register(HoleheScanner)+ScannerRegistry.register(SireneScanner)\ No newline at end of filediff --git a/flowsint-api/app/scanners/socials/maigret.py b/flowsint-api/app/scanners/socials/maigret.pyindex 428fb749..d148fecd 100644--- a/flowsint-api/app/scanners/socials/maigret.py+++ b/flowsint-api/app/scanners/socials/maigret.py@@ -7,10 +7,13 @@ from app.utils import is_valid_username, resolve_typefrom app.scanners.base import Scannerfrom app.types.social import MinimalSocial, Socialfrom pydantic import TypeAdapter+from app.core.logger import loggerInputType: TypeAlias = List[MinimalSocial]OutputType: TypeAlias = List[Social]+false_positives = ["LeagueOfLegends"]+class MaigretScanner(Scanner):"""Scans usernames for associated social accounts using Maigret."""@@ -85,6 +88,9 @@ class MaigretScanner(Scanner):for platform, profile in raw_data.items():if profile.get("status", {}).get("status") != "Claimed":continue++ if any(fp in platform for fp in false_positives):+ continuestatus = profile.get("status", {})ids = status.get("ids", {})@@ -132,6 +138,7 @@ class MaigretScanner(Scanner):return resultsfor profile in results:+ logger.info(self.scan_id, self.sketch_id, f"{profile.username} -> account found on {profile.platform}")self.neo4j_conn.query("""MERGE (p:social_profile {profile_url: $profile_url})SET p.username = $username,diff --git a/flowsint-api/app/tasks/transform.py b/flowsint-api/app/tasks/transform.pyindex 81cafbdb..d6ebf592 100644--- a/flowsint-api/app/tasks/transform.py+++ b/flowsint-api/app/tasks/transform.py@@ -27,7 +27,7 @@ def run_scan(self, transform_schema, values: List[str], sketch_id: str | None):try:extracted = extract_transform(transform_schema)scanner_names = extracted["scanner_names"]- db.table("scans").insert({+ res = db.table("scans").insert({"id": self.request.id,"status": "pending","scanner_names": scanner_names,@@ -35,8 +35,9 @@ def run_scan(self, transform_schema, values: List[str], sketch_id: str | None):"sketch_id": sketch_id,"results": []}).execute()-- scanner = TransformOrchestrator(sketch_id, "scan_0", scanner_names = scanner_names, neo4j_conn=neo4j_connection)+ scan_id = res.data[0]["id"]+ print(scan_id)+ scanner = TransformOrchestrator(sketch_id, scan_id, scanner_names = scanner_names, neo4j_conn=neo4j_connection)results = scanner.execute(values=values)status = "finished" if "error" not in results else "error"db.table("scans").update({diff --git a/flowsint-api/app/types/organization.py b/flowsint-api/app/types/organization.pyindex 36f5ea16..18d04f3b 100644--- a/flowsint-api/app/types/organization.py+++ b/flowsint-api/app/types/organization.py@@ -7,8 +7,10 @@ class Identifier(BaseModel):country: Optional[str] = Noneissued_by: Optional[str] = None-class Organization(BaseModel):+class MinimalOrganization(BaseModel):name: str++class Organization(MinimalOrganization):founding_date: Optional[str] = Nonecountry: Optional[str] = Nonedescription: Optional[str] = Nonediff --git a/flowsint-api/test.cypher b/flowsint-api/test.cyphernew file mode 100644index 00000000..affb65ea--- /dev/null+++ b/flowsint-api/test.cypher@@ -0,0 +1,96 @@+// Définir le sketch_id+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId++// 1. Créer 3 organisations+UNWIND range(1, 3) AS i+CREATE (:Organization {+ id: randomUUID(),+ name: 'Org ' + i,+ label: 'Org ' + i,+ type: 'organization',+ sketch_id: sketchId+});++// 2. Créer 10 individuals liés aux organisations+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (org:Organization)+WITH collect(org) AS orgs, sketchId+UNWIND range(1, 10) AS i+WITH orgs[toInteger(rand() * size(orgs))] AS org, i, sketchId+CREATE (ind:Individual {+ id: randomUUID(),+ name: 'Person ' + i,+ label: 'Person ' + i,+ type: 'individual',+ sketch_id: sketchId+})+CREATE (ind)-[:WORKS_FOR { sketch_id: sketchId, type: 'WORKS_FOR', label: 'works for' }]->(org);++// 3. Créer 5 domaines liés aux organisations+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (org:Organization)+WITH collect(org) AS orgs, sketchId+UNWIND range(1, 5) AS i+WITH orgs[toInteger(rand() * size(orgs))] AS org, i, sketchId+CREATE (d:Domain {+ id: randomUUID(),+ name: 'example' + i + '.com',+ label: 'example' + i + '.com',+ type: 'domain',+ sketch_id: sketchId+})+CREATE (d)-[:OWNED_BY { sketch_id: sketchId, type: 'OWNED_BY', label: 'owned by' }]->(org);++// 4. Créer 10 subdomains liés aux domaines+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (d:Domain)+WITH collect(d) AS domains, sketchId+UNWIND range(1, 10) AS i+WITH domains[toInteger(rand() * size(domains))] AS domain, i, sketchId+CREATE (sd:Subdomain {+ id: randomUUID(),+ name: 'sub' + i + '.' + domain.name,+ label: 'sub' + i + '.' + domain.name,+ type: 'subdomain',+ sketch_id: sketchId+})+CREATE (sd)-[:SUBDOMAIN_OF { sketch_id: sketchId, type: 'SUBDOMAIN_OF', label: 'subdomain of' }]->(domain);++// 5. Créer 10 usernames liés à des individuals+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (ind:Individual)+WITH collect(ind) AS individuals, sketchId+UNWIND range(1, 10) AS i+WITH individuals[toInteger(rand() * size(individuals))] AS person, i, sketchId+CREATE (u:Username {+ id: randomUUID(),+ name: 'user' + i,+ label: 'user' + i,+ type: 'username',+ sketch_id: sketchId+})+CREATE (u)-[:ALIAS_OF { sketch_id: sketchId, type: 'ALIAS_OF', label: 'alias of' }]->(person);++// 6. Créer 10 social_profiles liés aux usernames+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (u:Username)+WITH collect(u) AS usernames, sketchId,+ ['twitter', 'linkedin', 'github', 'facebook'] AS platforms+UNWIND usernames AS uname+WITH uname, platforms[toInteger(rand() * size(platforms))] AS platform, sketchId+CREATE (sp:SocialProfile {+ id: randomUUID(),+ platform: platform,+ profile_url: 'https://' + platform + '.com/' + uname.name,+ label: uname.name + ' on ' + platform,+ type: 'social_profile',+ sketch_id: sketchId+})+CREATE (sp)-[:ASSOCIATED_WITH { sketch_id: sketchId, type: 'ASSOCIATED_WITH', label: 'associated with' }]->(uname);+++// Relier les organisations entre elles pour unifier le graphe+WITH "fe8a0a8e-2fed-4149-9353-3c1293ea6d65" AS sketchId+MATCH (o1:Organization), (o2:Organization)+WHERE id(o1) < id(o2) // éviter les doublons et self-loop+MERGE (o1)-[:RELATED_TO { sketch_id: sketchId, type: 'RELATED_TO', label: 'related to' }]->(o2)diff --git a/flowsint-api/tests/scanners/ip/__init__.py b/flowsint-api/tests/scanners/ip/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/flowsint-api/tests/scanners/organizations/__init__.py b/flowsint-api/tests/scanners/organizations/__init__.pynew file mode 100644index 00000000..e69de29bdiff --git a/flowsint-api/tests/scanners/organizations/sirene.py b/flowsint-api/tests/scanners/organizations/sirene.pynew file mode 100644index 00000000..21bb9a4a--- /dev/null+++ b/flowsint-api/tests/scanners/organizations/sirene.py@@ -0,0 +1,80 @@+import pytest+from app.scanners.organizations.sirene import SireneScanner+from app.types.organization import MinimalOrganization, Organization++scanner = SireneScanner("sketch_123", "scan_123")++def test_preprocess_valid_names():+ data = [+ MinimalOrganization(name="OpenAI"),+ {"name": "Inria"},+ "OVH"+ ]+ result = scanner.preprocess(data)+ result_names = [org.name for org in result]++ assert result_names == ["OpenAI", "Inria", "OVH"]++def test_preprocess_invalid_entries():+ data = [+ {"wrong_key": "value"},+ 123,+ None,+ "",+ {"name": ""},+ ]+ result = scanner.preprocess(data)+ assert result == []++def test_scan_enriches_organization(monkeypatch):+ mock_api_response = {+ "etablissement": {+ "siren": "123456789",+ "denomination": "OpenAI",+ "dateCreationEtablissement": "2020-01-01",+ "activitePrincipale": "Recherche IA",+ "adresseEtablissement": {+ "libelleCommuneEtablissement": "Paris"+ }+ }+ }++ class MockResponse:+ def __init__(self, json_data):+ self._json_data = json_data+ self.status_code = 200++ def json(self):+ return self._json_data++ def raise_for_status(self):+ pass++ def mock_get(url, headers, timeout):+ assert "OpenAI" in url+ return MockResponse(mock_api_response)++ monkeypatch.setattr("requests.get", mock_get)++ input_data = [MinimalOrganization(name="OpenAI")]+ result = scanner.scan(input_data)++ assert isinstance(result, list)+ assert len(result) == 1+ org = result[0]+ assert isinstance(org, Organization)+ assert org.name == "OpenAI"+ assert org.founding_date == "2020-01-01"+ assert org.country == "France"+ assert isinstance(org.identifiers, list)+ assert org.identifiers[0].type == "SIREN"+ assert org.identifiers[0].value == "123456789"++def test_schema():+ input_schema = scanner.input_schema()+ output_schema = scanner.output_schema()++ assert {'name': 'name', 'type': 'string'} in input_schema+ output_keys = [entry['name'] for entry in output_schema]+ for field in ['name', 'founding_date', 'country', 'description', 'identifiers']:+ assert field in output_keysdiff --git a/flowsint-web/package.json b/flowsint-web/package.jsonindex 3a319e85..2397b7b9 100644--- a/flowsint-web/package.json+++ b/flowsint-web/package.json@@ -82,6 +82,7 @@"react-dom": "^19.1.0","react-force-graph": "^1.47.6","react-force-graph-2d": "^1.27.1",+ "react-force-graph-3d": "^1.26.1","react-highlight-words": "^0.21.0","react-hook-form": "^7.54.2","react-markdown": "^9.0.3",@@ -93,6 +94,7 @@"tailwind-merge": "^3.0.1","tailwindcss": "^4.0.3","tailwindcss-animate": "^1.0.7",+ "three-spritetext": "^1.9.6","usehooks-ts": "^3.1.1","uuid": "^11.1.0","vaul": "^1.1.2",diff --git a/flowsint-web/public/info.svg b/flowsint-web/public/info.svgnew file mode 100644index 00000000..d8e916ad--- /dev/null+++ b/flowsint-web/public/info.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-info-icon lucide-info"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>\ No newline at end of filediff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsxindex 63c10a06..6e645e94 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/page.tsx@@ -103,21 +103,6 @@ const DashboardPage = () => {/></div><div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="outline" className="gap-2">- <SlidersHorizontal className="h-4 w-4" />- <span className="hidden sm:inline">Sort by</span>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem>Name</DropdownMenuItem>- <DropdownMenuItem>Type</DropdownMenuItem>- <DropdownMenuItem>Date created</DropdownMenuItem>- <DropdownMenuItem>Date modified</DropdownMenuItem>- <DropdownMenuItem>Size</DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu><Button onClick={handleRefetch} disabled={isLoading || isRefetching} variant={"outline"} className="gap-2"><RotateCwIcon className={cn("h-4 w-4", isLoading || isRefetching && "animate-spin")} /> Refresh</Button>diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/2d-graph.tsxsimilarity index 59%rename from flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsxrename to flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/2d-graph.tsxindex ae7d1294..b20be11f 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/2d-graph.tsx@@ -1,6 +1,6 @@"use client"-import { memo, useCallback, useEffect, useRef } from "react"+import { memo, useCallback, useEffect, useMemo, useRef } from "react"import dynamic from "next/dynamic"import { Button } from "@/components/ui/button"import Loader from "@/components/loader"@@ -12,18 +12,10 @@ import { useNodesDisplaySettings } from "@/store/node-display-settings"import type { NodeData, EdgeData } from "@/types"import { useGraphControls } from "@/store/graph-controls-store"-const ARROW_COLOR = "rgba(255, 255, 255, 0.37)";-const LINE_COLOR = "rgba(255, 255, 255, 0.21)";-const LINE_WIDTH = 1;-const ARROW_HEAD_LENGTH = 5;---const getNodeSize = (type: string) =>- ["individual", "username", "domain", "organization"].includes(type) ? 80 : 45;--const getNodeRadius = (type: string, isSelected = false) =>- getNodeSize(type) / 10 + (isSelected ? 0.5 : 0);-+const ARROW_COLOR = "rgba(136, 136, 136, 0.21)";+const LINE_COLOR = "rgba(136, 136, 136, 0.21)";+const LINE_WIDTH = .3;+const ARROW_HEAD_LENGTH = 3;const ForceGraph2D = dynamic(() => import("react-force-graph-2d").then((mod) => mod), {ssr: false,@@ -31,7 +23,7 @@ const ForceGraph2D = dynamic(() => import("react-force-graph-2d").then((mod) =>interface GraphProps {isLoading: boolean- data: { nds: Node[]; rls: EdgeData[] }+ data: { nds: NodeData[]; rls: EdgeData[] }width?: numberheight?: number}@@ -48,8 +40,8 @@ const stateSelector = (state: {currentNode: NodeData | null,selectedNodes: NodeData[],setSelectedNodes: any- panelOpen: boolean- setPanelOpen: any+ isCurrent: any,+ isSelected: any}) => ({setCurrentNode: state.setCurrentNode,toggleNodeSelection: state.toggleNodeSelection,@@ -62,13 +54,16 @@ const stateSelector = (state: {currentNode: state.currentNode,selectedNodes: state.selectedNodes,setSelectedNodes: state.setSelectedNodes,- panelOpen: state.panelOpen,- setPanelOpen: state.setPanelOpen+ isSelected: state.isSelected,+ isCurrent: state.isCurrent})const Graph = ({ data, isLoading, width, height }: GraphProps) => {const fgRef = useRef<any>(null)- const { colors, getIcon } = useNodesDisplaySettings()+ const colors = useNodesDisplaySettings(c => c.colors)+ const getIcon = useNodesDisplaySettings(c => c.getIcon)+ const getSize = useNodesDisplaySettings(c => c.getSize)+const {currentNode,selectedNodes,@@ -79,13 +74,61 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {setEdges,nodes,edges,- panelOpen,- setPanelOpen+ isSelected,+ isCurrent,} = useSketchStore(stateSelector,shallow,)+ const linkCanvaObject = useMemo(() => (link: any, ctx: any) => {+ const start = link.target as any;+ const end = link.source as any;+ if (+ !start || !end ||+ typeof start.x !== "number" || typeof start.y !== "number" ||+ typeof end.x !== "number" || typeof end.y !== "number"+ ) return;+ const dx = end.x - start.x;+ const dy = end.y - start.y;+ const angle = Math.atan2(dy, dx);+ const targetRadius = getSize(end.type) / 10;+ const tx = end.x - Math.cos(angle) * targetRadius;+ const ty = end.y - Math.sin(angle) * targetRadius;+ ctx.strokeStyle = LINE_COLOR;+ ctx.lineWidth = LINE_WIDTH;+ ctx.beginPath();+ ctx.moveTo(start.x, start.y);+ ctx.lineTo(tx, ty);+ ctx.stroke();+ ctx.fillStyle = ARROW_COLOR;+ ctx.beginPath();+ ctx.moveTo(tx, ty);+ ctx.lineTo(+ tx - ARROW_HEAD_LENGTH * Math.cos(angle - Math.PI / 10),+ ty - ARROW_HEAD_LENGTH * Math.sin(angle - Math.PI / 10)+ );+ ctx.lineTo(+ tx - ARROW_HEAD_LENGTH * Math.cos(angle + Math.PI / 10),+ ty - ARROW_HEAD_LENGTH * Math.sin(angle + Math.PI / 10)+ );+ ctx.closePath();+ ctx.fill();+ if (link.caption) {+ const midX = (start.x + tx) / 2;+ const midY = (start.y + ty) / 2;+ ctx.save();+ ctx.translate(midX, midY);+ ctx.rotate(angle);+ ctx.fillStyle = "#333";+ ctx.font = "1.5px Sans-Serif";+ ctx.textAlign = "center";+ ctx.textBaseline = "middle";+ ctx.fillText(link.caption, 0, -1);+ ctx.restore();+ }+ }, [])+const setActions = useGraphControls((s) => s.setActions);useEffect(() => {@@ -120,10 +163,7 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {const onNodeClick = useCallback((node: any, event: any) => {const multiSelect = event.ctrlKey || event.shiftKey || event.altKeytoggleNodeSelection(node, multiSelect)- if (!panelOpen) {- setPanelOpen(true)- }- }, [toggleNodeSelection, panelOpen, setPanelOpen])+ }, [toggleNodeSelection])const nodeColor = useCallback((node: any) => {@@ -156,23 +196,9 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {return (<div className="relative h-full w-full">- {/* Bouton pour ajouter un nouveau nœud */}- <div className="top-3 left-3 absolute z-50">- <NewActions addNodes={addNode}>- <Button- className="bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 px-6 py-2 text-white border-none"- size="icon"- >- <PlusIcon />- </Button>- </NewActions>- </div>-- {/* Panneau de débogage */}<div className="absolute bottom-3 left-3 z-50 bg-card p-2 rounded-lg text-xs opacity-70">Selected: {selectedNodes.length}</div>-<ForceGraph2Dref={fgRef}graphData={{ nodes, links: edges }}@@ -181,59 +207,36 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {nodeLabel="label"linkTarget="to"nodeAutoColorBy="label"- d3VelocityDecay={0.3}- d3AlphaDecay={0.05}- cooldownTicks={50}width={width}height={height}nodeColor={nodeColor}- linkCanvasObject={(link, ctx) => {- const start = link.target as any;- const end = link.source as any;- if (- !start || !end ||- typeof start.x !== "number" || typeof start.y !== "number" ||- typeof end.x !== "number" || typeof end.y !== "number"- ) return;- const dx = end.x - start.x;- const dy = end.y - start.y;- const angle = Math.atan2(dy, dx);- const targetRadius = getNodeRadius(end.type);- const tx = end.x - Math.cos(angle) * targetRadius;- const ty = end.y - Math.sin(angle) * targetRadius;- ctx.strokeStyle = LINE_COLOR;- ctx.lineWidth = LINE_WIDTH;- ctx.beginPath();- ctx.moveTo(start.x, start.y);- ctx.lineTo(tx, ty);- ctx.stroke();- ctx.fillStyle = ARROW_COLOR;- ctx.beginPath();- ctx.moveTo(tx, ty);- ctx.lineTo(- tx - ARROW_HEAD_LENGTH * Math.cos(angle - Math.PI / 10),- ty - ARROW_HEAD_LENGTH * Math.sin(angle - Math.PI / 10)- );- ctx.lineTo(- tx - ARROW_HEAD_LENGTH * Math.cos(angle + Math.PI / 10),- ty - ARROW_HEAD_LENGTH * Math.sin(angle + Math.PI / 10)- );- ctx.closePath();- ctx.fill();- if (link.caption) {- const midX = (start.x + tx) / 2;- const midY = (start.y + ty) / 2;- ctx.save();- ctx.translate(midX, midY);- ctx.rotate(angle);- ctx.fillStyle = "#333";- ctx.font = "3px Sans-Serif";- ctx.textAlign = "center";- ctx.textBaseline = "middle";- ctx.fillText(link.caption, 0, -4);- ctx.restore();- }- }}+ linkCanvasObject={linkCanvaObject}+ // onRenderFramePre={(ctx, globalScale) => {+ // const step = 50;+ // const dotSize = 1.5 * globalScale;+ // const canvas = ctx.canvas;+ // const width = canvas.width;+ // const height = canvas.height;+ // const graphCoords = fgRef.current?.screen2GraphCoords;++ // if (!graphCoords) return;++ // const topLeft = graphCoords(0, 0);+ // const bottomRight = graphCoords(width, height);++ // ctx.save();+ // ctx.clearRect(0, 0, width, height);+ // ctx.fillStyle = LINE_COLOR;+ // for (let x = Math.floor(topLeft.x / step) * step; x < bottomRight.x; x += step) {+ // for (let y = Math.floor(topLeft.y / step) * step; y < bottomRight.y; y += step) {+ // const screen = fgRef.current.graph2ScreenCoords(x, y);+ // ctx.beginPath();+ // ctx.arc(screen.x, screen.y, dotSize, 0, 2 * Math.PI);+ // ctx.fill();+ // }+ // }+ // ctx.restore();+ // }}linkWidth={link => link ? 2 : 1}onNodeClick={onNodeClick}onBackgroundClick={handleBackgroundClick}@@ -243,11 +246,11 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {node.fz = node.z}}nodeCanvasObject={(node: any, ctx, globalScale) => {- const isSelected = selectedNodes.some(n => n.id === node.id);- const isCurrent = currentNode?.id === node.id;+ const isNodeSelected = isSelected(node.id)+ const isNodeCurrent = isCurrent(node.id)const color = colors[node.type as keyof typeof colors]- const nodeSize = ["individual", "username", "domain", "organization"].includes(node?.type) ? 80 : 45- const radius = nodeSize / 10 + (isSelected ? 0.5 : 0)+ const nodeSize = getSize(node?.type)+ const radius = nodeSize / 10 + (isNodeSelected ? 0.5 : 0)const fontSize = globalScale * 0.2462ctx.font = `${fontSize}px Sans-Serif`ctx.fillStyle = color@@ -257,11 +260,11 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {ctx.beginPath()ctx.arc(node.x!, node.y!, radius, 0, 2 * Math.PI, false)ctx.strokeStyle = color || "black"- ctx.lineWidth = isSelected ? 0.5 : 0.2+ ctx.lineWidth = isNodeSelected ? 0.5 : 0.2ctx.stroke()- const size = ["individual", "username", "domain", "organization"].includes(node?.type) ? 8 : 4+ const size = nodeSize / 10ctx.drawImage(getIcon(node.type), node.x - size / 2, node.y - size / 2, size, size);- if (isSelected) {+ if (isNodeSelected) {ctx.beginPath()ctx.arc(node.x!, node.y!, radius + 0.8, 0, 2 * Math.PI, false)ctx.strokeStyle = '#FFCC00'@@ -269,12 +272,12 @@ const Graph = ({ data, isLoading, width, height }: GraphProps) => {ctx.stroke()if (node.label) {ctx.fillStyle = '#FFFFFF'- ctx.font = `bold ${fontSize * 1.2}px Sans-Serif`+ ctx.font = `${fontSize} Sans-Serif`ctx.textAlign = 'center'ctx.fillText(node.label, node.x!, node.y! + radius + 4.5)}}- if (isCurrent) {+ if (isNodeCurrent) {ctx.beginPath()ctx.arc(node.x!, node.y!, radius + 1.5, 0, 2 * Math.PI, false)ctx.strokeStyle = 'white'diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/3d-graph.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/3d-graph.tsxnew file mode 100644index 00000000..991c362f--- /dev/null+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/3d-graph.tsx@@ -0,0 +1,116 @@+// components/Graph.tsx++"use client"++import { useCallback, useRef, useMemo, useEffect } from "react"+import dynamic from "next/dynamic"+import SpriteText from "three-spritetext"+import { ForceGraphMethods } from "react-force-graph-3d"+import { EdgeData, NodeData } from "@/types"+import { useSketchStore } from "@/store/sketch-store"+import { shallow } from "zustand/shallow"++const ForceGraph3D = dynamic(+ () => import("react-force-graph-3d").then((mod) => mod.default),+ { ssr: false }+)++interface Node {+ id: string+ label: string+ type?: string+ [key: string]: any+}++interface Edge {+ from: string+ to: string+}++interface GraphProps {+ isLoading: boolean+ data: { nds: NodeData[]; rls: EdgeData[] }+ width?: number+ height?: number+}+++const stateSelector = (state: {+ nodes: NodeData[]+ edges: EdgeData[]+ setNodes: any+ setEdges: any++}) => ({+ nodes: state.nodes,+ edges: state.edges,+ setNodes: state.setNodes,+ setEdges: state.setEdges,+})++const Graph: React.FC<GraphProps> = ({ data, isLoading, width, height }) => {+ const fgRef = useRef<any>(null)++ const {+ setNodes,+ setEdges,+ nodes,+ edges+ } = useSketchStore(+ stateSelector,+ shallow,+ )++ const nodeColor = useCallback((node: Node) => {+ switch (node.type) {+ case "organization":+ return "#4ade80" // vert+ case "individual":+ return "#60a5fa" // bleu+ case "email":+ return "#facc15" // jaune+ case "phone":+ return "#f472b6" // rose+ case "social":+ return "#38bdf8" // cyan+ default:+ return "#cbd5e1" // gris clair+ }+ }, [])++ const nodeThreeObject = useCallback((node: Node) => {+ const sprite = new SpriteText(node.label || node.id)+ sprite.color = nodeColor(node)+ sprite.textHeight = 8+ return sprite+ }, [nodeColor])++ useEffect(() => {+ if (isLoading) return+ if (data?.nds) setNodes(data.nds)+ if (data?.rls) setEdges(data.rls)+ }, [data?.nds, data?.rls, isLoading, setNodes, setEdges])+ return (+ <div className="relative h-full w-full bg-card">+ <ForceGraph3D+ ref={fgRef}+ graphData={{ nodes, links: edges }}+ nodeId="id"+ nodeLabel="label"+ nodeAutoColorBy="type"+ nodeThreeObject={nodeThreeObject}+ linkDirectionalArrowLength={4}+ linkDirectionalArrowRelPos={1}+ width={width}+ height={height}+ onNodeDragEnd={(node: any) => {+ node.fx = node.x+ node.fy = node.y+ node.fz = node.z+ }}+ />+ </div>+ )+}++export default Graphdiff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsxindex 090eebc2..3fcfd3c5 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/console-panel.tsx@@ -1,52 +1,154 @@-import { CopyButton } from '@/components/copy'-import { Button } from '@/components/ui/button'-import { ScrollArea } from '@/components/ui/scroll-area'-import { ChevronDown, Database, FileText, Grid, List } from 'lucide-react'-import { memo } from 'react'+"use client"++import { CopyButton } from "@/components/copy"+import { Button } from "@/components/ui/button"+import { useConfirm } from "@/components/use-confirm-dialog"+import { supabase } from "@/lib/supabase/client"+import { TrashIcon } from "lucide-react"+import { useParams } from "next/navigation"+import { memo, useCallback, useEffect, useRef, useState } from "react"+import { toast } from "sonner"++type LogEntry = {+ id?: string+ type: "INFO" | "WARNING" | "ERROR" | "SUCCESS"+ timestamp: string+ content: string+ created_at?: string+}++const typeToClass: Record<string, string> = {+ INFO: "text-foreground",+ WARNING: "text-amber-500",+ ERROR: "text-destructive",+ SUCCESS: "text-green-500",+}export const ConsolePanel = memo(function ConsolePanel() {- // Sample log entries for the console panel- const logEntries = [- { type: "info", timestamp: "14:32:15", message: 'Loading graph "Investigation 1"' },- { type: "info", timestamp: "14:32:16", message: "Graph loaded successfully" },- { type: "action", timestamp: "14:33:05", message: "Running transform: Email to Domain" },- { type: "info", timestamp: "14:33:07", message: "Transform completed: 1 entity added" },- { type: "warning", timestamp: "14:33:10", message: "Rate limit approaching for API: hunter.io" },- { type: "error", timestamp: "14:34:22", message: "Transform failed: API key invalid" },- { type: "info", timestamp: "14:35:01", message: "Entity added: IP Address 192.168.1.1" },- ]+ const [logEntries, setLogEntries] = useState<LogEntry[]>([])+ const { sketch_id } = useParams()+ const bottomRef = useRef<HTMLDivElement | null>(null)+ const { confirm } = useConfirm()++ const refetch = useCallback(async () => {+ const { data, error } = await supabase+ .from("logs")+ .select("*")+ .eq("sketch_id", sketch_id)+ .order("created_at", { ascending: true })+ .limit(50)+ if (error) {+ console.error("Error fetching logs:", error)+ return+ }+ if (data) {+ const formattedLogs = data.map((log: any) => ({+ id: log.id,+ type: log.type || "INFO",+ timestamp: new Date(log.created_at).toLocaleTimeString(),+ content: log.content,+ created_at: log.created_at,+ }))+ setLogEntries(formattedLogs)+ }+ }, [sketch_id])++ const handleDeleteLogs = useCallback(async () => {+ try {+ const confirmed = await confirm({+ title: "Deleting logs",+ message: "Are you sure you want to delete these logs ?",+ })++ if (!confirmed) return++ const { error } = await supabase+ .from("logs")+ .delete()+ .eq("sketch_id", sketch_id)++ if (error) {+ toast.error("An error occurred deleting the logs.")+ return+ }++ toast.success("Logs cleared.")+ refetch()+ } catch (e) {+ toast.error("An error occurred deleting the logs.")+ }+ }, [confirm, sketch_id, refetch])++ useEffect(() => {+ refetch()++ const subscription = supabase+ .channel("logs-channel")+ .on(+ "postgres_changes",+ {+ event: "INSERT",+ schema: "public",+ table: "logs",+ filter: `sketch_id=eq.${sketch_id}`,+ },+ (payload) => {+ const newLog = payload.new as any+ const formattedLog: LogEntry = {+ id: newLog.id,+ type: newLog.type || "INFO",+ timestamp: new Date(newLog.created_at).toLocaleTimeString(),+ content: newLog.content,+ created_at: newLog.created_at,+ }+ setLogEntries((prevLogs) => [...prevLogs, formattedLog])+ }+ )+ .subscribe()++ return () => {+ subscription.unsubscribe()+ }+ }, [refetch])++ useEffect(() => {+ bottomRef.current?.scrollIntoView({ behavior: "smooth" })+ }, [logEntries])return (<div className="flex grow flex-col h-full">- <div className="flex h-8 items-center bg-card py-2 justify-between border-b px-4">+ <div className="flex h-8 items-center bg-card py-2 justify-between border-b pl-4 pr-2"><h2 className="font-medium text-sm">Console</h2><div className="flex items-center gap-1">- {/* <Button variant="ghost" size="icon" className="h-6 w-6">- <Grid className="h-4 w-4 opacity-70" />- </Button>- <Button variant="ghost" size="icon" className="h-6 w-6">- <List className="h-4 w-4 opacity-70" />- </Button>- <Button variant="ghost" size="icon" className="h-6 w-6">- <FileText className="h-4 w-4 opacity-70" />- </Button>- <Button variant="ghost" size="icon" className="h-6 w-6">- <Database className="h-4 w-4 opacity-70" />- </Button> */}<CopyButton content={JSON.stringify(logEntries)} />+ <Button+ disabled={!logEntries.length}+ onClick={handleDeleteLogs}+ className="h-7 w-7"+ variant="ghost"+ size="icon"+ >+ <TrashIcon className="!h-3.5 !w-3.5 opacity-50" />+ </Button></div></div><div className="p-2 font-mono text-xs bg-card grow overflow-auto inset-shadow-sm">- {logEntries.map((entry, index) => (- <div key={index} className="mb-1 flex">- <span className="mr-2 text-primary font-bold">[{entry.timestamp}]</span>- <span- >- {entry.message}- </span>- </div>- ))}+ {logEntries.length > 0 ? (+ <>+ {logEntries.map((entry, index) => (+ <div key={entry.id || index} className="mb-1 flex">+ <span className="mr-2 text-primary font-bold">[{entry.timestamp}]</span>+ <span className={typeToClass[entry.type] || ""}>+ {entry.content}+ </span>+ </div>+ ))}+ <div ref={bottomRef} />+ </>+ ) : (+ <div className="text-muted-foreground italic">No logs available</div>+ )}</div></div>)-})\ No newline at end of file+})diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/draggable-item.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/draggable-item.tsxindex 6c02b088..a8529398 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/draggable-item.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/draggable-item.tsx@@ -1,16 +1,19 @@"use client"+import type { LucideIcon } from "lucide-react"+import { memo, useState } from "react"import { IconContainer } from "@/components/icon-container"-import { LucideIcon } from "lucide-react"-import { memo } from "react"+import { useSketchStore } from "@/store/sketch-store"+import { cn } from "@/lib/utils"-export interface DraggableItemProps {+interface DraggableItemProps {label: stringicon: LucideIcontype: stringcolor?: stringdisabled?: boolean- description?: string+ description: string+ itemKey: string}export const DraggableItem = memo(function DraggableItem({@@ -18,27 +21,51 @@ export const DraggableItem = memo(function DraggableItem({icon,type,color,+ itemKey,disabled = false,description,}: DraggableItemProps) {+ const handleOpenFormModal = useSketchStore((s) => s.handleOpenFormModal)+ const [isDragging, setIsDragging] = useState(false)++ const handleDragStart = (e: React.DragEvent<HTMLButtonElement>) => {+ const itemData = JSON.stringify({ label, type, color, description, itemKey })+ e.dataTransfer.setData("text/plain", itemData)+ setIsDragging(true)+ }++ const handleDragEnd = () => {+ setIsDragging(false)+ }++ const onClick = () => {+ if (disabled) return+ handleOpenFormModal(itemKey)+ }+return (- <div+ <buttondraggable={!disabled}- className="px-2 py-1 rounded-md relative overflow-hidden border-l-primary cursor-grab bg-card border hover:shadow-md transition-shadow"- style={{- borderLeftWidth: "4px",- borderLeftColor: color,- cursor: disabled ? "not-allowed" : "grab",- opacity: disabled ? 0.5 : 1,- }}+ onClick={onClick}+ onDragStart={handleDragStart}+ onDragEnd={handleDragEnd}+ className={cn(+ "px-2 py-1 rounded-md relative overflow-hidden border-l-4 bg-card border hover:shadow-md transition-shadow w-full text-left",+ {+ "opacity-50": isDragging || disabled,+ "cursor-not-allowed": disabled,+ "cursor-grab": !disabled,+ }+ )}+ style={{ borderLeftColor: color }}>- <div className="flex justify-start items-center gap-2">+ <div className="flex justify-start items-center w-full gap-2"><IconContainer icon={icon} color={color} type={type} />- <div className="space-y-1">- <h3 className="text-sm font-medium">{label}</h3>- <p className="text-xs text-muted-foreground">{description || label}</p>+ <div className="space-y-1 truncate">+ <h3 className="text-sm font-medium truncate">{label}</h3>+ <p className="text-xs text-muted-foreground truncate">{description || label}</p></div></div>- </div>+ </button>)})diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsxindex 3a29442d..d7d64b6e 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/graph-panel.tsx@@ -1,7 +1,15 @@-import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable'-import { ConsolePanel } from './console-panel'-import { memo, useState, useRef, useEffect } from 'react'-import Graph from './graph'+"use client"++import type React from "react"++import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "@/components/ui/resizable"+import { ConsolePanel } from "./console-panel"+import { memo, useState, useRef, useEffect } from "react"+import Graph2d from "./2d-graph"+import Graph3d from "./3d-graph"+import { useQueryState } from "nuqs"+import { useSketchStore } from "@/store/sketch-store"+import { cn } from "@/lib/utils"interface GraphPanelProps {query: any@@ -9,15 +17,19 @@ interface GraphPanelProps {export const GraphPanel = memo(function GraphPanel({ query }: GraphPanelProps) {const [isBottomPanelCollapsed, setIsBottomPanelCollapsed] = useState(false)+ const [graphView] = useQueryState("graphView", { defaultValue: "2d" })const [panelDimensions, setPanelDimensions] = useState({ width: 0, height: 0 })+ const [isDraggingOver, setIsDraggingOver] = useState(false)+ const handleOpenFormModal = useSketchStore(s => s.handleOpenFormModal)+const graphPanelRef = useRef<HTMLDivElement>(null)+const updatePanelDimensions = () => {if (!graphPanelRef.current) return-const rect = graphPanelRef.current.getBoundingClientRect()setPanelDimensions({width: rect.width,- height: rect.height+ height: rect.height,})}useEffect(() => {@@ -33,32 +45,68 @@ export const GraphPanel = memo(function GraphPanel({ query }: GraphPanelProps) {}}, [])useEffect(() => {- window.addEventListener('resize', updatePanelDimensions)+ window.addEventListener("resize", updatePanelDimensions)return () => {- window.removeEventListener('resize', updatePanelDimensions)+ window.removeEventListener("resize", updatePanelDimensions)}}, [])+ // Handle drag events+ const handleDragOver = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault()+ setIsDraggingOver(true)+ }++ const handleDragEnter = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault()+ setIsDraggingOver(true)+ }++ const handleDragLeave = () => {+ setIsDraggingOver(false)+ }++ const handleDrop = (e: React.DragEvent<HTMLDivElement>) => {+ e.preventDefault()+ setIsDraggingOver(false)+ const data = e.dataTransfer.getData("text/plain")+ if (data) {+ try {+ const parsedData = JSON.parse(data)+ handleOpenFormModal(parsedData.itemKey)+ } catch (error) {+ return+ }+ }+ }+return (<div className="flex flex-col h-full"><div className="grow">- <ResizablePanelGroup- direction="vertical"- className="h-full"- onLayout={updatePanelDimensions}- >- <ResizablePanel- defaultSize={80}- className="h-full w-full bg-background"- onResize={updatePanelDimensions}- >- <div ref={graphPanelRef} className="h-full w-full">- <Graph- data={query.data}- isLoading={query.isLoading}- width={panelDimensions.width}- height={panelDimensions.height}- />+ <ResizablePanelGroup direction="vertical" className="h-full" onLayout={updatePanelDimensions}>+ <ResizablePanel defaultSize={80} className="h-full w-full bg-background" onResize={updatePanelDimensions}>+ <div+ ref={graphPanelRef}+ className={cn('h-full w-full transition-all duration-200 border-2 border-transparent', isDraggingOver && "bg-primary/10 border-dashed border-primary/40")} onDragOver={handleDragOver}+ onDragEnter={handleDragEnter}+ onDragLeave={handleDragLeave}+ onDrop={handleDrop}+ >+ {graphView === "3d" ? (+ <Graph3d+ data={query.data}+ isLoading={query.isLoading}+ width={panelDimensions.width}+ height={panelDimensions.height}+ />+ ) : (+ <Graph2d+ data={query.data}+ isLoading={query.isLoading}+ width={panelDimensions.width}+ height={panelDimensions.height}+ />+ )}</div></ResizablePanel><ResizableHandle withHandle />@@ -66,12 +114,13 @@ export const GraphPanel = memo(function GraphPanel({ query }: GraphPanelProps) {defaultSize={20}minSize={10}maxSize={40}+ collapsedSize={2}collapsible={true}onCollapse={() => setIsBottomPanelCollapsed(true)}onExpand={() => setIsBottomPanelCollapsed(false)}onResize={updatePanelDimensions}>- <ConsolePanel />+ {!isBottomPanelCollapsed && <ConsolePanel />}</ResizablePanel></ResizablePanelGroup></div>diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsxindex f37b0bbe..0db39fc4 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/left-panel.tsx@@ -3,10 +3,14 @@import { Button } from "@/components/ui/button"import { ResizablePanel } from "@/components/ui/resizable"import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/ui/accordion"-import { ChevronRight } from "lucide-react"-import { memo, useCallback } from "react"-import { actionItems } from "@/lib/action-items"+import { PlusIcon, Search } from "lucide-react"+import { memo, useCallback, useMemo, useState } from "react"+import { ActionItem, actionItems } from "@/lib/action-items"import { DraggableItem } from "./draggable-item"+import { Input } from "@/components/ui/input"+import NewActions from "@/components/sketches/new-actions"+import { useSketchStore } from "@/store/sketch-store"+import { flattenArray } from "@/lib/utils"interface LeftPanelProps {isCollapsed: boolean@@ -14,8 +18,23 @@ interface LeftPanelProps {}export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }: LeftPanelProps) {+ const [searchQuery, setSearchQuery] = useState<string>("")const handleExpand = useCallback(() => setIsCollapsed(false), [setIsCollapsed])const handleCollapse = useCallback(() => setIsCollapsed(true), [setIsCollapsed])+ const addNode = useSketchStore((state) => state.addNode)++ const handleSearchChange = useCallback((e: React.ChangeEvent<HTMLInputElement>) => {+ setSearchQuery(e.target.value)+ }, [])++ const filteredActionItems = useMemo(() => {+ const searchText = searchQuery.toLowerCase()+ const items = flattenArray(actionItems, "children")+ return items?.filter((node: ActionItem) => {+ return node?.key?.toLowerCase().includes(searchText)+ })+ }, [actionItems, searchQuery])+return (<ResizablePanel@@ -24,15 +43,35 @@ export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }maxSize={25}className="h-[calc(100vh_-_92px)] bg-card"collapsible={true}- collapsedSize={2}+ collapsedSize={1}onCollapse={handleCollapse}onExpand={handleExpand}>{!isCollapsed ? (<div className="overflow-auto bg-card h-full flex flex-col w-full !p-0 !m-0"><div className="p-4">+ <div className="flex items-center gap-2 mb-3">+ <div className="relative grow">+ <Search className="absolute left-2.5 top-1.5 h-4 w-4 text-muted-foreground" />+ <Input+ type="search"+ placeholder="Search type..."+ className="pl-8 h-7"+ value={searchQuery}+ onChange={handleSearchChange}+ />+ </div>+ <NewActions addNodes={addNode}>+ <Button+ className="h-7 w-7 bg-gradient-to-r from-primary to-primary/80 hover:from-primary/90 hover:to-primary transition-all duration-300 text-white border-none"+ size="icon"+ >+ <PlusIcon />+ </Button>+ </NewActions>+ </div><div className="grid grid-cols-1 gap-2">- {actionItems.map((item) => {+ {actionItems.map((item: ActionItem) => {if (item.children && item.children.length > 0) {return (<Accordion key={item.id} type="single" collapsible className="border-b border-border">@@ -48,6 +87,7 @@ export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }{item.children.map((childItem) => (<DraggableItemkey={childItem.id}+ itemKey={childItem.key}label={childItem.label}icon={childItem.icon}type={childItem.type}@@ -62,11 +102,11 @@ export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }</Accordion>)}-return (<DraggableItemkey={item.id}label={item.label}+ itemKey={item.key}icon={item.icon}type={item.type}color={item.color}@@ -80,9 +120,9 @@ export const LeftPanel = memo(function LeftPanel({ isCollapsed, setIsCollapsed }</div>) : (<div className="flex h-full items-center justify-center">- <Button variant="ghost" size="icon" className="h-8 w-8" onClick={handleExpand}>+ {/* <Button variant="ghost" size="icon" className="h-8 w-8" onClick={handleExpand}><ChevronRight className="h-4 w-4" />- </Button>+ </Button> */}</div>)}</ResizablePanel>diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsxindex 2720fae3..28b4dd9e 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/right-panel.tsx@@ -41,7 +41,7 @@ export const RightPanel = memo(function RightPanel({ isCollapsed, isLoading, setmaxSize={40}className="h-full bg-card"collapsible={true}- collapsedSize={2}+ collapsedSize={1}onCollapse={() => setIsCollapsed(true)}onExpand={() => setIsCollapsed(false)}>@@ -86,9 +86,6 @@ export const RightPanel = memo(function RightPanel({ isCollapsed, isLoading, set</ResizablePanelGroup>) : (<div className="flex h-full items-center justify-center">- <Button variant="ghost" size="icon" className="h-8 w-8" onClick={() => setIsCollapsed(false)}>- <ChevronLeft className="h-4 w-4" />- </Button></div>)}</ResizablePanel>diff --git a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsxindex 1409f4a4..a8148d90 100644--- a/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx+++ b/flowsint-web/src/app/dashboard/investigations/[investigation_id]/sketches/[sketch_id]/toolbar.tsx@@ -5,6 +5,7 @@ import { DownloadButton } from "@/components/download-button"import MoreMenu from "@/components/sketches/more-menu"import { ScanButton } from "@/components/sketches/scans-drawer/scan-button"import { Button } from "@/components/ui/button"+import { Toggle } from "@/components/ui/toggle"import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip"import { cn } from "@/lib/utils"import { useGraphControls } from "@/store/graph-controls-store"@@ -23,12 +24,14 @@ import {Maximize,Minus,Redo,+ Rotate3DIcon,RotateCwIcon,Trash,Undo,ZoomIn,} from "lucide-react"import { notFound } from "next/navigation"+import { useQueryState } from "nuqs"import { memo, useMemo } from "react"import { shallow } from "zustand/shallow"@@ -84,11 +87,12 @@ export const Toolbar = memo(function Toolbar({}),shallow)- const { toggleSettings } = useModalStore()-+ const toggleSettings = useModalStore((s) => s.toggleSettings)const zoomToFit = useGraphControls((s) => s.zoomToFit);const zoomIn = useGraphControls((s) => s.zoomIn);const zoomOut = useGraphControls((s) => s.zoomOut);+ const [_, setGraphView] = useQueryState("graphView", { defaultValue: "2d" })+const { refetch, isRefetching } = useQuery({queryKey: ["investigations", investigation_id, 'sketches', sketch_id, "data"],@@ -116,8 +120,8 @@ export const Toolbar = memo(function Toolbar({<div className="flex items-center justify-between h-10 border-b px-2 bg-card"><div className="flex items-center space-x-1"><TooltipProvider>- <ToolbarButton icon={<Undo className="h-4 w-4 opacity-70" />} tooltip="Undo" />- <ToolbarButton icon={<Redo className="h-4 w-4 opacity-70" />} tooltip="Redo" />+ <ToolbarButton disabled icon={<Undo className="h-4 w-4 opacity-70" />} tooltip="Undo" />+ <ToolbarButton disabled icon={<Redo className="h-4 w-4 opacity-70" />} tooltip="Redo" /><Separator /><ToolbarButtonicon={<Copy className="h-4 w-4 opacity-70" />}@@ -130,8 +134,8 @@ export const Toolbar = memo(function Toolbar({disabled={!currentNode}/><Separator />- <ToolbarButton icon={<ArrowDownUp className="h-4 w-4 opacity-70" />} tooltip="Arrange" />- <ToolbarButton icon={<Filter className="h-4 w-4 opacity-70" />} tooltip="Filter" />+ <ToolbarButton disabled icon={<ArrowDownUp className="h-4 w-4 opacity-70" />} tooltip="Arrange" />+ <ToolbarButton disabled icon={<Filter className="h-4 w-4 opacity-70" />} tooltip="Filter" /><Separator /><ToolbarButtonicon={<ZoomIn className="h-4 w-4 opacity-70" />}@@ -149,9 +153,14 @@ export const Toolbar = memo(function Toolbar({onClick={zoomToFit}/><Separator />- <ToolbarButton icon={<LayoutGrid className="h-4 w-4 opacity-70" />} tooltip="Layout" />- <ToolbarButton icon={<Layers className="h-4 w-4 opacity-70" />} tooltip="Layers" />+ <ToolbarButton disabled icon={<LayoutGrid className="h-4 w-4 opacity-70" />} tooltip="Layout" />+ <ToolbarButton disabled icon={<Layers className="h-4 w-4 opacity-70" />} tooltip="Layers" /><ToolbarButton onClick={toggleSettings} icon={<GearIcon className="h-4 w-4 opacity-70" />} tooltip="Settings" />+ <Separator />+ <Toggle className="h-8 w-8" onClick={() => setGraphView((prev) => prev === "2d" ? "3d" : "2d")} aria-label="Toggle italic">+ <Rotate3DIcon className={cn("h-4 w-4 opacity-70")} />+ </Toggle>+ <Separator /><ToolbarButton onClick={refetch} disabled={isRefetching} icon={<RotateCwIcon className={cn("h-4 w-4 opacity-70", isRefetching && "animate-spin")} />} tooltip="Reload" /></TooltipProvider></div>diff --git a/flowsint-web/src/app/dashboard/investigations/page.tsx b/flowsint-web/src/app/dashboard/investigations/page.tsxindex c160362e..60340bd3 100644--- a/flowsint-web/src/app/dashboard/investigations/page.tsx+++ b/flowsint-web/src/app/dashboard/investigations/page.tsx@@ -66,7 +66,7 @@ const DashboardPage = () => {</div></Card><div className="flex items-center gap-2">- <div className="flex items-center border bg-card rounded-md overflow-hidden">+ {/* <div className="flex items-center border bg-card rounded-md overflow-hidden"><Buttonvariant="ghost"size="icon"@@ -83,7 +83,7 @@ const DashboardPage = () => {><List className="h-4 w-4" /></Button>- </div>+ </div> */}<NewInvestigation><Button className="gap-2"><PlusIcon className="h-4 w-4" /> New@@ -96,20 +96,6 @@ const DashboardPage = () => {</div><div className="flex items-center gap-2 justify-between mb-6"><div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="outline" size="sm" className="gap-2">- <SlidersHorizontal className="h-4 w-4 opacity-60" />- <span className="hidden sm:inline">Sort by</span>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem>Name</DropdownMenuItem>- <DropdownMenuItem>Date created</DropdownMenuItem>- <DropdownMenuItem>Date modified</DropdownMenuItem>- <DropdownMenuItem>Size</DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu><Button onClick={() => refetch()} disabled={isLoading || isRefetching} variant={"outline"} size="sm" className="gap-2"><RotateCwIcon className={cn("h-4 w-4", isLoading || isRefetching && "animate-spin")} /> Refresh</Button>diff --git a/flowsint-web/src/app/dashboard/page.tsx b/flowsint-web/src/app/dashboard/page.tsxindex a64d39aa..df7e4ed3 100644--- a/flowsint-web/src/app/dashboard/page.tsx+++ b/flowsint-web/src/app/dashboard/page.tsx@@ -1,10 +1,181 @@+// "use client"++// import { useState } from "react"+// import { Button } from "@/components/ui/button"+// import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"+// import { FolderLockIcon, MoreHorizontal, PlusIcon, RotateCwIcon } from "lucide-react"+// import { useQuery } from "@tanstack/react-query"+// import { notFound } from "next/navigation"+// import Loader from "@/components/loader"+// import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"+// import { format, formatDistanceToNow } from "date-fns"+// import Link from "next/link"+// import { Investigation } from "@/types/investigation"+// import RecentSketches from "@/components/dashboard/recent-sketches"+// import NewInvestigation from "@/components/dashboard/new-investigation"+// import { AvatarList } from "@/components/avatar-list"+// import { cn } from "@/lib/utils"+// import { SubNav } from "@/components/dashboard/sub-nav"+// import { Card } from "@/components/ui/card"+// import StatusBadge from "@/components/investigations/status-badge"+// import { InvestigationGraph } from "@/components/dashboard/charts/investigation-chart"+// import { MetricsChart } from "@/components/dashboard/charts/metrics-chart"+// import { DateRangePicker } from "@/components/date-range-picker"+// const DashboardPage = () => {++// const { data, isLoading, refetch, isRefetching } = useQuery({+// queryKey: ["dashboard", "investigations"],+// queryFn: async () => {+// const res = await fetch(`/api/investigations`)+// if (!res.ok || res.status === 404) {+// notFound()+// }+// return res.json()+// },+// refetchOnWindowFocus: true,+// })+// const investigations = data?.investigations || []++// return (+// <>+// <div className="sticky z-40 bg-card w-full hidden md:flex top-[48px] border-b">+// <SubNav />+// </div>+// <div className="w-full space-y-4 container mx-auto py-12 px-8">+// <div className="flex grow items-center justify-between w-full gap-4">+// <h1 className="font-bold text-2xl">Overview</h1>+// <div className="flex items-center gap-2">+// <DateRangePicker />+// <NewInvestigation>+// <Button className="gap-2">+// <PlusIcon className="h-4 w-4" /> New+// </Button>+// </NewInvestigation>+// </div>+// </div>+// {/* <SectionCards /> */}+// <div className="grid lg:grid-cols-5 gap-4 w-full">+// <div className="lg:col-span-2 col-span-1 h-full">+// <MetricsChart />+// </div>+// {/* <div className="col-span-1 h-full">+// <MetricsChart />+// </div> */}+// <div className="lg:col-span-3 col-span-1 h-full">+// <InvestigationGraph />+// </div>+// </div>+// <h2 className="font-bold text-2xl mt-8">Recent sketches</h2>+// <RecentSketches limit={4} />+// <div className="flex items-center gap-2 justify-between mb-6">+// <div className="flex items-center gap-2">+// <Button onClick={() => refetch()} disabled={isLoading || isRefetching} variant={"outline"} size="sm" className="gap-2">+// <RotateCwIcon className={cn("h-4 w-4", isLoading || isRefetching && "animate-spin")} /> Refresh+// </Button>+// </div>+// </div>+// {isLoading ? (+// <Loader label="Loading..." />+// ) : (+// <Card className="border rounded-md bg-card shadow-xs">+// <Table>+// <TableHeader>+// <TableRow>+// <TableHead>Name</TableHead>+// <TableHead className="hidden md:table-cell">Status</TableHead>+// <TableHead className="hidden md:table-cell">Size</TableHead>+// <TableHead className="hidden sm:table-cell">Last modified</TableHead>+// <TableHead className="hidden sm:table-cell">Members</TableHead>+// <TableHead className="hidden sm:table-cell">Creation</TableHead>+// <TableHead className="w-[50px]"></TableHead>+// </TableRow>+// </TableHeader>+// <TableBody>+// {investigations.length === 0 ? (+// <TableRow>+// <TableCell colSpan={7} className="text-center py-8 text-muted-foreground">+// <div className="flex items-center flex-col gap-3">No investigations yet+// <div className="mt-4">+// <NewInvestigation noDropDown>+// <Button size="sm" className="gap-2">+// <PlusIcon className="h-4 w-4" /> Create a new investigation+// </Button>+// </NewInvestigation>+// </div>+// </div>+// </TableCell>+// </TableRow>+// ) : (+// investigations.map((investigation: Investigation) => (+// <TableRow key={investigation.id}>+// <TableCell>+// <Link href={`/dashboard/investigations/${investigation.id}`} className="flex items-center gap-2 hover:underline font-medium">+// <FolderLockIcon className="h-5 w-5 text-muted-foreground opacity-60" />+// <span>{investigation.name}</span>+// </Link>+// </TableCell>+// <TableCell className="hidden md:table-cell text-muted-foreground">+// <StatusBadge status={investigation.status as string} />+// </TableCell>+// <TableCell className="hidden md:table-cell text-muted-foreground">+// {(investigation.sketches?.length || 0) > 0 ? `${investigation.sketches.length} items` : "Empty"}+// </TableCell>+// <TableCell className="hidden sm:table-cell text-muted-foreground">+// {formatDistanceToNow(new Date(investigation.last_updated_at), { addSuffix: true })}+// </TableCell>+// <TableCell className="hidden sm:table-cell text-muted-foreground">+// <AvatarList+// size="md"+// users={+// investigation?.members?.map(member => ({+// ...member.profile,+// owner: member.profile.id === investigation.owner_id,+// })) || []+// }+// />+// </TableCell>+// <TableCell className="hidden sm:table-cell text-muted-foreground">+// {format(new Date(investigation.created_at), "dd.MM.yyyy")}+// </TableCell>+// <TableCell>+// <DropdownMenu>+// <DropdownMenuTrigger asChild>+// <Button variant="ghost" size="icon" className="h-10 w-8">+// <MoreHorizontal className="h-4 w-4" />+// <span className="sr-only">Actions</span>+// </Button>+// </DropdownMenuTrigger>+// <DropdownMenuContent align="end">+// <DropdownMenuItem>Open</DropdownMenuItem>+// <DropdownMenuItem>Rename</DropdownMenuItem>+// <DropdownMenuItem>Share</DropdownMenuItem>+// <DropdownMenuItem className="text-destructive">Delete</DropdownMenuItem>+// </DropdownMenuContent>+// </DropdownMenu>+// </TableCell>+// </TableRow>+// ))+// )}+// </TableBody>+// </Table>+// </Card>+// )}+// </div>+// </>+// )+// }++// export default DashboardPage+++"use client"import { useState } from "react"import { Button } from "@/components/ui/button"import { Input } from "@/components/ui/input"import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"-import { ChevronDown, FolderLockIcon, Grid, List, MoreHorizontal, PlusIcon, RotateCwIcon, Search, SlidersHorizontal, TrendingDownIcon, TrendingUpIcon } from "lucide-react"+import { ChevronDown, FolderLockIcon, Grid, List, MoreHorizontal, PlusIcon, RotateCwIcon, Search, SlidersHorizontal } from "lucide-react"import { useQuery } from "@tanstack/react-query"import { notFound } from "next/navigation"import Loader from "@/components/loader"@@ -19,10 +190,7 @@ import { cn } from "@/lib/utils"import { SubNav } from "@/components/dashboard/sub-nav"import { Card } from "@/components/ui/card"import StatusBadge from "@/components/investigations/status-badge"-import { InvestigationGraph } from "@/components/dashboard/charts/investigation-chart"-import { MetricsChart } from "@/components/dashboard/charts/metrics-chart"-import { SectionCards } from "@/components/investigations/section-cards"-import { DateRangePicker } from "@/components/date-range-picker"+const DashboardPage = () => {const [searchQuery, setSearchQuery] = useState("")const [viewMode, setViewMode] = useState<"grid" | "list">("grid")@@ -48,11 +216,45 @@ const DashboardPage = () => {<div className="sticky z-40 bg-card w-full hidden md:flex top-[48px] border-b"><SubNav /></div>- <div className="w-full space-y-4 container mx-auto py-12 px-8">- <div className="flex grow items-center justify-between w-full gap-4">- <h1 className="font-bold text-2xl">Overview</h1>+ <div className="w-full space-y-8 container mx-auto py-12 px-8">+ <div className="flex items-center justify-between w-full gap-4">+ <Card className="relative flex-1 rounded-md max-w-xl">+ <div className="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">+ <Search className="h-4 w-4 " />+ </div>+ <Input+ type="text"+ value={searchQuery}+ onChange={(e) => setSearchQuery(e.target.value)}+ placeholder="Search investigations and investigations..."+ className="pl-10 pr-16 py-2 h-10 text-sm shadow-none border-none"+ />+ <div className="absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none">+ <div className="flex items-center gap-1 text-xs">+ <kbd className="px-1.5 py-0.5 bg-background border rounded">⌘</kbd>+ <kbd className="px-1.5 py-0.5 bg-background border rounded">K</kbd>+ </div>+ </div>+ </Card><div className="flex items-center gap-2">- <DateRangePicker />+ {/* <div className="flex items-center border bg-card rounded-md overflow-hidden">+ <Button+ variant="ghost"+ size="icon"+ className={`rounded-none ${viewMode === "grid" ? "bg-background" : ""}`}+ onClick={() => setViewMode("grid")}+ >+ <Grid className="h-4 w-4" />+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className={`rounded-none ${viewMode === "list" ? "bg-background" : ""}`}+ onClick={() => setViewMode("list")}+ >+ <List className="h-4 w-4" />+ </Button>+ </div> */}<NewInvestigation><Button className="gap-2"><PlusIcon className="h-4 w-4" /> New@@ -60,36 +262,11 @@ const DashboardPage = () => {</NewInvestigation></div></div>- {/* <SectionCards /> */}- <div className="grid lg:grid-cols-5 gap-4 w-full">- <div className="lg:col-span-2 col-span-1 h-full">- <MetricsChart />- </div>- {/* <div className="col-span-1 h-full">- <MetricsChart />- </div> */}- <div className="lg:col-span-3 col-span-1 h-full">- <InvestigationGraph />- </div>+ <div>+ <RecentSketches limit={8} /></div>- <h2 className="font-bold text-2xl mt-8">Recent sketches</h2>- <RecentSketches limit={4} /><div className="flex items-center gap-2 justify-between mb-6"><div className="flex items-center gap-2">- <DropdownMenu>- <DropdownMenuTrigger asChild>- <Button variant="outline" size="sm" className="gap-2">- <SlidersHorizontal className="h-4 w-4 opacity-60" />- <span className="hidden sm:inline">Sort by</span>- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent align="end">- <DropdownMenuItem>Name</DropdownMenuItem>- <DropdownMenuItem>Date created</DropdownMenuItem>- <DropdownMenuItem>Date modified</DropdownMenuItem>- <DropdownMenuItem>Size</DropdownMenuItem>- </DropdownMenuContent>- </DropdownMenu><Button onClick={() => refetch()} disabled={isLoading || isRefetching} variant={"outline"} size="sm" className="gap-2"><RotateCwIcon className={cn("h-4 w-4", isLoading || isRefetching && "animate-spin")} /> Refresh</Button>diff --git a/flowsint-web/src/app/dashboard/tools/page.tsx b/flowsint-web/src/app/dashboard/tools/page.tsxindex 6e2225ab..27f7daf5 100644--- a/flowsint-web/src/app/dashboard/tools/page.tsx+++ b/flowsint-web/src/app/dashboard/tools/page.tsx@@ -19,19 +19,20 @@ const tools: Tool[] = [avatar: "https://media.licdn.com/dms/image/v2/D560BAQEJNEwF0E6QyA/company-logo_200_200/company-logo_200_200/0/1731244005282/osint_industries_logo?e=1750896000&v=beta&t=2-4rC5YaEp5Rmt48ijR46XhB-Y4iPaQ3qBDQbVNAVFU"},{- name: "PhoneInfoga",- path: "/tools/phoneinfoga",- description: "Gather information from phone numbers.",- active: false,- repo: "https://github.com/sundowndev/phoneinfoga",+ name: "API Sirene open data",+ path: "/tools/api-sirene-open-data",+ description: "The Sirene API allows you to query the Sirene directory of businesses and establishments, managed by Insee.",+ active: true,+ repo: "https://www.data.gouv.fr/fr/dataservices/api-sirene-open-data/",+ avatar: "https://www.portlarochelle.com/wp-content/uploads/2020/11/logo-Marianne.jpg"},{- name: "EmailRep",- path: "/tools/emailrep",- description: "Analyze the reputation of an email address (scam, social, etc.).",- active: false,- repo: "https://github.com/sublime-security/emailrep.io",- avatar: "https://user-images.githubusercontent.com/11003450/115128085-5805da00-9fa9-11eb-8c7a-dc8b708053ee.png"+ name: "Subfinder",+ path: "/tools/subfinder",+ description: "Fast passive subdomain enumeration tool.",+ active: true,+ repo: "https://github.com/projectdiscovery/subfinder",+ avatar: "https://avatars.githubusercontent.com/u/50994705?s=280&v=4"},{name: "Sherlock",@@ -49,6 +50,21 @@ const tools: Tool[] = [repo: "https://github.com/mxrch/GHunt",avatar: "https://media.licdn.com/dms/image/v2/D560BAQEJNEwF0E6QyA/company-logo_200_200/company-logo_200_200/0/1731244005282/osint_industries_logo?e=1750896000&v=beta&t=2-4rC5YaEp5Rmt48ijR46XhB-Y4iPaQ3qBDQbVNAVFU"},+ {+ name: "PhoneInfoga",+ path: "/tools/phoneinfoga",+ description: "Gather information from phone numbers.",+ active: false,+ repo: "https://github.com/sundowndev/phoneinfoga",+ },+ {+ name: "EmailRep",+ path: "/tools/emailrep",+ description: "Analyze the reputation of an email address (scam, social, etc.).",+ active: false,+ repo: "https://github.com/sublime-security/emailrep.io",+ avatar: "https://user-images.githubusercontent.com/11003450/115128085-5805da00-9fa9-11eb-8c7a-dc8b708053ee.png"+ },{name: "theHarvester",path: "/tools/theharvester",@@ -56,14 +72,6 @@ const tools: Tool[] = [active: false,repo: "https://github.com/laramies/theHarvester",},- {- name: "Subfinder",- path: "/tools/subfinder",- description: "Fast passive subdomain enumeration tool.",- active: false,- repo: "https://github.com/projectdiscovery/subfinder",- avatar: "https://avatars.githubusercontent.com/u/50994705?s=280&v=4"- },{name: "DnsDumpster",path: "/tools/dnsdumpster",@@ -78,14 +86,6 @@ const tools: Tool[] = [active: false,repo: "https://github.com/exiftool/exiftool",avatar: "https://avatars.githubusercontent.com/u/8656631?s=200&v=4"- },- {- name: "API Sirene open data",- path: "/tools/api-sirene-open-data",- description: "The Sirene API allows you to query the Sirene directory of businesses and establishments, managed by Insee.",- active: false,- repo: "https://www.data.gouv.fr/fr/dataservices/api-sirene-open-data/",- avatar: "https://www.portlarochelle.com/wp-content/uploads/2020/11/logo-Marianne.jpg"}]diff --git a/flowsint-web/src/app/dashboard/transforms/transform-item.tsx b/flowsint-web/src/app/dashboard/transforms/transform-item.tsxindex 5203b550..4bc05a64 100644--- a/flowsint-web/src/app/dashboard/transforms/transform-item.tsx+++ b/flowsint-web/src/app/dashboard/transforms/transform-item.tsx@@ -3,7 +3,7 @@ import { Badge } from "@/components/ui/badge"import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "@/components/ui/card"import { hexToRgba } from "@/lib/utils"import { useNodesDisplaySettings } from "@/store/node-display-settings"-import { FileCode2, Calendar, ArrowRight } from "lucide-react"+import { FileCode2, Calendar } from "lucide-react"import Link from "next/link"import { memo, useMemo } from "react"@@ -17,8 +17,6 @@ export const TransformItem = memo(({ transform }: { transform: any }) => {: nullconst stepsCount = transform?.transform_schema?.edges?.length || 0- const color = useNodesDisplaySettings((state) => state.colors[transform.category as keyof typeof state.colors] || "#000000")- const bgColor = useMemo(() => hexToRgba(color, 0.3), [color])return (<Link href={`/dashboard/transforms/${transform.id}`} className="block h-full transition-all">@@ -26,7 +24,6 @@ export const TransformItem = memo(({ transform }: { transform: any }) => {<CardHeader className="pb-2 relative"><CardTitle className="text-lg w-full flex items-start justify-between font-medium"><p className=" line-clamp-2">{transform.name}</p>- <Badge style={{ backgroundColor: bgColor }}>{transform.category.join(", ")}</Badge></CardTitle><CardDescription className="line-clamp-2">{transform.description || "No description provided"}@@ -40,16 +37,21 @@ export const TransformItem = memo(({ transform }: { transform: any }) => {</span></div></CardContent>- <CardFooter className="flex justify-between pt-0">- {formattedDate && (- <div className="flex items-center text-xs text-muted-foreground">- <Calendar className="h-3 w-3 mr-1" />- {formattedDate}- </div>- )}- <div className="text-primary text-sm font-medium flex items-center">- View details- <ArrowRight className="ml-1 h-3 w-3" />+ <CardFooter className="flex flex-col items-start gap-2">+ <div>+ {formattedDate && (+ <div className="flex items-center text-xs text-muted-foreground">+ <Calendar className="h-3 w-3 mr-1" />+ {formattedDate}+ </div>+ )}+ </div>+ <div className="flex gap-2 items-center flex-wrap">+ {transform.category.map((category: string) => {+ const color = useNodesDisplaySettings((state) => state.colors[category as keyof typeof state.colors] || "#000000")+ const bgColor = useMemo(() => hexToRgba(color, 0.3), [color])+ return <Badge key={category} style={{ backgroundColor: bgColor }}>{category}</Badge>+ })}</div></CardFooter></Card>diff --git a/flowsint-web/src/app/not-found.tsx b/flowsint-web/src/app/not-found.tsxnew file mode 100644index 00000000..bd308387--- /dev/null+++ b/flowsint-web/src/app/not-found.tsx@@ -0,0 +1,35 @@+import Link from "next/link"+import { Button } from "@/components/ui/button"+import { ArrowLeft, AlertCircle } from "lucide-react"++export default function NotFound() {+ return (+ <div className="min-h-screen flex flex-col items-center justify-center bg-background p-4">+ <div className="w-full max-w-md mx-auto text-center space-y-6">+ {/* Icon */}+ <div className="mx-auto w-16 h-16 rounded-full bg-muted flex items-center justify-center">+ <AlertCircle className="w-8 h-8 text-muted-foreground" />+ </div>++ {/* Error code */}+ <h1 className="text-4xl font-bold text-foreground">404</h1>++ {/* Error message */}+ <div className="space-y-2">+ <h2 className="text-xl font-medium text-foreground">Page not found</h2>+ <p className="text-muted-foreground">The page you are looking for doesn't exist or has been moved.</p>+ </div>++ {/* Action button */}+ <div className="pt-4">+ <Button asChild variant="default" className="gap-2">+ <Link href="/">+ <ArrowLeft className="w-4 h-4" />+ Back to Home+ </Link>+ </Button>+ </div>+ </div>+ </div>+ )+}diff --git a/flowsint-web/src/components/copy.tsx b/flowsint-web/src/components/copy.tsxindex 5f2465e7..a2cb603c 100644--- a/flowsint-web/src/components/copy.tsx+++ b/flowsint-web/src/components/copy.tsx@@ -36,7 +36,7 @@ export function CopyButton({ content, className, delay = 2000 }: CopyButtonProps<Tooltip open={isCopied}><TooltipTrigger asChild><Button className={cn("h-7 w-7", className)} size={"icon"} variant="ghost" onClick={handleCopy} aria-label="Copy content">- {isCopied ? <CheckIcon className="!h-3.5 !w-3.5 text-primary " /> : <CopyIcon className="!h-3.5 !w-3.5 opacity-50" />}+ {isCopied ? <CheckIcon className="!h-3.5 !w-3.5 text-primary" /> : <CopyIcon className="!h-3.5 !w-3.5 opacity-50" />}</Button></TooltipTrigger><TooltipContent>diff --git a/flowsint-web/src/components/loader.tsx b/flowsint-web/src/components/loader.tsxindex 0fccb892..45b36c21 100644--- a/flowsint-web/src/components/loader.tsx+++ b/flowsint-web/src/components/loader.tsx@@ -14,7 +14,7 @@ function Loader({ className, label }: { className?: string, label?: string }) {style={{ animationDuration: "0.5s" }}/></div>- {label && <p>{label}</p>}+ {label && <p className="text-sm">{label}</p>}</div>)}diff --git a/flowsint-web/src/components/sketches/new-actions.tsx b/flowsint-web/src/components/sketches/new-actions.tsxindex 6e6fd5c5..2afc2e0d 100644--- a/flowsint-web/src/components/sketches/new-actions.tsx+++ b/flowsint-web/src/components/sketches/new-actions.tsx@@ -16,6 +16,7 @@ import { DynamicForm } from "@/components/sketches/dynamic-form"import { Badge } from "@/components/ui/badge"import { saveNode } from "@/lib/actions/sketches"import { useNodesDisplaySettings } from "@/store/node-display-settings"+import { useSketchStore } from "@/store/sketch-store"interface ActionDialogProps {children: React.ReactNode@@ -26,29 +27,10 @@ interface ActionDialogProps {export default function ActionDialog({ children, addNodes, setCurrentNode }: ActionDialogProps) {const { sketch_id } = useParams()const { colors } = useNodesDisplaySettings()- const [openDialog, setOpenDialog] = useState(false)- const [openAddNodeModal, setOpenNodeModal] = useState(false)- const [currentNodeType, setCurrentNodeType] = useState<ActionItem | null>(null)+ const { handleOpenFormModal, currentNodeType, openMainDialog, setOpenMainDialog, openFormDialog, setOpenFormDialog } = useSketchStore()const [currentParent, setCurrentParent] = useState<ActionItem | null>(null)const [navigationHistory, setNavigationHistory] = useState<ActionItem[]>([])- const handleOpenAddNodeModal = (key: string) => {- const selectedItem = actionItems.find(item => item.key === key) ||- actionItems- .filter(item => item.children)- .flatMap(item => item.children || [])- .find(item => item.type === key)-- if (!selectedItem) {- toast.error("Invalid node type selected.")- return- }- setCurrentNodeType(selectedItem)- console.log(selectedItem)- setOpenDialog(false)- setOpenNodeModal(true)- }-const handleAddNode = async (data: any) => {try {if (!currentNodeType || !sketch_id) {@@ -73,11 +55,11 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Actconst resp = await saveNode({ node: newNode, sketch_id })if (addNodes) addNodes(resp.data?.node as any)if (setCurrentNode) setCurrentNode(newNode)- setOpenNodeModal(false)+ setOpenFormDialog(false)} catch (error) {toast.error("Unexpected error during node creation.")} finally {- setOpenDialog(false)+ setOpenMainDialog(false)}}const navigateToSubItems = (item: ActionItem) => {@@ -109,7 +91,7 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Act<ActionCardkey={item.id}item={item}- onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenAddNodeModal(item.type)}+ onSelect={item.children ? () => navigateToSubItems(item) : () => handleOpenFormModal(item.key)}/>))}</motion.div>@@ -119,8 +101,8 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Actreturn (<>- <Button asChild onClick={() => setOpenDialog(true)}>{children}</Button>- <Dialog open={openDialog} onOpenChange={setOpenDialog}>+ <Button asChild onClick={() => setOpenMainDialog(true)}>{children}</Button>+ <Dialog open={openMainDialog} onOpenChange={setOpenMainDialog}><DialogContent className="sm:max-w-[700px] h-[80vh] overflow-hidden flex flex-col"><DialogTitle className="flex items-center">{currentParent && (@@ -139,7 +121,7 @@ export default function ActionDialog({ children, addNodes, setCurrentNode }: Act<div className="overflow-y-auto overflow-x-hidden pr-1 -mr-1 flex-grow">{renderActionCards()}</div></DialogContent></Dialog>- <Dialog open={openAddNodeModal} onOpenChange={setOpenNodeModal}>+ <Dialog open={openFormDialog} onOpenChange={setOpenFormDialog}><DialogContent><DialogTitle>{currentNodeType && (diff --git a/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx b/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsxindex 2304ce5b..fed32101 100644--- a/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx+++ b/flowsint-web/src/components/sketches/scans-drawer/scan-button.tsx@@ -70,6 +70,7 @@ export function ScanButton() {event: "*",schema: "public",table: "scans",+ filter: `sketch_id=eq.${sketch_id}`,},(payload) => {// Handle different types of changesdiff --git a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsxindex 4f1cf8cc..42b2da38 100644--- a/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx+++ b/flowsint-web/src/components/sketches/sketch/nodes-panel.tsx@@ -14,10 +14,10 @@ import { IconContainer } from '@/components/icon-container'import { NodeData } from '@/types'// Mémoiser le composant SocialNode-const SocialNode = memo(({ node, setCurrentNode, currentNodeId }: {+const SocialNode = memo(({ node, setCurrentNode, isSelected }: {node: any,setCurrentNode: (node: NodeData) => void,- currentNodeId: string | null+ isSelected: any}) => {const platformsIcons = usePlatformIcons()const platformIcon = useMemo(() => {@@ -32,7 +32,7 @@ const SocialNode = memo(({ node, setCurrentNode, currentNodeId }: {variant={"ghost"}className={cn('flex items-center justify-start p-4 !py-5 rounded-none text-left border-b border-l-2 border-l-transparent',- node.id === currentNodeId && 'border-l-primary bg-background'+ isSelected(node.id) && 'border-l-primary bg-background')}onClick={handleClick}>@@ -51,11 +51,11 @@ const SocialNode = memo(({ node, setCurrentNode, currentNodeId }: {const NodeRenderer = memo(({node,setCurrentNode,- currentNodeId+ isSelected}: {node: any,setCurrentNode: (node: NodeData) => void,- currentNodeId: string | null+ isSelected: any}) => {const item = useMemo(() =>(actionItems as any).find((a: any) => a?.type === node.data?.type),@@ -69,7 +69,7 @@ const NodeRenderer = memo(({return <SocialNodesetCurrentNode={setCurrentNode}node={node}- currentNodeId={currentNodeId}+ isSelected={isSelected}/>}return (@@ -77,7 +77,7 @@ const NodeRenderer = memo(({variant={"ghost"}className={cn('flex items-center justify-start p-4 !py-5 hover:bg-background rounded-none text-left border-b border-l-2 border-l-transparent',- node.id === currentNodeId && 'border-l-primary bg-background'+ isSelected(node.id) && 'border-l-primary bg-background')}onClick={handleClick}>@@ -93,10 +93,10 @@ const NodeRenderer = memo(({})const NodesPanel = memo(({ nodes, isLoading }: { nodes: NodeData[], isLoading?: boolean }) => {- // Utiliser des sélecteurs précis pour éviter les re-renders inutiles+const setCurrentNode = useSketchStore(state => state.setCurrentNode)- const currentNodeId = useSketchStore(state => state.currentNode?.id)- const [searchQuery, setSearchQuery] = useState("")+ const isSelected = useSketchStore(state => state.isSelected)+ const [searchQuery, setSearchQuery] = useState<string>("")const [filters, setFilters] = useState<null | string[]>(null) // 'individual', 'email', etc.const filteredNodes = useMemo(() => {const searchText = searchQuery.toLowerCase()@@ -138,8 +138,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: NodeData[], isLoading?:<div className="overflow-auto bg-card h-full flex flex-col w-full !p-0 !m-0"><div className="sticky border-b top-0 p-2 bg-card z-10"><div className="flex items-center gap-2">- <h3 className="text-sm font-medium">Nodes</h3>- <Badge variant={"outline"}>{nodes?.length || 0}</Badge>+ <Badge className='h-7' variant={"outline"}><span className='font-semibold'>{nodes?.length || 0}</span> <span className='font-normal opacity-60'>nodes</span></Badge><div className="relative grow"><Search className="absolute left-2.5 top-1.5 h-4 w-4 text-muted-foreground" /><Input@@ -188,7 +187,7 @@ const NodesPanel = memo(({ nodes, isLoading }: { nodes: NodeData[], isLoading?:filteredNodes?.map((node: any) => (<NodeRenderernode={node}- currentNodeId={currentNodeId || null}+ isSelected={isSelected}setCurrentNode={setCurrentNode}key={node.id}/>diff --git a/flowsint-web/src/components/tool-card.tsx b/flowsint-web/src/components/tool-card.tsxindex 814138df..bcbf11ce 100644--- a/flowsint-web/src/components/tool-card.tsx+++ b/flowsint-web/src/components/tool-card.tsx@@ -12,8 +12,8 @@ interface ToolCardProps {export function ToolCard({ tool }: ToolCardProps) {return (<Card className="flex flex-col shadow-none bg-card rounded-md relative">- <CardHeader>- <CardTitle className="flex items-center gap-2">+ <CardHeader className="py-3">+ <CardTitle className="flex items-center gap-2 mt-4">{tool.avatar ?<AvatarclassName={cn(diff --git a/flowsint-web/src/components/transforms/editor.tsx b/flowsint-web/src/components/transforms/editor.tsxindex 4da26433..60da48f3 100644--- a/flowsint-web/src/components/transforms/editor.tsx+++ b/flowsint-web/src/components/transforms/editor.tsx@@ -429,9 +429,7 @@ function TransformEditor({if (!mounted) {return (- <div className="grow w-full flex items-center justify-center">- <Loader /> Loading...- </div>+ <Loader label="Loading.." />)}return (diff --git a/flowsint-web/src/components/ui/input.tsx b/flowsint-web/src/components/ui/input.tsxindex 15fbfcd9..d5059987 100644--- a/flowsint-web/src/components/ui/input.tsx+++ b/flowsint-web/src/components/ui/input.tsx@@ -8,7 +8,7 @@ function Input({ className, type, ...props }: React.ComponentProps<"input">) {type={type}data-slot="input"className={cn(- "border file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground aria-invalid:outline-destructive/60 aria-invalid:ring-destructive/20 dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/50 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 aria-invalid:outline-destructive/60 dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/40 aria-invalid:ring-destructive/20 aria-invalid:border-destructive/60 dark:aria-invalid:border-destructive flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base bg-card transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 inset-shadow-sm file:bg-transparent file:text-sm file:font-medium focus-visible:ring-4 focus-visible:outline-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:focus-visible:ring-[3px] aria-invalid:focus-visible:outline-none md:text-sm dark:aria-invalid:focus-visible:ring-4",+ "border file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground aria-invalid:outline-destructive/60 aria-invalid:ring-destructive/20 dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/50 ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 aria-invalid:outline-destructive/60 dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/40 aria-invalid:ring-destructive/20 aria-invalid:border-destructive/60 dark:aria-invalid:border-destructive flex h-9 w-full min-w-0 rounded border bg-transparent px-3 py-1 text-base bg-card transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 inset-shadow-sm file:bg-transparent file:text-sm file:font-medium focus-visible:ring-4 focus-visible:outline-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:focus-visible:ring-[3px] aria-invalid:focus-visible:outline-none md:text-sm dark:aria-invalid:focus-visible:ring-4",className)}{...props}diff --git a/flowsint-web/src/lib/utils.ts b/flowsint-web/src/lib/utils.tsindex baea3b9a..1d3f1dce 100644--- a/flowsint-web/src/lib/utils.ts+++ b/flowsint-web/src/lib/utils.ts@@ -364,6 +364,20 @@ export const flattenObj = (ob: Record<string, any>) => {return result;}+export function flattenArray(nodes: any[], key: string): any[] {+ let result = [];++ for (const node of nodes) {+ const { [key]: children, ...rest } = node;+ result.push(rest);+ if (children) {+ result = result.concat(flattenArray(children, key));+ }+ }+ return result as any[];+}++export function hexToRgba(hex: string, alpha: number) {const r = parseInt(hex.slice(1, 3), 16)const g = parseInt(hex.slice(3, 5), 16)diff --git a/flowsint-web/src/store/node-display-settings.ts b/flowsint-web/src/store/node-display-settings.tsindex e5741893..7b1a623b 100644--- a/flowsint-web/src/store/node-display-settings.ts+++ b/flowsint-web/src/store/node-display-settings.ts@@ -26,6 +26,8 @@ export type ItemType =| "biometric"| "credential"| "username"+ | "siret"+ | "siren"export const ITEM_TYPES: ItemType[] = ["individual",@@ -51,6 +53,8 @@ export const ITEM_TYPES: ItemType[] = ["biometric","credential","username",+ "siret",+ "siren"]const primary = "#f59e0b"@@ -79,6 +83,8 @@ const DEFAULT_COLORS: Record<ItemType, string> = {username: primary, // Bleu lavandecredential: primary, // Gris neutrebiometric: primary, // Gris neutre+ siret: primary,+ siren: primary}// Définition des icônes par défaut pour chaque type d'élément@@ -106,17 +112,49 @@ const DEFAULT_ICONS: Record<ItemType, string> = {biometric: "/fingerprint.svg",credential: "/key.svg",username: "/username.svg",+ siret: "/info.svg",+ siren: "/info.svg"+}++const DEFAULT_SIZES: Record<ItemType, number> = {+ individual: 40,+ phone: 30,+ address: 30,+ email: 30,+ ip: 30,+ social_profile: 30,+ organization: 45,+ vehicle: 30,+ website: 30,+ domain: 35,+ subdomain: 30,+ document: 30,+ financial: 30,+ event: 30,+ device: 30,+ media: 30,+ education: 30,+ relationship: 30,+ online_activity: 30,+ digital_footprint: 30,+ biometric: 30,+ credential: 30,+ username: 35,+ siret: 25,+ siren: 25}interface NodesDisplaySettingsState {colors: Record<ItemType, string>icons: Record<ItemType, string>+ sizes: Record<ItemType, number>setColor: (itemType: ItemType, color: string) => voidsetIcon: (itemType: ItemType, iconPath: string) => voidresetColors: () => voidresetIcons: () => voidresetAll: () => voidgetIcon: (itemType: ItemType) => HTMLImageElement+ getSize: (itemType: ItemType) => number}export const useNodesDisplaySettings = create<NodesDisplaySettingsState>()(@@ -124,6 +162,7 @@ export const useNodesDisplaySettings = create<NodesDisplaySettingsState>()((set, get) => ({colors: { ...DEFAULT_COLORS },icons: { ...DEFAULT_ICONS },+ sizes: { ...DEFAULT_SIZES },setColor: (itemType, color) =>set((state) => ({colors: {@@ -151,6 +190,9 @@ export const useNodesDisplaySettings = create<NodesDisplaySettingsState>()(img.crossOrigin = "anonymous"return img},+ getSize: (itemType) => {+ return get().sizes[itemType]+ }}),{name: "nodes-display-settings",diff --git a/flowsint-web/src/store/sketch-store.ts b/flowsint-web/src/store/sketch-store.tsindex 7e2eddaf..e00fcf54 100644--- a/flowsint-web/src/store/sketch-store.ts+++ b/flowsint-web/src/store/sketch-store.ts@@ -3,119 +3,121 @@import { create } from "zustand"import { devtools } from "zustand/middleware"import type { Sketch } from "@/types/sketch"-import { EdgeData, NodeData } from "@/types"+import type { EdgeData, NodeData } from "@/types"+import { ActionItem, actionItems } from "@/lib/action-items"interface SketchState {- nodes: NodeData[]- edges: EdgeData[]- setNodes: (nodes: NodeData[]) => void- addNode: (newNode: Partial<NodeData>) => void- setEdges: (edges: EdgeData[]) => void- filters: Record<string, unknown>+ // Nodes data+ nodes: NodeData[],+ edges: EdgeData[],currentNode: NodeData | nullselectedNodes: NodeData[]- panelOpen: boolean- openNewNode: boolean- openActionDialog: boolean- sketch: Sketch | null- isRefetching: boolean- setFilters: (filters: Record<string, unknown>) => void- setOpenNewNode: (open: boolean) => void+ // Nodes states+ isCurrent: (nodeId: string) => boolean+ isSelected: (nodeId: string) => boolean+ // Nodes setters+ setNodes: (nodes: NodeData[]) => void+ setEdges: (edges: EdgeData[]) => voidsetCurrentNode: (node: NodeData | null) => voidsetSelectedNodes: (nodes: NodeData[]) => void- toggleNodeSelection: (node: NodeData, multiSelect?: boolean) => void- setPanelOpen: (open: boolean) => void- setSketch: (sketch: Sketch | null) => void- setOpenActionDialog: (open: boolean) => voidclearSelectedNodes: () => void+ toggleNodeSelection: (node: NodeData, multiSelect?: boolean) => void+ // Nodes mutators+ addNode: (newNode: Partial<NodeData>) => void+ // Main modal, showing different first categ items+ openMainDialog: boolean,+ setOpenMainDialog: (open: boolean) => void,+ // Second modal, open after clicking on an item+ openFormDialog: boolean,+ setOpenFormDialog: (open: boolean) => void+ // Open the form dialog with correct form proposed+ handleOpenFormModal: (key: string) => void+ // To know the selected node type for the form+ currentNodeType: ActionItem | null+ setCurrentNodeType: (nodeType: ActionItem | null) => void+ // filters+ filters: Record<string, unknown>,+ setFilters: (filters: Record<string, unknown>) => void++}-// Ajout d'outils de développement pour faciliter le debugexport const useSketchStore = create<SketchState>()(- devtools(- (set, get) => ({- nodes: [],- edges: [],- filters: {},- currentNode: null,- selectedNodes: [],- panelOpen: false,- openNewNode: false,- openActionDialog: false,- sketch: null,- isRefetching: false,-- setNodes: (nodes) => set({ nodes }, false, "setNodes"),- addNode: (newNode) => {- const { nodes } = get()- // S'assurer que le nœud a un ID unique s'il n'en a pas déjà un- const nodeWithId = {- id: newNode.id || `node-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,- ...newNode- } as NodeData- const newNodes = [...nodes, nodeWithId]- set({ nodes: newNodes }, false, "addNode")- return nodeWithId- },- setEdges: (edges) => set({ edges }, false, "setEdges"),- setFilters: (filters) => set({ filters }, false, "setFilters"),- setOpenNewNode: (open) => set({ openNewNode: open }, false, "setOpenNewNode"),+ (set, get) => ({+ nodes: [],+ edges: [],+ currentNode: null,+ selectedNodes: [],+ openMainDialog: false,+ openFormDialog: false,+ currentNodeType: null,+ isCurrent: (nodeId) => {+ const { currentNode } = get()+ return currentNode !== null && currentNode.id === nodeId+ },+ isSelected: (nodeId) => {+ const { selectedNodes, isCurrent } = get()+ return selectedNodes.some((node) => node.id === nodeId) || isCurrent(nodeId)+ },+ setNodes: (nodes) => set({ nodes }),+ setEdges: (edges) => set({ edges }),+ setCurrentNode: (node) => {+ set({ currentNode: node })+ },+ setSelectedNodes: (nodes) => {+ set({ selectedNodes: nodes })+ },+ clearSelectedNodes: () => {+ set({ selectedNodes: [], currentNode: null })+ },+ addNode: (newNode) => {+ const { nodes } = get()+ const nodeWithId = {+ id: newNode.id || `node-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`,+ ...newNode,+ } as NodeData- setCurrentNode: (node) => {- console.log("Setting current node:", node)- set({ currentNode: node }, false, "setCurrentNode")- // Si nous définissons un nœud actuel et que le panneau n'est pas ouvert, ouvrons-le- if (node && !get().panelOpen) {- set({ panelOpen: true }, false, "openPanelWithNode")+ const newNodes = [...nodes, nodeWithId]+ set({ nodes: newNodes })+ return nodeWithId+ },+ toggleNodeSelection: (node, multiSelect = false) => {+ const { selectedNodes } = get()+ const isSelected = selectedNodes.some((n) => n.id === node.id)+ if (multiSelect) {+ if (isSelected) {+ set({ selectedNodes: selectedNodes.filter((n) => n.id !== node.id) })+ } else {+ set({ selectedNodes: [...selectedNodes, node] })}- },-- setSelectedNodes: (nodes) => {- console.log("Setting selected nodes:", nodes)- set({ selectedNodes: nodes }, false, "setSelectedNodes")- },-- toggleNodeSelection: (node, multiSelect = false) => {- const { selectedNodes } = get()- const isSelected = selectedNodes.some(n => n.id === node.id)-- if (multiSelect) {- // Mode multi-sélection: ajouter ou retirer le nœud- if (isSelected) {- set(- { selectedNodes: selectedNodes.filter(n => n.id !== node.id) },- false,- "removeNodeFromSelection"- )- } else {- set(- { selectedNodes: [...selectedNodes, node] },- false,- "addNodeToSelection"- )- }+ } else {+ if (isSelected && selectedNodes.length === 1) {+ set({ selectedNodes: [] })} else {- // Mode sélection unique: remplacer ou désélectionner- if (isSelected && selectedNodes.length === 1) {- set({ selectedNodes: [] }, false, "deselectNode")- } else {- set({ selectedNodes: [node] }, false, "selectSingleNode")- }+ set({ selectedNodes: [node] })}-- // Définir également comme nœud actuel- set({ currentNode: isSelected ? null : node }, false, "updateCurrentNodeWithSelection")- },-- clearSelectedNodes: () => {- set({ selectedNodes: [], currentNode: null }, false, "clearSelectedNodes")- },-- setPanelOpen: (open) => set({ panelOpen: open }, false, "setPanelOpen"),- setSketch: (sketch) => set({ sketch }, false, "setSketch"),- setOpenActionDialog: (open) => set({ openActionDialog: open }, false, "setOpenActionDialog"),- }),- { name: "sketch-store" }- )-)\ No newline at end of file+ }+ set({ currentNode: isSelected ? null : node })+ },+ setOpenMainDialog: (open) => set({ openMainDialog: open }),+ setOpenFormDialog: (open) => set({ openFormDialog: open }),+ setCurrentNodeType: (nodeType) => set({ currentNodeType: nodeType }),+ handleOpenFormModal: (key) => {+ const selectedItem = actionItems.find(item => item.key === key) ||+ actionItems+ .filter(item => item.children)+ .flatMap(item => item.children || [])+ .find(item => item.key === key)+ if (!selectedItem) {+ return+ }+ set({+ currentNodeType: selectedItem,+ openMainDialog: false,+ openFormDialog: true+ })+ },+ filters: {},+ setFilters: (filters) => set({ filters }),+ }))\ No newline at end of filediff --git a/flowsint-web/styles/globals.css b/flowsint-web/styles/globals.cssindex a375fd61..aa768c04 100644--- a/flowsint-web/styles/globals.css+++ b/flowsint-web/styles/globals.css@@ -160,9 +160,9 @@ body {}.dark {- --background: oklch(0.20 0 0);+ --background: oklch(0.22 0 0);--foreground: oklch(0.92 0 0);- --card: oklch(0.27 0 0);+ --card: oklch(0.24 0 0);--card-foreground: oklch(0.92 0 0);--popover: oklch(0.27 0 0);--popover-foreground: oklch(0.92 0 0);@@ -257,4 +257,4 @@ body {--shadow-lg: var(--shadow-lg);--shadow-xl: var(--shadow-xl);--shadow-2xl: var(--shadow-2xl);-}\ No newline at end of file+}diff --git a/flowsint-web/yarn.lock b/flowsint-web/yarn.lockindex 3dd2f33b..2f0a8b39 100644--- a/flowsint-web/yarn.lock+++ b/flowsint-web/yarn.lock@@ -5815,6 +5815,15 @@ react-force-graph-2d@^1.27.1:prop-types "15"react-kapsule "^2.5"+react-force-graph-3d@^1.26.1:+ version "1.26.1"+ resolved "https://registry.yarnpkg.com/react-force-graph-3d/-/react-force-graph-3d-1.26.1.tgz#b138adc13412da6d0c89ea4e85a59ef85ae5ed49"+ integrity sha512-Ff520+ngcja441fAyop+oiPPEcXaRhzvTqA+4ve6Kr341g3TIg0+s/i7pafCtYhgpPXcbjiDet0wskzGaNhIlQ==+ dependencies:+ "3d-force-graph" "^1.76"+ prop-types "15"+ react-kapsule "^2.5"+react-force-graph@^1.47.6:version "1.47.6"resolved "https://registry.yarnpkg.com/react-force-graph/-/react-force-graph-1.47.6.tgz#f5d72d8fc47b28b4ed1a3a2b5bcf74ee54616f75"@@ -6525,6 +6534,11 @@ three-render-objects@^1.35:kapsule "^1.16"polished "4"+three-spritetext@^1.9.6:+ version "1.9.6"+ resolved "https://registry.yarnpkg.com/three-spritetext/-/three-spritetext-1.9.6.tgz#f6e89dfbc158ad2f04392fc012ef390a7d7f7f99"+ integrity sha512-+O5hGi6u4nWLefY8+Hlufd0aysWZhS2Ex61LCQVSixbYbykdPUOYYA+V+4xG4mKNDm1AsC0yHINRQS5NQb6mSg==+"three@>=0.118 <1":version "0.176.0"resolved "https://registry.yarnpkg.com/three/-/three-0.176.0.tgz#a30c1974e46db5745e4f96dd9ee2028d71e16ecf"