mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-06 02:49:56 +00:00
fix(web): add 15 missing NodeLabel colors/sizes, escape table names, schema sync
- Add NODE_COLORS and NODE_SIZES entries for all 15 multi-language labels (Struct, Trait, Impl, TypeAlias, Const, Static, Namespace, Union, Typedef, Macro, Property, Record, Delegate, Annotation, Constructor, Template) — fixes Record<NodeLabel, ...> completeness - Escape table names in count/lookup queries with escapeTableName() to prevent silent failures for backtick-required tables - Add HAS_PROPERTY and ACCESSES to RelationshipType union - Update initPromise after db recreation in loadGraphToLbug so subsequent initLbug() calls return fresh db/conn refs Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f4bb78c03a
commit
8956da61bb
3 changed files with 40 additions and 3 deletions
|
|
@ -72,6 +72,8 @@ export type RelationshipType =
|
|||
| 'IMPLEMENTS'
|
||||
| 'EXTENDS'
|
||||
| 'HAS_METHOD'
|
||||
| 'HAS_PROPERTY'
|
||||
| 'ACCESSES'
|
||||
| 'MEMBER_OF'
|
||||
| 'STEP_IN_PROCESS'
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,9 @@ export const loadGraphToLbug = async (
|
|||
db = new lbugModule.Database(':memory:', BUFFER_POOL_SIZE);
|
||||
conn = new lbugModule.Connection(db);
|
||||
|
||||
// Update initPromise so subsequent initLbug() calls return the fresh db/conn
|
||||
initPromise = Promise.resolve({ db, conn, lbug: lbugModule });
|
||||
|
||||
// Re-run schema creation
|
||||
for (let i = 0; i < SCHEMA_QUERIES.length; i++) {
|
||||
try {
|
||||
|
|
@ -282,7 +285,7 @@ export const loadGraphToLbug = async (
|
|||
let totalNodes = 0;
|
||||
for (const tableName of NODE_TABLES) {
|
||||
try {
|
||||
const countRes = await conn.query(`MATCH (n:${tableName}) RETURN count(n) AS cnt`);
|
||||
const countRes = await conn.query(`MATCH (n:${escapeTableName(tableName)}) RETURN count(n) AS cnt`);
|
||||
const countRows = await countRes.getAllRows();
|
||||
const countRow = countRows[0];
|
||||
const count = countRow ? (countRow.cnt ?? countRow[0] ?? 0) : 0;
|
||||
|
|
@ -440,7 +443,7 @@ export const getLbugStats = async (): Promise<{ nodes: number; edges: number }>
|
|||
let totalNodes = 0;
|
||||
for (const tableName of NODE_TABLES) {
|
||||
try {
|
||||
const nodeResult = await conn.query(`MATCH (n:${tableName}) RETURN count(n) AS cnt`);
|
||||
const nodeResult = await conn.query(`MATCH (n:${escapeTableName(tableName)}) RETURN count(n) AS cnt`);
|
||||
const nodeRows = await nodeResult.getAllRows();
|
||||
const nodeRow = nodeRows[0];
|
||||
totalNodes += Number(nodeRow?.cnt ?? nodeRow?.[0] ?? 0);
|
||||
|
|
@ -583,7 +586,7 @@ export const testArrayParams = async (): Promise<{ success: boolean; error?: str
|
|||
let testNodeId: string | null = null;
|
||||
for (const tableName of NODE_TABLES) {
|
||||
try {
|
||||
const nodeResult = await conn.query(`MATCH (n:${tableName}) RETURN n.id AS id LIMIT 1`);
|
||||
const nodeResult = await conn.query(`MATCH (n:${escapeTableName(tableName)}) RETURN n.id AS id LIMIT 1`);
|
||||
const nodeRows = await nodeResult.getAllRows();
|
||||
const nodeRow = nodeRows[0];
|
||||
if (nodeRow) {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,22 @@ export const NODE_COLORS: Record<NodeLabel, string> = {
|
|||
Community: '#818cf8', // Indigo light - cluster indicator
|
||||
Process: '#f43f5e', // Rose - execution flow indicator
|
||||
Section: '#60a5fa', // Blue light - structural section
|
||||
Struct: '#f59e0b', // Amber - like Class
|
||||
Trait: '#ec4899', // Pink - like Interface
|
||||
Impl: '#14b8a6', // Teal - like Method
|
||||
TypeAlias: '#a78bfa', // Violet light - like Type
|
||||
Const: '#64748b', // Slate - like Variable
|
||||
Static: '#64748b', // Slate - like Variable
|
||||
Namespace: '#7c3aed', // Violet - like Module
|
||||
Union: '#f97316', // Orange - like Enum
|
||||
Typedef: '#a78bfa', // Violet light - like Type
|
||||
Macro: '#eab308', // Yellow - like Decorator
|
||||
Property: '#64748b', // Slate - like Variable
|
||||
Record: '#f59e0b', // Amber - like Class
|
||||
Delegate: '#14b8a6', // Teal - like Method
|
||||
Annotation: '#eab308', // Yellow - like Decorator
|
||||
Constructor: '#10b981', // Emerald - like Function
|
||||
Template: '#a78bfa', // Violet light - like Type
|
||||
};
|
||||
|
||||
// Node sizes by type - clear visual hierarchy with dramatic size differences
|
||||
|
|
@ -43,6 +59,22 @@ export const NODE_SIZES: Record<NodeLabel, number> = {
|
|||
Community: 0, // Hidden by default - metadata node
|
||||
Process: 0, // Hidden by default - metadata node
|
||||
Section: 8, // Structural section - similar to Folder
|
||||
Struct: 8, // Like Class
|
||||
Trait: 7, // Like Interface
|
||||
Impl: 3, // Like Method
|
||||
TypeAlias: 3, // Like Type
|
||||
Const: 2, // Like Variable
|
||||
Static: 2, // Like Variable
|
||||
Namespace: 13, // Like Module
|
||||
Union: 5, // Like Enum
|
||||
Typedef: 3, // Like Type
|
||||
Macro: 2, // Like Decorator
|
||||
Property: 2, // Like Variable
|
||||
Record: 8, // Like Class
|
||||
Delegate: 3, // Like Method
|
||||
Annotation: 2, // Like Decorator
|
||||
Constructor: 4, // Like Function
|
||||
Template: 3, // Like Type
|
||||
};
|
||||
|
||||
// Community color palette for cluster-based coloring
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue