diff --git a/package.json b/package.json index 299dee31d..61bde1b7a 100644 --- a/package.json +++ b/package.json @@ -7,11 +7,12 @@ "author": "amazon", "type": "module", "scripts": { - "prepare": "husky", - "lint": "oxlint --fix", - "check:lint": "oxlint", - "format": "oxfmt", - "check:format": "oxfmt --check", + "prepare": "husky install", + "precommit": "lint-staged && pnpm check:types", + "lint": "eslint --fix --concurrency=auto", + "check:lint": "eslint --concurrency=auto", + "format": "prettier --write .", + "check:format": "prettier --check .", "test": "vitest run", "test:watch": "vitest", "coverage": "vitest run --coverage", diff --git a/packages/graph-explorer/src/components/Tabular/controls/ExportControl/transformToCsv.ts b/packages/graph-explorer/src/components/Tabular/controls/ExportControl/transformToCsv.ts index 2eba9c9c2..e61a5a49f 100644 --- a/packages/graph-explorer/src/components/Tabular/controls/ExportControl/transformToCsv.ts +++ b/packages/graph-explorer/src/components/Tabular/controls/ExportControl/transformToCsv.ts @@ -1,7 +1,5 @@ import { unparse } from "papaparse"; - import type { TabularColumnInstance } from "@/components/Tabular/helpers/tableInstanceToTabularInstance"; - import { LABELS } from "@/utils/constants"; export function transformToCsv( @@ -37,7 +35,9 @@ export function transformToCsv( }), ); - const headers = columns.map(col => col.definition?.label || col.instance.id); + const headers = columns.map( + col => col.definition?.label || col.instance.id, + ); return unparse([headers, ...csvRows], { header: false }); } diff --git a/packages/graph-explorer/src/modules/GraphViewer/GraphViewer.tsx b/packages/graph-explorer/src/modules/GraphViewer/GraphViewer.tsx index f5978abf7..600bfdeb1 100644 --- a/packages/graph-explorer/src/modules/GraphViewer/GraphViewer.tsx +++ b/packages/graph-explorer/src/modules/GraphViewer/GraphViewer.tsx @@ -154,83 +154,100 @@ function GraphViewerContent({ const isEmpty = !nodes.length && !edges.length; return ( -
- - - Graph View - - - - -
- - - - - - - - - - - - - - {isContextOpen && - renderContextLayer( -
- -
, - )} +
+ {}} + affectedNodesIds={[]} + affectedEdgesIds={[]} + /> +
+); - - - - -
- setLegendOpen(false)} /> -
-
-
- -
- ); + + // return ( + //
+ // + // + // Graph View + // + // + // + // + //
+ // + // + // + // + // + // + // + // + // + // + // + // + // + // {/* {isContextOpen && + // renderContextLayer( + //
+ // + //
, + // )} */} + // {}} + // affectedNodesIds={[]} + // affectedEdgesIds={[]} + // /> + + + // + // + // + // + //
+ // setLegendOpen(false)} /> + //
+ //
+ //
+ // + //
+ // ); } function Legend({ diff --git a/packages/graph-explorer/src/modules/GraphViewer/internalComponents/ContextMenu.tsx b/packages/graph-explorer/src/modules/GraphViewer/internalComponents/ContextMenu.tsx index c37d28246..2c8ca0b6a 100644 --- a/packages/graph-explorer/src/modules/GraphViewer/internalComponents/ContextMenu.tsx +++ b/packages/graph-explorer/src/modules/GraphViewer/internalComponents/ContextMenu.tsx @@ -46,6 +46,9 @@ import { cn } from "@/utils"; import { useGraphSelection } from "../useGraphSelection"; +import { useRenderedVertices, useRenderedEdges } from "@/core"; +import { getVertexIdFromRenderedVertexId, getEdgeIdFromRenderedEdgeId } from "@/core"; + type ContextMenuProps = { affectedNodesIds: VertexId[]; affectedEdgesIds: EdgeId[]; @@ -290,6 +293,9 @@ function MultipleEntitiesMenu({ } function NoTargetMenu() { + const vertices = useRenderedVertices(); + const edges = useRenderedEdges(); + const { onFitAllToCanvas, onCenterGraph, @@ -297,7 +303,41 @@ function NoTargetMenu() { onZoomIn, onZoomOut, } = useGraphGlobalActions(); + const clearGraph = useClearGraph(); + const { replaceGraphSelection } = useGraphSelection(); + + // 🔹 Select all nodes + const handleSelectAllNodes = () => { + replaceGraphSelection({ + vertices: vertices.map(v => + getVertexIdFromRenderedVertexId(v.data.id), + ), + edges: [], + }); + }; + + // 🔹 Select all edges + const handleSelectAllEdges = () => { + replaceGraphSelection({ + vertices: [], + edges: edges.map(e => + getEdgeIdFromRenderedEdgeId(e.data.id), + ), + }); + }; + + // 🔹 Select all nodes + edges + const handleSelectAll = () => { + replaceGraphSelection({ + vertices: vertices.map(v => + getVertexIdFromRenderedVertexId(v.data.id), + ), + edges: edges.map(e => + getEdgeIdFromRenderedEdgeId(e.data.id), + ), + }); + }; return ( @@ -305,24 +345,48 @@ function NoTargetMenu() { Fit to frame + Center + Download screenshot + + Zoom in + Zoom out + + + + + Select all nodes + + + + + Select all edges + + + + + Select all + + + + Clear canvas