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 all 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
11 changes: 11 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
110 changes: 64 additions & 46 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 @@ -63,10 +87,10 @@ export type DataRow = {
export type Data = DataRow[]

export const DEFAULT_COLORS = [
"#7466FF",
"#FF66B3",
"#FF804D",
"#80E6E6"
"hsl(246, 100%, 70%)",
"hsl(330, 100%, 70%)",
"hsl(20, 100%, 65%)",
"hsl(180, 66%, 70%)"
]

export interface Query {
Expand Down Expand Up @@ -103,14 +127,12 @@ export class Graph {

private elements: GraphData;

private categoriesMap: Map<string, Category>;
private colorIndex: number = 0;

private categoriesColorIndex: number = 0;
private categoriesMap: Map<string, Category>;

private labelsMap: Map<string, Category>;

private labelsColorIndex: number = 0;

private nodesMap: Map<number, Node>;

private linksMap: Map<number, Link>;
Expand All @@ -130,7 +152,7 @@ export class Graph {
this.labelsMap = labelsMap;
this.nodesMap = nodesMap;
this.linksMap = edgesMap;
this.COLORS_ORDER_VALUE = colors || DEFAULT_COLORS
this.COLORS_ORDER_VALUE = [...(colors || DEFAULT_COLORS)]
}

get Id(): string {
Expand Down Expand Up @@ -209,14 +231,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 +255,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,33 +270,15 @@ 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
if (Array.from(this.nodesMap.values()).every(n => n.category.some(c => c !== ""))) {
this.categories = this.categories.filter(l => l.name !== "").map(c => {
// eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain
if (this.categoriesMap.get("")?.index! < c.index) {
c.index -= 1
this.categoriesMap.get(c.name)!.index = c.index
}
return c
})
this.categoriesMap.delete("")
this.categoriesColorIndex -= 1
this.elements.nodes.forEach(n => {
n.color = this.getCategoryColorValue(this.categoriesMap.get(n.category[0])?.index)
})
}
}

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 +373,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 +385,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 +403,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 Expand Up @@ -435,6 +439,13 @@ export class Graph {

link.curve = curve * 0.1
})

// remove empty category if there are no more empty nodes category
if (Array.from(this.nodesMap.values()).every(n => n.category.some(c => c !== ""))) {
this.categories = this.categories.filter(c => c.name !== "")
this.categoriesMap.delete("")
}

return newElements
}

Expand All @@ -461,8 +472,8 @@ export class Graph {
let c = this.categoriesMap.get(category)

if (!c) {
c = { name: category, index: this.categoriesColorIndex, show: true }
this.categoriesColorIndex += 1
c = { name: category, index: this.colorIndex, show: true }
this.colorIndex += 1
this.categoriesMap.set(c.name, c)
this.categories.push(c)
}
Expand All @@ -475,8 +486,8 @@ export class Graph {
let l = this.labelsMap.get(category)

if (!l) {
l = { name: category, index: this.labelsColorIndex, show: true }
this.labelsColorIndex += 1
l = { name: category, index: this.colorIndex, show: true }
this.colorIndex += 1
this.labelsMap.set(l.name, l)
this.labels.push(l)
}
Expand Down Expand Up @@ -520,7 +531,14 @@ export class Graph {
}
}

public getCategoryColorValue(index = 0): string {
return this.COLORS_ORDER_VALUE[index % this.COLORS_ORDER_VALUE.length]
public getCategoryColorValue(index = 0) {
if (index < this.COLORS_ORDER_VALUE.length) {
return this.COLORS_ORDER_VALUE[index];
}

const newColor = `hsl(${(index - 4) * 20}, 100%, 70%)`
this.COLORS_ORDER_VALUE.push(newColor)
DEFAULT_COLORS.push(newColor)
return newColor
}
}
}
2 changes: 1 addition & 1 deletion app/api/user/[user]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function PATCH(req: NextRequest, { params }: { params: Promise<{ us
}

const { user: username } = await params
const role = ROLE.get(req.nextUrl.searchParams.get("role") || "")
const role = ROLE.get(req.nextUrl.searchParams.get("userRole") || "")
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

LGTM! Verify the impact of renaming the query parameter.

The change from "role" to "userRole" is valid. However, ensure that all client-side code has been updated to use the new parameter name.

Run the following script to verify the parameter usage:


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining usage of the old parameter name.

# Test: Search for "role" parameter in API calls. Expect: Only occurrences of "userRole".
rg -A 5 $'searchParams\.get\("role"\)'

Length of output: 495

Inconsistent Query Parameter Name Detected

The renaming to "userRole" was correctly applied in app/api/user/[user]/route.ts, but the search reveals that app/api/graph/[graph]/route.ts still uses the old parameter "role". Please review whether this endpoint should also be updated to "userRole" to maintain consistency with client-side expectations.

try {
if (!role) throw new Error("Role is missing")

Expand Down
1 change: 0 additions & 1 deletion app/api/user/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export async function POST(req: NextRequest) {
return NextResponse.json({ message: `User ${username} already exists` }, { status: 409 })
}
} catch (err: unknown) {
console.error(err)
// Just a workaround for https://github.com/redis/node-redis/issues/2745
}

Expand Down
39 changes: 24 additions & 15 deletions app/components/CreateGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
"use client"

import { useState } from "react"
import { AlertCircle, PlusCircle } from "lucide-react"
import { InfoIcon, PlusCircle } from "lucide-react"
import { prepareArg, securedFetch } from "@/lib/utils"
import { useToast } from "@/components/ui/use-toast"
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"
import { useSession } from "next-auth/react"
import DialogComponent from "./DialogComponent"
import Button from "./ui/Button"
import CloseDialog from "./CloseDialog"
Expand All @@ -23,7 +25,7 @@ export default function CreateGraph({
trigger = (
<Button
variant="Primary"
label="Create New Graph"
label={`Create New ${type}`}
>
<PlusCircle />
</Button>
Expand All @@ -33,10 +35,12 @@ export default function CreateGraph({
const [graphName, setGraphName] = useState("")
const [open, setOpen] = useState(false)
const { toast } = useToast()

const { data: session } = useSession()

const handleCreateGraph = async (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (!graphName) {
const name = graphName.trim()
if (!name) {
toast({
title: "Error",
description: "Graph name cannot be empty",
Expand All @@ -45,15 +49,19 @@ export default function CreateGraph({
return
}
const q = 'RETURN 1'
const result = await securedFetch(`api/graph/${prepareArg(graphName)}/?query=${prepareArg(q)}`, {
const result = await securedFetch(`api/graph/${prepareArg(name)}/?query=${prepareArg(q)}`, {
method: "GET",
}, toast)
}, session?.user?.role, toast)

if (!result.ok) return

onSetGraphName(graphName)
onSetGraphName(name)
setGraphName("")
setOpen(false)
toast({
title: "Graph created successfully",
description: "The graph has been created successfully",
})
}

return (
Expand All @@ -68,14 +76,15 @@ export default function CreateGraph({
handleCreateGraph(e)
}}>
<div className="flex gap-2 items-center">
<Button
className="text-nowrap"
type="button"
title={`${type} names can be edited later`}
>
<AlertCircle size={20} />
</Button>
<p className="font-normal text-2xl">Name your graph:</p>
<Tooltip>
<TooltipTrigger asChild>
<InfoIcon size={20} />
</TooltipTrigger>
<TooltipContent>
{`${type} names can be edited later`}
</TooltipContent>
</Tooltip>
<p className="font-normal text-2xl">Name your {type}:</p>
<Input
variant="primary"
ref={ref => ref?.focus()}
Expand Down
Loading
Loading