Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Staging #614

Open
wants to merge 99 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
64f2a32
Fix typo in keywords, optimize suggestion handling, and update cursor…
Anchel123 Jan 15, 2025
ec456ec
Refactor ForceGraph component to improve resize handling and remove u…
Anchel123 Jan 15, 2025
42ab14d
fix preferences view
Anchel123 Jan 15, 2025
953c904
fix build
Anchel123 Jan 15, 2025
368b7d0
Merge pull request #609 from FalkorDB/fix-editor
AviAvni Jan 15, 2025
a1ae9a9
Merge pull request #611 from FalkorDB/fix-prefrences-view
AviAvni Jan 15, 2025
36fc3bb
change the schema elements properties format in the db
Anchel123 Jan 16, 2025
e6316f2
Merge pull request #612 from FalkorDB/change-node-properties-format-i…
Anchel123 Jan 16, 2025
cb8f18a
Merge branch 'staging' into fix-force-graph-resize
Anchel123 Jan 16, 2025
5f9d3aa
Merge pull request #610 from FalkorDB/fix-force-graph-resize
Anchel123 Jan 16, 2025
d192e0f
Merge branch 'main' into staging
Anchel123 Jan 16, 2025
86d6fea
commit
Anchel123 Jan 20, 2025
c019e82
upgrade to node22
gkorland Jan 21, 2025
19d11c0
Merge branch 'staging' into gkorland-node22
gkorland Jan 21, 2025
97206a4
upgrade to node22
gkorland Jan 21, 2025
ecf24d7
commit
Anchel123 Jan 22, 2025
a63aef2
Update auth.setup.ts
Naseem77 Jan 22, 2025
ac6baf6
update config settings tests
Naseem77 Jan 22, 2025
9bd266a
change bg and display logo, version and copy rights
Anchel123 Jan 23, 2025
e509ef4
adjust the bg better and fix interaction with the dropzone
Anchel123 Jan 23, 2025
1e0c160
Refactor GraphView and Toolbar components to enhance UI and functiona…
Anchel123 Jan 23, 2025
7d70e91
Enhance Header component with new help features
Anchel123 Jan 23, 2025
72b96e9
remove blur on input to be able to click on submit
Anchel123 Jan 23, 2025
7ff731c
replace edges label color to white and add bg
Anchel123 Jan 23, 2025
356d84a
make color bright by mixing with whit instead of changing the opacity…
Anchel123 Jan 23, 2025
a70a6cd
commit
Anchel123 Jan 26, 2025
5a75ad8
update config tests
Naseem77 Jan 27, 2025
e734415
update tests
Naseem77 Jan 27, 2025
1e7b075
Update settingsConfig.spec.ts
Naseem77 Jan 27, 2025
47d76a5
Update settingsConfig.spec.ts
Naseem77 Jan 27, 2025
2875315
commit
Anchel123 Jan 27, 2025
d4fc6be
commit
Anchel123 Jan 27, 2025
ad60353
update playwright config for artifacts
Naseem77 Jan 27, 2025
cd29447
Update playwright.yml
Naseem77 Jan 27, 2025
a7e3b99
updating tests
Naseem77 Jan 27, 2025
c719d03
increase timeout
Naseem77 Jan 27, 2025
91deab9
Update settingsConfig.spec.ts
Naseem77 Jan 27, 2025
eb0aad0
refresh ui before api call
Naseem77 Jan 28, 2025
0244c82
add scroll after reload
Naseem77 Jan 28, 2025
338a4af
adding logging
Naseem77 Jan 28, 2025
3f7c147
commit
Anchel123 Jan 28, 2025
d24a326
Update playwright.yml
gkorland Jan 28, 2025
68302fd
Merge pull request #616 from FalkorDB/gkorland-node22
gkorland Jan 28, 2025
8cd09b0
Merge branch 'staging' into change-canvas-interaction
gkorland Jan 28, 2025
6bfe542
Merge branch 'staging' into fix-resize
gkorland Jan 28, 2025
c416fe3
Merge branch 'staging' into restyle-landing-page
gkorland Jan 28, 2025
25c6b30
Merge branch 'staging' into fix-login
gkorland Jan 28, 2025
b7a828f
Merge branch 'staging' into add-about-section
gkorland Jan 28, 2025
3f31dfe
Merge branch 'staging' into fix-data-panel
gkorland Jan 28, 2025
d8bd528
Merge branch 'staging' into fix-canvas
gkorland Jan 28, 2025
f259878
Merge pull request #618 from FalkorDB/change-canvas-interaction
Anchel123 Jan 29, 2025
14a7850
Merge branch 'staging' into fix-resize
Anchel123 Jan 29, 2025
5d7b554
Merge pull request #628 from FalkorDB/restyle-landing-page
Anchel123 Jan 29, 2025
62c52ef
Merge pull request #626 from FalkorDB/fix-resize
Anchel123 Jan 29, 2025
63ae8ea
Merge pull request #629 from FalkorDB/fix-login
Anchel123 Jan 29, 2025
39665e2
Merge pull request #630 from FalkorDB/add-about-section
Anchel123 Jan 29, 2025
60e47a7
Merge pull request #631 from FalkorDB/fix-data-panel
Anchel123 Jan 29, 2025
debc1e7
Merge pull request #633 from FalkorDB/fix-canvas
Anchel123 Jan 29, 2025
3560c55
commit
Anchel123 Jan 29, 2025
9ebc94e
fix suggestion duplication
Anchel123 Jan 30, 2025
14ad9bf
commit
Anchel123 Jan 30, 2025
9e5dcb6
Merge branch 'staging' into small-changes
Anchel123 Jan 30, 2025
001a779
Merge branch 'fix-graph-view' into small-changes
Anchel123 Jan 30, 2025
2a65918
update ci image and tests
Naseem77 Feb 2, 2025
c44c337
commit
Anchel123 Feb 2, 2025
0876551
Merge branch 'staging' into fix-monaco-editor
Anchel123 Feb 2, 2025
47ca65b
Add validation for MAX_INFO_QUERIES configuration limit
Anchel123 Feb 2, 2025
55a8265
commit
Anchel123 Feb 2, 2025
b5bda9c
commit
Anchel123 Feb 3, 2025
e758f7a
commit
Anchel123 Feb 3, 2025
c0b1dc1
commit
Anchel123 Feb 3, 2025
f9b73d4
Revert "commit"
Anchel123 Feb 3, 2025
61b120c
commit
Anchel123 Feb 3, 2025
51bc929
Revert "commit"
Anchel123 Feb 3, 2025
9c866a8
commit
Anchel123 Feb 3, 2025
7296ddc
commit
Anchel123 Feb 3, 2025
cab9471
fix secured fetch
Anchel123 Feb 3, 2025
34f246a
fix add / edit / remove user
Anchel123 Feb 4, 2025
941c9f9
place empty string when graph name empty
Anchel123 Feb 4, 2025
fca6cb1
fix users table and modify role test
Anchel123 Feb 4, 2025
0f2a962
modify tests for changing role
Anchel123 Feb 4, 2025
8249f78
commit
Anchel123 Feb 4, 2025
af68537
commit
Anchel123 Feb 4, 2025
b6b5a6b
add aria label on buttons for tests
Anchel123 Feb 4, 2025
30af6b4
commit
Anchel123 Feb 4, 2025
ec639ff
commit
Anchel123 Feb 5, 2025
0da6028
Merge pull request #640 from FalkorDB/fix-monaco-editor
Anchel123 Feb 5, 2025
175de4c
Merge pull request #641 from FalkorDB/fix-set-config
Anchel123 Feb 5, 2025
caf7470
Merge branch 'staging' into fix-create-graph
Anchel123 Feb 5, 2025
c715c86
Merge pull request #647 from FalkorDB/fix-create-graph
Anchel123 Feb 5, 2025
f36d3cb
Merge remote-tracking branch 'origin/staging' into small-changes
Anchel123 Feb 5, 2025
3e79d80
remove unused import
Anchel123 Feb 5, 2025
07bd980
fix set user role
Anchel123 Feb 5, 2025
900d892
Merge branch 'staging' into update-ci-and-tests
Anchel123 Feb 5, 2025
a5c2bb8
Merge pull request #638 from FalkorDB/update-ci-and-tests
Naseem77 Feb 5, 2025
d99d258
update locators
Naseem77 Feb 5, 2025
484317e
Merge branch 'staging' into small-changes
Anchel123 Feb 5, 2025
33e1ec3
Update DialogComponent.tsx
Anchel123 Feb 5, 2025
8c49231
Merge pull request #645 from FalkorDB/small-changes
Anchel123 Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "22"
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Restore cache
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

