Skip to content

Commit ac2377a

Browse files
authored
Merge branch 'staging' into add-create-repo
2 parents 45bfaa4 + 3484aea commit ac2377a

7 files changed

Lines changed: 23 additions & 65 deletions

File tree

app/components/Input.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ export default function Input({ onValueChange, handleSubmit, graph, icon, node,
3838
const timeout = setTimeout(async () => {
3939

4040
if (!node?.name) {
41-
if (!node?.name) {
42-
setOptions([])
43-
}
41+
setOptions([])
4442
setOpen(false)
4543
return
4644
}

app/components/chat.tsx

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Image from "next/image";
44
import { AlignLeft, ArrowDown, ArrowRight, ChevronDown, Lightbulb, Undo2 } from "lucide-react";
55
import { Path } from "../page";
66
import Input from "./Input";
7-
import { Graph, GraphData } from "./model";
7+
import { Graph, GraphData, Link } from "./model";
88
import { cn } from "@/lib/utils";
99
import { TypeAnimation } from "react-type-animation";
1010
import { DropdownMenu, DropdownMenuContent, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
1111
import { prepareArg } from "../utils";
12-
import { NodeObject } from "react-force-graph-2d";
12+
import { NodeObject, ForceGraphMethods } from "react-force-graph-2d";
1313

1414
type PathData = {
1515
nodes: any[]
@@ -25,50 +25,6 @@ enum MessageTypes {
2525
Text,
2626
}
2727

28-
const EDGE_STYLE = {
29-
"line-color": "gray",
30-
"target-arrow-color": "gray",
31-
"opacity": 0.5,
32-
}
33-
34-
35-
const PATH_EDGE_STYLE = {
36-
width: 0.5,
37-
"line-style": "dashed",
38-
"line-color": "#FF66B3",
39-
"arrow-scale": 0.3,
40-
"target-arrow-color": "#FF66B3",
41-
"opacity": 1
42-
}
43-
44-
const SELECTED_PATH_EDGE_STYLE = {
45-
width: 1,
46-
"line-style": "solid",
47-
"line-color": "#FF66B3",
48-
"arrow-scale": 0.6,
49-
"target-arrow-color": "#FF66B3",
50-
};
51-
52-
const NODE_STYLE = {
53-
"border-width": 0.5,
54-
"color": "gray",
55-
"border-color": "black",
56-
"background-color": "gray",
57-
"opacity": 0.5
58-
}
59-
60-
const PATH_NODE_STYLE = {
61-
"border-width": 0.5,
62-
"border-color": "#FF66B3",
63-
"border-opacity": 1,
64-
}
65-
66-
const SELECTED_PATH_NODE_STYLE = {
67-
"border-width": 1,
68-
"border-color": "#FF66B3",
69-
"border-opacity": 1,
70-
};
71-
7228
interface Message {
7329
type: MessageTypes;
7430
text?: string;
@@ -85,7 +41,7 @@ interface Props {
8541
isPathResponse: boolean | undefined
8642
setIsPathResponse: (isPathResponse: boolean | undefined) => void
8743
setData: Dispatch<SetStateAction<GraphData>>
88-
chartRef: any
44+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
8945
}
9046

9147
const SUGGESTIONS = [

app/components/code-graph.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { Checkbox } from '@/components/ui/checkbox';
1414
import dynamic from 'next/dynamic';
1515
import { Position } from "./graphView";
1616
import { prepareArg } from '../utils';
17-
import { NodeObject } from "react-force-graph-2d";
17+
import { NodeObject, ForceGraphMethods } from "react-force-graph-2d";
1818

1919
const GraphView = dynamic(() => import('./graphView'));
2020

@@ -27,7 +27,7 @@ interface Props {
2727
setOptions: Dispatch<SetStateAction<string[]>>
2828
isShowPath: boolean
2929
setPath: Dispatch<SetStateAction<Path | undefined>>
30-
chartRef: RefObject<any>
30+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
3131
selectedValue: string
3232
selectedPathId: number | undefined
3333
setSelectedPathId: (selectedPathId: number) => void
@@ -178,8 +178,6 @@ export function CodeGraph({
178178

179179
const isTarget = graph.Elements.links.some(link => link.target.id === node.id && nodes.some(n => n.id === link.source.id));
180180

181-
debugger
182-
183181
if (!isTarget) return true
184182

185183
const deleted = graph.NodesMap.delete(Number(node.id))

app/components/graphView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import ForceGraph2D from 'react-force-graph-2d';
2+
import ForceGraph2D, { ForceGraphMethods } from 'react-force-graph-2d';
33
import { Graph, GraphData, Link, Node } from './model';
44
import { Dispatch, RefObject, SetStateAction, useEffect, useRef, useState } from 'react';
55
import { Path } from '../page';
@@ -13,7 +13,7 @@ interface Props {
1313
data: GraphData
1414
setData: Dispatch<SetStateAction<GraphData>>
1515
graph: Graph
16-
chartRef: RefObject<any>
16+
chartRef: React.MutableRefObject<ForceGraphMethods<Node, Link>>
1717
selectedObj: Node | Link | undefined
1818
setSelectedObj: Dispatch<SetStateAction<Node | Link | undefined>>
1919
selectedObjects: Node[]

app/components/toolbar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import { CircleDot, Minus, Plus } from "lucide-react";
22
import { cn } from "@/lib/utils"
3-
import { RefObject } from "react";
3+
import { ForceGraphMethods } from "react-force-graph-2d";
4+
import { Node, Link } from "./model";
5+
import { MutableRefObject } from "react";
46

57
interface Props {
6-
chartRef: RefObject<any>
8+
chartRef: MutableRefObject<ForceGraphMethods<Node, Link>>
79
className?: string
810
}
911

e2e/config/testData.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ export const nodes: { nodeName: string; }[] = [
2626
{ nodeName: "list_graphs"}
2727
];
2828

29-
export const categories: string[] = ['File', 'Class', 'Function'];
29+
export const categories: string[] = ['File', 'Class', 'Function'];
30+
31+
export const graphs: { graphName: string; }[] = [
32+
{ graphName: "GraphRAG-SDK" },
33+
{ graphName: "click" },
34+
];

e2e/tests/canvas.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CodeGraph from "../logic/POM/codeGraph";
44
import urls from "../config/urls.json";
55
import { GRAPH_ID, PROJECT_NAME } from "../config/constants";
66
import { findNodeByName } from "../logic/utils";
7-
import { nodesPath, categories, nodes } from "../config/testData";
7+
import { nodesPath, categories, nodes, graphs } from "../config/testData";
88
import { ApiCalls } from "../logic/api/apiCalls";
99

1010
test.describe("Canvas tests", () => {
@@ -117,16 +117,15 @@ test.describe("Canvas tests", () => {
117117
});
118118
})
119119

120-
for (let index = 0; index < 2; index++) {
121-
const checkboxIndex = index + 1;
122-
test(`Verify selecting different graphs displays nodes in canvas - Iteration ${index + 1}`, async () => {
120+
graphs.forEach(({graphName}) => {
121+
test(`Verify selecting different graphs displays nodes in canvas - grpah: ${graphName}`, async () => {
123122
const codeGraph = await browser.createNewPage(CodeGraph, urls.baseUrl);
124-
await codeGraph.selectGraph(checkboxIndex);
123+
await codeGraph.selectGraph(graphName);
125124
const result = await codeGraph.getGraphDetails();
126125
expect(result.elements.nodes.length).toBeGreaterThan(1);
127126
expect(result.elements.links.length).toBeGreaterThan(1);
128127
});
129-
}
128+
})
130129

131130
for (let index = 0; index < 3; index++) {
132131
const nodeIndex: number = index + 1;

0 commit comments

Comments
 (0)