-
Notifications
You must be signed in to change notification settings - Fork 326
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
Set up server side row model for table visualization #12272
Open
marthasharkey
wants to merge
46
commits into
develop
Choose a base branch
from
wip/mk/ssrm
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
ab02b00
set up ssrm for table
marthasharkey 2ccb883
update tests
marthasharkey ca95f05
format
marthasharkey 3771f09
wip to pass sort
marthasharkey 5f4ef89
Merge branch 'develop' into wip/mk/ssrm
marthasharkey 18a282c
WIP sort
marthasharkey 102664d
lint issues
marthasharkey faa4b74
Merge branch 'develop' into wip/mk/ssrm
marthasharkey cb55ff5
sort working
marthasharkey 70d7b29
remove logs
marthasharkey 11c6586
add multisort
marthasharkey b711695
Merge branch 'develop' into wip/mk/ssrm
marthasharkey b5a9353
add distinct options
marthasharkey dc5734b
Merge branch 'develop' into wip/mk/ssrm
marthasharkey ec29c6a
single filter working
marthasharkey 09b4f60
filtering working for single numeric column
marthasharkey e634537
send value as string
marthasharkey d774643
Merge branch 'develop' into wip/mk/ssrm
marthasharkey ea2bb55
filtering wip
marthasharkey 074b04b
Merge branch 'develop' into wip/mk/ssrm
marthasharkey f1b33a9
date filtering working
marthasharkey 514fa00
Merge branch 'develop' into wip/mk/ssrm
marthasharkey d3b9abe
update for text filter
marthasharkey ce14bb8
send integer and char type
marthasharkey 437d9fd
individual filtering working
marthasharkey 39f1a55
multi filter working
marthasharkey 9cb2992
fix types
marthasharkey d6604d0
Merge branch 'develop' into wip/mk/ssrm
marthasharkey a443b0b
send in format function
marthasharkey c7f2e8b
add types to format functions
marthasharkey 036ac77
move functions around
marthasharkey b24a8ff
Merge branch 'develop' into wip/mk/ssrm
marthasharkey 843b8a6
Merge branch 'develop' into wip/mk/ssrm
marthasharkey e63ab0a
basic index row
marthasharkey 39fc8ea
Merge branch 'develop' into wip/mk/ssrm
marthasharkey 2edf87d
use temp name for index column
marthasharkey 0aa1690
for db use non ssrm
marthasharkey 5648519
fix for non ssrm
marthasharkey 803ea18
add correct row count for non ssrm
marthasharkey 2894b28
re add filter/sort check
marthasharkey eb0ea19
update test files
marthasharkey 6294b78
Merge branch 'develop' into wip/mk/ssrm
marthasharkey 16bff25
use ssrm for all tables no matter what size
marthasharkey b9334b2
update metod comments
marthasharkey 20ebd52
rename
marthasharkey b18546e
remove unused props
marthasharkey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import LoadingErrorVisualization from '@/components/visualizations/LoadingErrorVisualization.vue' | ||
import LoadingVisualization from '@/components/visualizations/LoadingVisualization.vue' | ||
import type { ToolbarItem } from '@/components/visualizations/toolbar' | ||
import { useGraphStore } from '@/stores/graph' | ||
import { NodeId } from '@/stores/graph/graphDatabase' | ||
import { useProjectStore } from '@/stores/project' | ||
import type { NodeVisualizationConfiguration } from '@/stores/project/executionContext' | ||
import { | ||
|
@@ -56,6 +58,7 @@ export function useVisualizationData({ | |
|
||
const projectStore = useProjectStore() | ||
const visualizationStore = useVisualizationStore() | ||
const graph = useGraphStore() | ||
|
||
// Flag used to prevent rendering the visualization with a stale preprocessor while the new preprocessor is being | ||
// prepared asynchronously. | ||
|
@@ -92,6 +95,50 @@ export function useVisualizationData({ | |
}, | ||
) | ||
|
||
const executeExpression = async ( | ||
visulizationModule: string, | ||
expressionString: string, | ||
formatFunction: | ||
| ((arg: any, tempModule: Ast.MutableModule) => Ast.Owned<Ast.MutableExpression>) | ||
| null, | ||
...positionalArgumentsExpressions: any[] | ||
) => { | ||
const dataSourceValue = toValue(dataSource) | ||
if (dataSourceValue?.type !== 'node') return | ||
const graphDb = graph.db | ||
const nodeFirstOurputPort = graphDb.getNodeFirstOutputPort(dataSourceValue.nodeId as NodeId) | ||
const identifier = graphDb.getOutputPortIdentifier(nodeFirstOurputPort) | ||
if (identifier === undefined) return | ||
const contextId = | ||
dataSourceValue.nodeId && | ||
graphDb.nodeIdToNode.get(dataSourceValue.nodeId as NodeId)?.outerAst.externalId | ||
if (contextId === undefined) return | ||
try { | ||
const tempModule = Ast.MutableModule.Transient() | ||
const preprocessorModule = Ast.parseExpression(visulizationModule, tempModule)! | ||
const preprocessorQn = Ast.PropertyAccess.new( | ||
tempModule, | ||
preprocessorModule, | ||
Ast.identifier(expressionString)!, | ||
) | ||
|
||
const preprocessorInvocation = Ast.App.PositionalSequence(preprocessorQn, [ | ||
Ast.Wildcard.new(tempModule), | ||
...positionalArgumentsExpressions.map((arg) => { | ||
const parsedArg = | ||
formatFunction ? formatFunction(arg, tempModule) : Ast.parseExpression(arg, tempModule)! | ||
return Ast.Group.new(tempModule, parsedArg) | ||
}), | ||
]) | ||
const rhs = Ast.parseExpression(identifier, tempModule)! | ||
const expression = Ast.OprApp.new(tempModule, preprocessorInvocation, '<|', rhs) | ||
return projectStore.executeExpression(contextId, expression.code()) | ||
} catch (e) { | ||
console.error(e) | ||
throw e | ||
} | ||
} | ||
|
||
const currentType = computed(() => { | ||
const selectedTypeValue = toValue(selectedVis) | ||
if (selectedTypeValue) return selectedTypeValue | ||
|
@@ -260,5 +307,19 @@ export function useVisualizationData({ | |
(toolbarDefinition.value = definition), | ||
visualizationDefinedToolbar: computed(() => toValue(toolbarDefinition.value)), | ||
toolbarOverlay, | ||
executeExpression: ( | ||
visulizationModule: string, | ||
expressionString: string, | ||
formatFunction: | ||
| ((arg: any, tempModule: Ast.MutableModule) => Ast.Owned<Ast.MutableExpression>) | ||
| null, | ||
...positionalArgumentsExpressions: string[] | ||
) => | ||
executeExpression( | ||
visulizationModule, | ||
expressionString, | ||
formatFunction, | ||
...positionalArgumentsExpressions, | ||
), | ||
Comment on lines
+310
to
+323
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary lambda. |
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this function is part of the API for visualizations, its signature should be as simple as possible, and shouldn't contain any
any
types. I think it could be generalized to:executeExpression(expression: (nodeOutputIdentifier: string) => string): Promise<Result<unknown> | null>
. The logic for constructing the expression (L116-L140) can be left to the caller.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I did think it had started to get too specific for this usecase, thank you