services:
falkordb:
image: falkordb/falkordb:latest
image: falkordb/falkordb:v4.4.1
ports:
- 6379:6379

Expand All @@ -34,9 +34,20 @@ jobs:
npm install
npm run build
NEXTAUTH_SECRET=SECRET npm start & npx playwright test --reporter=dot,list
- name: Ensure required directories exist
run: |
mkdir -p playwright-report
mkdir -p playwright-report/artifacts
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Upload failed test screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: failed-test-screenshots
path: playwright-report/artifacts/
retention-days: 30
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:18-alpine AS base
FROM node:22-alpine AS base

gkorland marked this conversation as resolved.
Show resolved Hide resolved
# Install dependencies only when needed
FROM base AS deps
Expand Down Expand Up @@ -68,4 +68,4 @@ ENV HOSTNAME "0.0.0.0"

# server.js is created by next build from the standalone output
# https://nextjs.org/docs/pages/api-reference/next-config-js/output
CMD ["node", "server.js"]
CMD ["node", "server.js"]
49 changes: 36 additions & 13 deletions app/api/graph/model.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
/* eslint-disable one-var */
/* eslint-disable no-param-reassign */
/* eslint-disable @typescript-eslint/no-explicit-any */

import { EdgeDataDefinition, NodeDataDefinition } from 'cytoscape';
import { LinkObject, NodeObject } from 'react-force-graph-2d';

