From 27c1877b5d4fd2a41d1d88cba1ca45def85cebd0 Mon Sep 17 00:00:00 2001 From: Leonardo <leomilho@gmail.com> Date: Fri, 18 Oct 2024 11:26:57 +0200 Subject: [PATCH] fix: populate env example for production fill in --- .dockerignore | 9 ++++- apps/web/.env | 34 +++++++++++++------ apps/web/.env.development | 14 +++++++- apps/web/.env.example | 14 +++++++- docker-compose.yml | 32 +++++++++++------ libs/shared/lib/statistics/graphStatistics.ts | 2 +- .../statistics/tests/graphStatistics.spec.ts | 14 ++++---- .../lib/statistics/utils/getNodeOrEdgeType.ts | 1 + 8 files changed, 89 insertions(+), 31 deletions(-) diff --git a/.dockerignore b/.dockerignore index cc789a213..03316d380 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,2 +1,9 @@ node_modules -libs/storybook \ No newline at end of file +node_modules/ +libs/storybook +apps/web/dist +apps/web/dist/ +apps/web/node_modules +apps/web/node_modules/ +libs/shared/node_modules +libs/shared/node_modules/ \ No newline at end of file diff --git a/apps/web/.env b/apps/web/.env index 9c219932b..24c5fc801 100644 --- a/apps/web/.env +++ b/apps/web/.env @@ -1,10 +1,24 @@ -GRAPHPOLARIS_VERSION=dev -BACKEND_URL=http://localhost -BACKEND_WSS_URL=ws://localhost:3001/ -STAGING=dev -SKIP_LOGIN=true -BACKEND_USER=:3000 -GRAPHPOLARIS_VERSION=dev - -SENTRY_ENABLED=false -SENTRY_URL= GP_AUTH_URL= \ No newline at end of file +GRAPHPOLARIS_VERSION=dev +BACKEND_URL=http://localhost +BACKEND_WSS_URL=ws://localhost:3001/ +STAGING=dev +SKIP_LOGIN=true +BACKEND_USER=:3000 +GRAPHPOLARIS_VERSION=dev + +SENTRY_ENABLED=false +SENTRY_URL= + +GP_AUTH_URL= + +WIP_TABLEVIS=false +WIP_NODELINKVIS=false +WIP_RAWJSONVIS=false +WIP_PAOHVIS=true +WIP_MATRIXVIS=true +WIP_SEMANTICSUBSTRATESVIS=true +WIP_MAPVIS=true + +WIP_INSIGHT_SHARING=true +WIP_VIEWER_PERMISSIONS=true +WIP_SHARABLE_EXPLORATION=true \ No newline at end of file diff --git a/apps/web/.env.development b/apps/web/.env.development index 1f749acb0..8375aafc0 100644 --- a/apps/web/.env.development +++ b/apps/web/.env.development @@ -9,4 +9,16 @@ VITE_BACKEND_SCHEMA=:3002 SENTRY_ENABLED=false SENTRY_URL= -GP_AUTH_URL= \ No newline at end of file +GP_AUTH_URL= + +WIP_TABLEVIS=false +WIP_NODELINKVIS=false +WIP_RAWJSONVIS=false +WIP_PAOHVIS=true +WIP_MATRIXVIS=true +WIP_SEMANTICSUBSTRATESVIS=true +WIP_MAPVIS=true + +WIP_INSIGHT_SHARING=true +WIP_VIEWER_PERMISSIONS=true +WIP_SHARABLE_EXPLORATION=true \ No newline at end of file diff --git a/apps/web/.env.example b/apps/web/.env.example index 45aa34e00..10dba96b2 100644 --- a/apps/web/.env.example +++ b/apps/web/.env.example @@ -8,4 +8,16 @@ BACKEND_USER= SENTRY_ENABLED=false SENTRY_URL= -GP_AUTH_URL= \ No newline at end of file +GP_AUTH_URL= + +WIP_TABLEVIS=false +WIP_NODELINKVIS=false +WIP_RAWJSONVIS=false +WIP_PAOHVIS=true +WIP_MATRIXVIS=true +WIP_SEMANTICSUBSTRATESVIS=true +WIP_MAPVIS=true + +WIP_INSIGHT_SHARING=true +WIP_VIEWER_PERMISSIONS=true +WIP_SHARABLE_EXPLORATION=true \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index b38fad5cd..7f845721e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,10 @@ -version: '3.9' - services: frontend: - image: harbor.graphpolaris.com/graphpolaris/frontend:latest + image: harbor.graphpolaris.com/graphpolaris/frontend-dev:latest build: context: ./ dockerfile: ./Dockerfile + container_name: frontend ports: - 4200:4200 environment: @@ -17,12 +16,25 @@ services: # - BACKEND_USER=user-management-service - STAGING=dev - GRAPHPOLARIS_VERSION=dev - - GRAPHPOLARIS_VERSION=compose + - SKIP_LOGIN=false + - SENTRY_ENABLED=false + - SENTRY_URL=http://localhost + - GP_AUTH_URL=https://auth.staging.graphpolaris.com/ + - WIP_TABLEVIS=false + - WIP_NODELINKVIS=false + - WIP_RAWJSONVIS=false + - WIP_PAOHVIS=true + - WIP_MATRIXVIS=true + - WIP_SEMANTICSUBSTRATESVIS=true + - WIP_MAPVIS=true + - WIP_INSIGHT_SHARING=true + - WIP_VIEWER_PERMISSIONS=true + - WIP_SHARABLE_EXPLORATION=true restart: always - networks: - - graphpolaris_network + # networks: + # - graphpolaris_network -networks: - graphpolaris_network: - name: custom_network - external: true +# networks: +# graphpolaris_network: +# name: custom_network +# external: true diff --git a/libs/shared/lib/statistics/graphStatistics.ts b/libs/shared/lib/statistics/graphStatistics.ts index ffaf9fb4f..53ead16bd 100644 --- a/libs/shared/lib/statistics/graphStatistics.ts +++ b/libs/shared/lib/statistics/graphStatistics.ts @@ -9,7 +9,7 @@ const getGraphStatistics = (graph: GraphQueryResultFromBackend): GraphStatistics const n_edges = edges.length; const metaData: GraphStatistics = { - topological: { density: (n_edges * 2) / (n_nodes * (n_nodes - 1)), self_loops: 0 }, + topological: { density: (n_edges * 2) / (n_nodes * (n_nodes - 1)) || 0, self_loops: 0 }, nodes: { labels: [], count: n_nodes, types: {} }, edges: { labels: [], count: n_edges, types: {} }, }; diff --git a/libs/shared/lib/statistics/tests/graphStatistics.spec.ts b/libs/shared/lib/statistics/tests/graphStatistics.spec.ts index 772de8011..9d59f2906 100644 --- a/libs/shared/lib/statistics/tests/graphStatistics.spec.ts +++ b/libs/shared/lib/statistics/tests/graphStatistics.spec.ts @@ -21,8 +21,8 @@ describe('getGraphStatistics', () => { it('should return correct statistics for a graph with nodes and no edges', () => { const graph: GraphQueryResultFromBackend = { nodes: [ - { _id: '1', attributes: { age: 25 } }, - { _id: '2', attributes: { age: 30, city: 'New York' } }, + { _id: '1', label: 'Person', attributes: { age: 25 } }, + { _id: '2', label: 'Person', attributes: { age: 30, city: 'New York' } }, ], edges: [], }; @@ -51,19 +51,19 @@ describe('getGraphStatistics', () => { it('should return correct statistics for a graph with edges and nodes', () => { const graph: GraphQueryResultFromBackend = { nodes: [ - { _id: '1', attributes: { age: 25 } }, - { _id: '2', attributes: { age: 30 } }, + { _id: '1', label: 'Person', attributes: { age: 25 } }, + { _id: '2', label: 'Person', attributes: { age: 30 } }, ], edges: [ - { _id: 'e1', attributes: { weight: 5 }, from: '1', to: '2' }, - { _id: 'e2', attributes: { weight: 10 }, from: '2', to: '2' }, // self-loop + { _id: 'e1', label: 'Relationship', attributes: { weight: 5 }, from: '1', to: '2' }, + { _id: 'e2', label: 'Relationship', attributes: { weight: 10 }, from: '2', to: '2' }, // self-loop ], }; const stats = getGraphStatistics(graph); expect(stats).toEqual({ - topological: { density: 1, self_loops: 1 }, + topological: { density: 2, self_loops: 1 }, nodes: { labels: ['Person'], // Assuming default label count: 2, diff --git a/libs/shared/lib/statistics/utils/getNodeOrEdgeType.ts b/libs/shared/lib/statistics/utils/getNodeOrEdgeType.ts index 54caff5a0..3ebc86131 100644 --- a/libs/shared/lib/statistics/utils/getNodeOrEdgeType.ts +++ b/libs/shared/lib/statistics/utils/getNodeOrEdgeType.ts @@ -17,6 +17,7 @@ const getEdgeType = (edge: GraphQueryResultFromBackend['edges'][number]): string if (!edge._id.includes('/')) { edgeType = edge.attributes.Type as string; } + if (edge.label) edgeType = edge.label; return edgeType; }; -- GitLab