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

feat: drilldown arrow navigation #4340

Merged
merged 40 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
861dd41
add arrows
shawnyama Aug 1, 2024
35a58b1
fix secondary outlined buttons
shawnyama Aug 1, 2024
cd3b942
Merge branch 'main' into drilldown-arrows
shawnyama Aug 1, 2024
07a6b4f
prepare ui
shawnyama Aug 1, 2024
1c7861d
Merge branch 'main' into drilldown-arrows
shawnyama Aug 7, 2024
31bfa27
fix tall output dropdown
shawnyama Aug 7, 2024
9b97d64
nav works
shawnyama Aug 7, 2024
3ffe3e9
Merge branch 'main' into drilldown-arrows
shawnyama Aug 7, 2024
4160d50
clean config props passing
shawnyama Aug 7, 2024
bedfbaa
if there is one item nav to that, menu positioning
shawnyama Aug 8, 2024
6627b64
submenu
shawnyama Aug 8, 2024
150af5f
icon map
shawnyama Aug 8, 2024
432710e
setup asset name condition, doesnt work tho
shawnyama Aug 8, 2024
c56e280
Merge branch 'main' into drilldown-arrows
shawnyama Aug 9, 2024
92b99f3
asset name for asset ops and fix outline button
shawnyama Aug 9, 2024
f7cb106
tooltip
shawnyama Aug 9, 2024
da9ab74
keyboard shortcuts
shawnyama Aug 9, 2024
a286a4e
adjust tooltip css and begin keyboard shortcut
shawnyama Aug 12, 2024
08eb04c
mimic button click
shawnyama Aug 12, 2024
ce6e188
renaming and comments
shawnyama Aug 12, 2024
dbe48cf
prevent triggering empty menu with keyboard
shawnyama Aug 12, 2024
fb9fd11
Merge branch 'main' into drilldown-arrows
shawnyama Aug 12, 2024
7afcbeb
rm log
shawnyama Aug 12, 2024
06df6e0
Merge branch 'main' into drilldown-arrows
shawnyama Aug 12, 2024
130b00f
cole said this is deprecated so i delete
shawnyama Aug 12, 2024
b4f93a8
Merge branch 'drilldown-arrows' of https://github.com/DARPA-ASKEM/ter…
shawnyama Aug 12, 2024
66df567
Merge branch 'main' into drilldown-arrows
shawnyama Aug 12, 2024
0a07771
Merge branch 'main' into drilldown-arrows
shawnyama Aug 12, 2024
ffcf96e
clear cache on wf change
shawnyama Aug 13, 2024
16765db
Merge branch 'main' into drilldown-arrows
shawnyama Aug 13, 2024
3c058fe
tombstone logic
shawnyama Aug 13, 2024
9e15a4a
neighbor node test
shawnyama Aug 13, 2024
07aab1d
fix test
shawnyama Aug 13, 2024
e686e00
Merge branch 'main' into drilldown-arrows
shawnyama Aug 13, 2024
b27b910
actually efficient
shawnyama Aug 13, 2024
e20e055
resolve conflicts
shawnyama Aug 13, 2024
70a29f7
use class funcs
shawnyama Aug 13, 2024
4b39f41
Merge branch 'main' into drilldown-arrows
shawnyama Aug 13, 2024
ec81757
naming
shawnyama Aug 13, 2024
1d9af69
Merge branch 'drilldown-arrows' of https://github.com/DARPA-ASKEM/ter…
shawnyama Aug 13, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ function updateOutputPort(node: WorkflowNode<any> | null, workflowOutput: Workfl
}

// Route is mutated then watcher is triggered to open or close the drilldown
function addOperatorToRoute(nodeId: string | null, animation: 'left' | 'right' | 'scale' = 'scale') {
function addOperatorToRoute(
nodeId: string | null,
animation: 'left' | 'right' | 'scale' = 'scale' // drilldownSpawnAnimation is set here, left/right animations are for drilldown navigation
) {
drilldownSpawnAnimation.value = animation;
if (nodeId !== null) {
router.push({ query: { operator: nodeId } });
Expand Down Expand Up @@ -896,6 +899,7 @@ const handleDrilldown = () => {
watch(
() => [props.assetId],
async () => {
workflowService.neighborNodeCache.clear(); // Clear cache that assists drilldown navigation
isRenamingWorkflow.value = false; // Closes rename input if opened in previous workflow
if (wf.value && workflowDirty) {
workflowService.updateWorkflow(wf.value);
Expand Down
17 changes: 13 additions & 4 deletions packages/client/hmi-client/src/services/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,23 @@ export const updateNodeStatus = (wf: Workflow, nodeId: string, status: OperatorS
node.status = status;
};

export const neighborNodeCache = new Map<string, WorkflowNode<any>>();
export const getNeighborNodes = (wf: Workflow, id: string) => {
const findNeighborNode = (neighborId?: string) => {
if (!neighborId) return null;
if (!neighborNodeCache.has(neighborId)) {
const node = wf.nodes.find((n) => n.id === neighborId);
if (!node) return null;
neighborNodeCache.set(neighborId, node);
}
return neighborNodeCache.get(neighborId) ?? null;
};
console.log(neighborNodeCache);
shawnyama marked this conversation as resolved.
Show resolved Hide resolved
const inputEdges = wf.edges.filter((edge) => edge.target === id);
const outputEdges = wf.edges.filter((edge) => edge.source === id);
const upstreamNodes = inputEdges
.map((edge) => wf.nodes.find((n) => n.id === edge.source))
.filter(Boolean) as WorkflowNode<any>[];
const upstreamNodes = inputEdges.map((edge) => findNeighborNode(edge.source)).filter(Boolean) as WorkflowNode<any>[];
const downstreamNodes = outputEdges
.map((edge) => wf.nodes.find((n) => n.id === edge.target))
.map((edge) => findNeighborNode(edge.target))
.filter(Boolean) as WorkflowNode<any>[];
return { upstreamNodes, downstreamNodes };
};
shawnyama marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading