From 67b041826f5506b6e8d7d504ba8770a88a3481ab Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Thu, 27 Feb 2025 20:55:39 +0000 Subject: [PATCH 1/6] Fix update info --- .../project-view/stores/project/computedValueRegistry.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/app/gui/src/project-view/stores/project/computedValueRegistry.ts b/app/gui/src/project-view/stores/project/computedValueRegistry.ts index a5f8b5099127..1facb53a1f20 100644 --- a/app/gui/src/project-view/stores/project/computedValueRegistry.ts +++ b/app/gui/src/project-view/stores/project/computedValueRegistry.ts @@ -56,13 +56,6 @@ export class ComputedValueRegistry { processUpdates(updates: ExpressionUpdate[]) { for (const update of updates) { const info = this.db.get(update.expressionId) - if (update.payload.type == 'Pending' && update.payload.progress == -1.0) { - // just update the payload - if (info) { - info.payload = update.payload - } - continue - } if (info) updateInfo(info, update, this.projectNames) else this.db.set(update.expressionId, combineInfo(undefined, update, this.projectNames)) } @@ -86,6 +79,7 @@ function updateInfo( ) { const newInfo = combineInfo(info, update, projectNames) if (newInfo.typename !== info.typename) info.typename = newInfo.typename + if (newInfo.rawTypename !== info.rawTypename) info.rawTypename = newInfo.rawTypename if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall if (newInfo.payload !== info.payload) info.payload = newInfo.payload if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo From a215b55a503676af730732caf7c445f5dc820d75 Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Mon, 3 Mar 2025 11:00:33 +0000 Subject: [PATCH 2/6] checkpoint --- .../project-view/stores/project/computedValueRegistry.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/gui/src/project-view/stores/project/computedValueRegistry.ts b/app/gui/src/project-view/stores/project/computedValueRegistry.ts index 1facb53a1f20..b05057a4d82d 100644 --- a/app/gui/src/project-view/stores/project/computedValueRegistry.ts +++ b/app/gui/src/project-view/stores/project/computedValueRegistry.ts @@ -83,6 +83,14 @@ function updateInfo( if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall if (newInfo.payload !== info.payload) info.payload = newInfo.payload if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo + // Ensure new fields can't be added to `ExpressionInfo` without this code being updated. + const _allFieldsHandled = { + typename, + rawTypename, + methodCall, + payload, + profilingInfo, + } satisfies ExpressionInfo } /** From d248e3268d0e314e31fe797e6b498c6db3d6c8cb Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Thu, 6 Mar 2025 18:00:14 +0000 Subject: [PATCH 3/6] Code Review feedback --- .../graphNodeVisualization.spec.ts | 9 ++++++++- .../integration-test/project-view/locate.ts | 4 ++++ .../VisualizationToolbar.vue | 1 + .../stores/project/computedValueRegistry.ts | 18 +++++++++--------- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts b/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts index 271641addc76..e6f2032564a9 100644 --- a/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts +++ b/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts @@ -5,10 +5,11 @@ import { computedContent } from './css' import { expect } from './customExpect' import { CONTROL_KEY } from './keyboard' import * as locate from './locate' +import { mockExpressionUpdate } from './expressionUpdates' test('Node can open and load visualization', async ({ page }) => { await actions.goToGraph(page) - const node = locate.graphNode(page).last() + const node = locate.graphNodeByBinding(page, 'final') await node.click({ position: { x: 8, y: 8 } }) await expect(locate.componentMenu(page)).toExist() await locate.toggleVisualizationButton(page).click() @@ -24,6 +25,12 @@ test('Node can open and load visualization', async ({ page }) => { const textContent = await computedContent(element) const jsonContent = JSON.parse(textContent) expect(typeof jsonContent).toBe('object') + const nodeType = await locate.visualisationNodeType(page) + await expect(nodeType).toHaveText('Unknown') + await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.Table'] }) + await expect(nodeType).toHaveText('Table') + await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.DifferentType'] }) + await expect(nodeType).toHaveText('DifferentType') }) test('Previewing visualization', async ({ page }) => { diff --git a/app/gui/integration-test/project-view/locate.ts b/app/gui/integration-test/project-view/locate.ts index 24e1d897db92..df041dafd6b9 100644 --- a/app/gui/integration-test/project-view/locate.ts +++ b/app/gui/integration-test/project-view/locate.ts @@ -154,6 +154,10 @@ export const geoMapVisualization = visualizationLocator('.GeoMapVisualization') export const imageBase64Visualization = visualizationLocator('.ImageBase64Visualization') export const warningsVisualization = visualizationLocator('.WarningsVisualization') +export function visualisationNodeType(page: Page) { + return page.getByTestId('visualisationNodeType') +} + // === Edge locators === /** All edges going from a node with given binding. */ diff --git a/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue b/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue index 40f89a4d629d..fbfa3b6f9be4 100644 --- a/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue +++ b/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue @@ -107,6 +107,7 @@ useEvent(window, 'pointerup', (e) => interaction.handlePointerEvent(e, 'pointeru class="after-toolbars node-type" :title="props.typename ?? UNKNOWN_TYPE" v-text="nodeShortType" + data-testid="visualisationNodeType" /> diff --git a/app/gui/src/project-view/stores/project/computedValueRegistry.ts b/app/gui/src/project-view/stores/project/computedValueRegistry.ts index b05057a4d82d..c918f15969ca 100644 --- a/app/gui/src/project-view/stores/project/computedValueRegistry.ts +++ b/app/gui/src/project-view/stores/project/computedValueRegistry.ts @@ -82,15 +82,15 @@ function updateInfo( if (newInfo.rawTypename !== info.rawTypename) info.rawTypename = newInfo.rawTypename if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall if (newInfo.payload !== info.payload) info.payload = newInfo.payload - if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo - // Ensure new fields can't be added to `ExpressionInfo` without this code being updated. - const _allFieldsHandled = { - typename, - rawTypename, - methodCall, - payload, - profilingInfo, - } satisfies ExpressionInfo + if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = newInfo.profilingInfo + // Ensure new fields can't be added to `ExpressionInfo` without this code being updated. + const _allFieldsHandled = { + typename: newInfo.typename, + rawTypename: newInfo.rawTypename, + methodCall: newInfo.methodCall, + payload: newInfo.payload, + profilingInfo: newInfo.profilingInfo + } satisfies ExpressionInfo; } /** From a5a27e401dc69f139fa578c77cb2505cbc64ad13 Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Thu, 6 Mar 2025 18:04:39 +0000 Subject: [PATCH 4/6] pnpm run ci:prettier --- .../project-view/graphNodeVisualization.spec.ts | 2 +- .../src/project-view/stores/project/computedValueRegistry.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts b/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts index e6f2032564a9..87dba11251e5 100644 --- a/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts +++ b/app/gui/integration-test/project-view/graphNodeVisualization.spec.ts @@ -3,9 +3,9 @@ import assert from 'assert' import * as actions from './actions' import { computedContent } from './css' import { expect } from './customExpect' +import { mockExpressionUpdate } from './expressionUpdates' import { CONTROL_KEY } from './keyboard' import * as locate from './locate' -import { mockExpressionUpdate } from './expressionUpdates' test('Node can open and load visualization', async ({ page }) => { await actions.goToGraph(page) diff --git a/app/gui/src/project-view/stores/project/computedValueRegistry.ts b/app/gui/src/project-view/stores/project/computedValueRegistry.ts index c918f15969ca..1e26e8137401 100644 --- a/app/gui/src/project-view/stores/project/computedValueRegistry.ts +++ b/app/gui/src/project-view/stores/project/computedValueRegistry.ts @@ -89,8 +89,8 @@ function updateInfo( rawTypename: newInfo.rawTypename, methodCall: newInfo.methodCall, payload: newInfo.payload, - profilingInfo: newInfo.profilingInfo - } satisfies ExpressionInfo; + profilingInfo: newInfo.profilingInfo, + } satisfies ExpressionInfo } /** From c65c1851a0d1ca3289819a3b5c33bc0700847a92 Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Thu, 6 Mar 2025 18:20:50 +0000 Subject: [PATCH 5/6] Lint fix --- app/gui/integration-test/project-view/locate.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/app/gui/integration-test/project-view/locate.ts b/app/gui/integration-test/project-view/locate.ts index df041dafd6b9..193c169c1766 100644 --- a/app/gui/integration-test/project-view/locate.ts +++ b/app/gui/integration-test/project-view/locate.ts @@ -154,6 +154,7 @@ export const geoMapVisualization = visualizationLocator('.GeoMapVisualization') export const imageBase64Visualization = visualizationLocator('.ImageBase64Visualization') export const warningsVisualization = visualizationLocator('.WarningsVisualization') +/** Type label on the visualisation */ export function visualisationNodeType(page: Page) { return page.getByTestId('visualisationNodeType') } From 98b72b2e2e39a95c7650a7494b4fff5acbc6acc8 Mon Sep 17 00:00:00 2001 From: Adam Riley Date: Thu, 6 Mar 2025 18:50:12 +0000 Subject: [PATCH 6/6] lint --- .../GraphEditor/GraphVisualization/VisualizationToolbar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue b/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue index fbfa3b6f9be4..cad966af88d8 100644 --- a/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue +++ b/app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue @@ -106,8 +106,8 @@ useEvent(window, 'pointerup', (e) => interaction.handlePointerEvent(e, 'pointeru