const getSchemaValue = (value: string): string[] => {
let unique, required, type, description
if (value.includes("!")) {
value = value.replace("!", "")
unique = "true"
} else {
unique = "false"
}
if (value.includes("*")) {
value = value.replace("*", "")
required = "true"
} else {
required = "false"
}
if (value.includes("-")) {
[type, description] = value.split("-")
} else {
type = "string"
description = ""
}
return [type, description, unique, required]
}

export type Node = NodeObject<{
id: number,
category: string[],
Expand Down Expand Up @@ -209,14 +233,14 @@ export class Graph {
return new Graph(graphName || "", [], [], { nodes: [], links: [] }, new Map<string, Category>(), new Map<string, Category>(), new Map<number, Node>(), new Map<number, Link>(), colors)
}

public static create(id: string, results: any, colors?: string[]): Graph {
public static create(id: string, results: { data: Data, metadata: any[] }, isCollapsed: boolean, isSchema: boolean, colors?: string[],): Graph {
const graph = Graph.empty(undefined, colors)
graph.extend(results)
graph.extend(results, isCollapsed, isSchema)
graph.id = id
return graph
}

public extendNode(cell: NodeCell, collapsed = false) {
public extendNode(cell: NodeCell, collapsed: boolean, isSchema: boolean) {
// check if category already exists in categories
const categories = this.createCategory(cell.labels.length === 0 ? [""] : cell.labels)
// check if node already exists in nodes or fake node was created
Expand All @@ -233,7 +257,7 @@ export class Graph {
data: {}
}
Object.entries(cell.properties).forEach(([key, value]) => {
node.data[key] = value as string;
node.data[key] = isSchema ? getSchemaValue(value) : value;
});
this.nodesMap.set(cell.id, node)
this.elements.nodes.push(node)
Expand All @@ -248,7 +272,7 @@ export class Graph {
currentNode.expand = false
currentNode.collapsed = collapsed
Object.entries(cell.properties).forEach(([key, value]) => {
currentNode.data[key] = value as string;
currentNode.data[key] = isSchema ? getSchemaValue(value) : value;
});

// remove empty category if there are no more empty nodes category
Expand All @@ -272,9 +296,8 @@ export class Graph {
return currentNode
}

public extendEdge(cell: LinkCell, collapsed = false) {
public extendEdge(cell: LinkCell, collapsed: boolean, isSchema: boolean) {
const label = this.createLabel(cell.relationshipType)

const currentEdge = this.linksMap.get(cell.id)

if (!currentEdge) {
Expand Down Expand Up @@ -369,7 +392,7 @@ export class Graph {
}

Object.entries(cell.properties).forEach(([key, value]) => {
link.data[key] = value as string;
link.data[key] = isSchema ? getSchemaValue(value) : value;
});

this.linksMap.set(cell.id, link)
Expand All @@ -381,7 +404,7 @@ export class Graph {
return currentEdge
}

public extend(results: { data: Data, metadata: any[] }, collapsed = false): (Node | Link)[] {
public extend(results: { data: Data, metadata: any[] }, collapsed = false, isSchema = false): (Node | Link)[] {
const newElements: (Node | Link)[] = []
const data = results?.data

Expand All @@ -399,15 +422,15 @@ export class Graph {
if (cell instanceof Object) {
if (cell.nodes) {
cell.nodes.forEach((node: any) => {
newElements.push(this.extendNode(node, collapsed))
newElements.push(this.extendNode(node, collapsed, isSchema))
})
cell.edges.forEach((edge: any) => {
newElements.push(this.extendEdge(edge, collapsed))
newElements.push(this.extendEdge(edge, collapsed, isSchema))
})
} else if (cell.relationshipType) {
newElements.push(this.extendEdge(cell, collapsed))
newElements.push(this.extendEdge(cell, collapsed, isSchema))
} else if (cell.labels) {
newElements.push(this.extendNode(cell, collapsed))
newElements.push(this.extendNode(cell, collapsed, isSchema))
}
}
})
Expand Down
15 changes: 6 additions & 9 deletions app/components/EditorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const KEYWORDS = [
"ORDER BY",
"SKIP",
"LIMIT",
"MARGE",
"MERGE",
Anchel123 marked this conversation as resolved.
Show resolved Hide resolved
"DELETE",
"SET",
"WITH",
Expand Down Expand Up @@ -357,6 +357,8 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
if (!graph.Id || (!monacoInstance && !monacoI)) return
const m = monacoI || monacoInstance
const sug: Suggestions = getEmptySuggestions()

sugProvider?.dispose()

await Promise.all([
addLabelsSuggestions(sug.labels),
Expand Down Expand Up @@ -463,20 +465,16 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
run()
}, [graph])


useEffect(() => {
getSuggestions()
}, [graph.Id])

useEffect(() => {
const interval = setInterval(() => {
getSuggestions()
}, 5000)

return () => {
clearInterval(interval)
sugProvider?.dispose()
}
}, [])
}, [graph.Id])

const handleEditorWillMount = (monacoI: Monaco) => {
monacoI.languages.setMonarchTokensProvider('custom-language', {
Expand Down Expand Up @@ -557,7 +555,6 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
updatePlaceholderVisibility();
});

// Initial check
updatePlaceholderVisibility();

setMonacoInstance(monacoI)
Expand All @@ -572,7 +569,7 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
setBlur(false)
})

const isFirstLine = e.createContextKey('isFirstLine', false as boolean);
const isFirstLine = e.createContextKey<boolean>('isFirstLine', true);

// Update the context key value based on the cursor position
e.onDidChangeCursorPosition(() => {
Expand Down
26 changes: 20 additions & 6 deletions app/components/ForceGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ interface Props {
type?: "schema" | "graph"
isAddElement?: boolean
setSelectedNodes?: Dispatch<SetStateAction<[Node | undefined, Node | undefined]>>
isCollapsed: boolean
}

const NODE_SIZE = 6
Expand All @@ -43,7 +42,6 @@ export default function ForceGraph({
type = "graph",
isAddElement = false,
setSelectedNodes,
isCollapsed
}: Props) {

const [parentWidth, setParentWidth] = useState<number>(0)
Expand All @@ -60,10 +58,26 @@ export default function ForceGraph({
}, [chartRef, data.links.length, data.nodes.length])

useEffect(() => {
if (!parentRef.current) return
setParentWidth(parentRef.current.clientWidth)
setParentHeight(parentRef.current.clientHeight)
}, [parentRef.current?.clientWidth, parentRef.current?.clientHeight, isCollapsed])
const handleResize = () => {
if (!parentRef.current) return
setParentWidth(parentRef.current.clientWidth)
setParentHeight(parentRef.current.clientHeight)
}

handleResize()

const resizeObserver = new ResizeObserver(handleResize)
if (parentRef.current) {
resizeObserver.observe(parentRef.current)
}

window.addEventListener('resize', handleResize)

return () => {
resizeObserver.disconnect()
window.removeEventListener('resize', handleResize)
}
}, [])

const onFetchNode = async (node: Node) => {
const result = await securedFetch(`/api/graph/${graph.Id}/${node.id}`, {
Expand Down
8 changes: 2 additions & 6 deletions app/graph/GraphView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ import Button from "../components/ui/Button";
import TableView from "./TableView";

const ForceGraph = dynamic(() => import("../components/ForceGraph"), { ssr: false });

const EditorComponent = dynamic(() => import("../components/EditorComponent"), {
ssr: false
})
const EditorComponent = dynamic(() => import("../components/EditorComponent"), {ssr: false})

function GraphView({ graph, selectedElement, setSelectedElement, runQuery, historyQuery, historyQueries, fetchCount, session }: {
graph: Graph
Expand Down Expand Up @@ -278,7 +275,7 @@ function GraphView({ graph, selectedElement, setSelectedElement, runQuery, histo
title={!maximize ? "Maximize" : "Minimize"}
onClick={() => setMaximize(prev => !prev)}
>
{maximize ? <Maximize2 /> : <Minimize2 />}
{!maximize ? <Maximize2 /> : <Minimize2 />}
</Button>
<div className="z-10 absolute top-4 left-4 flex items-center gap-2 pointer-events-none">
{cooldownTicks === undefined ? <Play size={20} /> : <Pause size={20} />}
Expand All @@ -292,7 +289,6 @@ function GraphView({ graph, selectedElement, setSelectedElement, runQuery, histo
/>
</div>
<ForceGraph
isCollapsed={isCollapsed}
graph={graph}
chartRef={chartRef}
data={data}
Expand Down
2 changes: 1 addition & 1 deletion app/graph/Selector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function Selector({ onChange, graphName, setGraphName, queries, r

const json = await result.json()
if (json.result) {
setSchema(Graph.create(name, json.result))
setSchema(Graph.create(name, json.result, false, true))
Anchel123 marked this conversation as resolved.
Show resolved Hide resolved
}
}
onChange(name)
Expand Down
12 changes: 7 additions & 5 deletions app/graph/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ export default function View({ graph, setGraph, selectedValue }: {
const [editable, setEditable] = useState<string>("")

const handlePreferencesChange = (colors?: string[]) => {
setGraph(Graph.create(graph.Id, { data: graph.Data, metadata: graph.Metadata }, colors || colorsArr))
if (colors) return
setGraph(Graph.create(graph.Id, { data: graph.Data, metadata: graph.Metadata }, false, true, colors || colorsArr))
if (colors) {
localStorage.removeItem(graph.Id)
}
localStorage.setItem(graph.Id, JSON.stringify(colorsArr));
}

Expand All @@ -40,9 +42,9 @@ export default function View({ graph, setGraph, selectedValue }: {
className="w-[30%] h-[50%]"
title="Preferences"
>
<div className="h-full flex flex-col gap-8">
<div className="h-full flex flex-col gap-8 overflow-hidden">
<p className="text-xl">Legends</p>
<ul className="flex flex-col gap-4 overflow-auto">
<ul className="flex flex-col gap-4 p-2 overflow-auto">
{
colorsArr.map((c, i) => (
<li onMouseEnter={() => setHover(c)} onMouseLeave={(() => setHover(""))} key={c} className={cn(`flex gap-8 items-center`)}>
Expand Down Expand Up @@ -154,7 +156,7 @@ export default function View({ graph, setGraph, selectedValue }: {
<RotateCcw />
</Button>
<Button
disabled={graph.Colors.filter((c, i) => c === colorsArr[i]).length === colorsArr.length && DEFAULT_COLORS.length === colorsArr.length}
disabled={graph.Colors.every((c) => colorsArr.some(color => color === c)) && graph.Colors.length === colorsArr.length}
variant="Primary"
label="Apply"
onClick={() => handlePreferencesChange()}
Expand Down
4 changes: 2 additions & 2 deletions app/graph/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function Page() {
const queryArr = queries.some(q => q.text === query) ? queries : [...queries, { text: query, metadata: result.metadata }]
setQueries(queryArr)
localStorage.setItem("query history", JSON.stringify(queryArr))
const g = Graph.create(graphName, result, graph.Colors)
const g = Graph.create(graphName, result, false, false, graph.Colors)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify the new Graph.create parameters.

The Graph.create method now accepts two additional boolean parameters, both set to false. Please ensure that these parameters are documented and their purpose is clear.

Run the following script to check the method signature and documentation:

Also applies to: 103-103


🏁 Script executed:

#!/bin/bash
# Description: Check Graph.create method signature and documentation.

# Search for Graph.create method definition
ast-grep --pattern $'class Graph {
  $$$
  create($$$) {
    $$$
  }
  $$$
}'

Length of output: 78


I'll gather more details on the Graph.create method's signature and its associated documentation. We need to verify that the two new boolean parameters (both set to false) are properly documented in the method's definition.

Please run the following script to locate the file containing the Graph class and extract the context around the create( method:


🏁 Script executed:

#!/bin/bash
# Locate the file containing the Graph class definition
file=$(rg -l "class\s\+Graph" | head -n 1)
if [ -z "$file" ]; then
  echo "No file with 'class Graph' found."
  exit 1
fi
echo "Found class Graph in: $file"
echo ""
# Display context around the 'create(' method within that file
rg -C 15 "create\s*\(" "$file"

Length of output: 154


I'll run another search to locate the definition or documentation of the Graph.create method and its updated parameters. Let's try searching for any usage or declaration of Graph.create across the repository.

Please run the following script:


🏁 Script executed:

#!/bin/bash
# Search for any file that contains "Graph.create(" along with some context.
rg -n -C 5 "Graph\.create\(" .

Length of output: 4071


I'll run another script to search for the exported definition of the Graph class, which might lead us to the implementation and documentation for Graph.create.

Please run this shell script:


🏁 Script executed:

#!/bin/bash
# Search for the exported definition of Graph class in the repository
rg -l "export\s\+class\s\+Graph" .

Length of output: 36


I'll gather more information about where the Graph class is imported from and its definition to verify the new parameters. Please run the following script to search for Graph imports in the repository, starting with the affected file:


🏁 Script executed:

#!/bin/bash
# Search for Graph imports in app/graph/page.tsx
rg -n "import .*Graph" app/graph/page.tsx

Length of output: 148


I'll proceed by gathering further details from the file that exports the Graph class. Since Graph is imported from ../api/graph/model in app/graph/page.tsx, let’s inspect the method signature and documentation for Graph.create from that file.

Please run the following script:


🏁 Script executed:

#!/bin/bash
# Display the context around the Graph.create method in app/api/graph/model.ts
rg -n -C 10 "create\s*\(" app/api/graph/model.ts

Length of output: 1137

Action Required: Document the New Parameters in Graph.create

The Graph.create method in app/api/graph/model.ts now includes two new boolean parameters (isCollapsed and isSchema) that are not currently documented. Please add a descriptive comment or JSDoc block for these parameters to clarify their purpose. For example, you might explain:

  • isCollapsed: Indicates whether nodes should be rendered in a collapsed state.
  • isSchema: Specifies if the graph should be interpreted/constructed as a schema representation.

This documentation will help maintain clarity for other developers.

setGraph(g)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Expand All @@ -100,7 +100,7 @@ export default function Page() {
const queryArr = queries.some(q => q.text === query) ? queries : [...queries, { text: query, metadata: result.metadata }]
setQueries(queryArr)
localStorage.setItem("query history", JSON.stringify(queryArr))
setGraph(Graph.create(graphName, result))
setGraph(Graph.create(graphName, result, false, false, graph.Colors))
setHistoryQuery(query)
setQueriesOpen(false)
}
Expand Down
4 changes: 2 additions & 2 deletions app/schema/SchemaCreateElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function SchemaCreateElement({ onCreate, onExpand, selectedNodes,

const handleSetAttribute = (isUndo: boolean, att?: [string, string[]]) => {
const newAtt = att || attribute

if (!newAtt[0] || newAtt[1].some((v) => !v)) {
toast({
title: "Error",
Expand Down Expand Up @@ -194,7 +194,7 @@ export default function SchemaCreateElement({ onCreate, onExpand, selectedNodes,
/>
}
</div>
<p className="flex text-white">{attributes.length} Attributes</p>
<p className="font-medium text-xl"><span className="text-primary">{attributes.length}</span> Attributes</p>
</div>
<div className="w-full h-1 grow flex flex-col justify-between items-start font-medium">
<Table>
Expand Down
2 changes: 1 addition & 1 deletion app/schema/SchemaDataPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default function SchemaDataPanel({ obj, onExpand, onSetAttributes, onRemo
</Button>
<p>{label}</p>
</div>
<p className="flex text-white">{attributes.length} Attributes</p>
<p className="font-medium text-xl"><span className="text-primary">{attributes.length}</span> Attributes</p>
</div>
<Table parentClassName="grow">
<TableHeader>
Expand Down
Loading
Loading