diff --git a/src/components/ConnectivityQuery.vue b/src/components/ConnectivityQuery.vue index bb76fa05..80256077 100644 --- a/src/components/ConnectivityQuery.vue +++ b/src/components/ConnectivityQuery.vue @@ -160,7 +160,9 @@ export default { if (aqlResults.paths.length !== 0) { // some data manipulation to show only start + end nodes const newNetwork: Network = { nodes: [], edges: [] }; - const nodesSet = new Set(); + const endsNodesSet = new Set(); + const middleNodesSet = new Set(); + const middleNodesList: Node[] = []; aqlResults.paths.forEach((path: { edges: Edge[]; vertices: Node[] }, val: number) => { const newPath: Edge = { @@ -170,13 +172,15 @@ export default { for (let i = 0; i < selectedHops.value + 1; i += 1) { if (i === 0) { newPath._from = path.vertices[i]._id; - if (!nodesSet.has(path.vertices[i]._id)) { newNetwork.nodes.push(path.vertices[i]); } - nodesSet.add(path.vertices[i]._id); - } - if (i === (selectedHops.value)) { + if (!endsNodesSet.has(path.vertices[i]._id)) { newNetwork.nodes.push(path.vertices[i]); } + endsNodesSet.add(path.vertices[i]._id); + } else if (i > 0 && i < selectedHops.value) { + if (!middleNodesSet.has(path.vertices[i]._id)) { middleNodesList.push(path.vertices[i]); } + middleNodesSet.add(path.vertices[i]._id); + } else { newPath._to = path.vertices[i]._id; - if (!nodesSet.has(path.vertices[i]._id)) { newNetwork.nodes.push(path.vertices[i]); } - nodesSet.add(path.vertices[i]._id); + if (!endsNodesSet.has(path.vertices[i]._id)) { newNetwork.nodes.push(path.vertices[i]); } + endsNodesSet.add(path.vertices[i]._id); } } @@ -186,6 +190,12 @@ export default { newNetwork.edges.push(newPath); }); + // Update state for use in intermediate node vis + store.commit.setConnectivityMatrixPaths({ nodes: middleNodesList, paths: aqlResults.paths }); + + // Update state for showing intermediate node vis + if (selectedHops.value > 1) store.commit.toggleShowIntNodeVis(true); + // Update state with new network store.dispatch.aggregateNetwork('none'); store.dispatch.updateNetwork({ network: newNetwork }); diff --git a/src/components/IntermediaryNodes.vue b/src/components/IntermediaryNodes.vue new file mode 100644 index 00000000..1824b39e --- /dev/null +++ b/src/components/IntermediaryNodes.vue @@ -0,0 +1,236 @@ + + + + + diff --git a/src/components/LineUp.vue b/src/components/LineUp.vue index 824233b2..dd70284b 100644 --- a/src/components/LineUp.vue +++ b/src/components/LineUp.vue @@ -20,9 +20,13 @@ export default { const lineupWidth = computed(() => { const controlsElement = select('.app-sidebar').node(); const matrixElement = select('#matrix').node(); + const intermediaryElement = select('#intNodeDiv').node(); if (controlsElement !== null && matrixElement !== null) { - const availableSpace = context.root.$vuetify.breakpoint.width - controlsElement.clientWidth - matrixElement.clientWidth - 12; // 12 from the svg container padding + let availableSpace = context.root.$vuetify.breakpoint.width - controlsElement.clientWidth - matrixElement.clientWidth - 12; // 12 from the svg container padding + if (intermediaryElement !== null) { + availableSpace -= intermediaryElement.clientWidth; + } return availableSpace < 330 ? 330 : availableSpace; } diff --git a/src/components/MultiMatrix.vue b/src/components/MultiMatrix.vue index e56ec499..009afce2 100644 --- a/src/components/MultiMatrix.vue +++ b/src/components/MultiMatrix.vue @@ -14,6 +14,7 @@ import { select, selectAll } from 'd3-selection'; import { transition } from 'd3-transition'; import store from '@/store'; import LineUp from '@/components/LineUp.vue'; +import IntermediaryNodes from '@/components/IntermediaryNodes.vue'; import 'science'; import 'reorder.js'; @@ -27,6 +28,7 @@ declare const reorder: any; export default { components: { LineUp, + IntermediaryNodes, }, setup() { @@ -65,6 +67,7 @@ export default { const orderType = ref(undefined); const sortKey = ref(''); const finishedMounting = ref(false); + const showIntNodeVis = computed(() => store.state.showIntNodeVis); const cellSize = computed(() => store.state.cellSize); const selectedNodes = computed(() => store.state.selectedNodes); @@ -875,6 +878,7 @@ export default { return { finishedMounting, + showIntNodeVis, matrixWidth, matrixHeight, }; @@ -895,6 +899,7 @@ export default { :viewbox="`0 0 ${matrixWidth} ${matrixHeight}`" /> + diff --git a/src/store/index.ts b/src/store/index.ts index 318af466..2152f3dd 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -12,6 +12,7 @@ import { } from 'multinet'; import { ArangoAttributes, + ArangoPath, Cell, Edge, LoadError, Network, Node, ProvenanceEventTypes, State, } from '@/types'; @@ -58,6 +59,8 @@ const { showProvenanceVis: false, nodeAttributes: {}, edgeAttributes: {}, + showIntNodeVis: false, + connectivityMatrixPaths: { nodes: [], paths: [] }, } as State, getters: { @@ -248,6 +251,14 @@ const { state.nodeAttributes = payload.nodeAttributes; state.edgeAttributes = payload.edgeAttributes; }, + + toggleShowIntNodeVis(state, showIntNodeVis: boolean) { + state.showIntNodeVis = showIntNodeVis; + }, + + setConnectivityMatrixPaths(state, payload: { nodes: Node[]; paths: ArangoPath[]}) { + state.connectivityMatrixPaths = payload; + }, }, actions: { diff --git a/src/types.ts b/src/types.ts index 7cdad801..d88a9ea5 100644 --- a/src/types.ts +++ b/src/types.ts @@ -36,6 +36,17 @@ export interface Cell { correspondingCell: string; } +export interface ConnectivityCell { + x: number; + y: number; + z: number; + startingNode: string; + endingNode: string; + cellName: string; + nodePosition: number; + paths: number[]; +} + export interface LoadError { message: string; href: string; @@ -45,6 +56,11 @@ export interface ArangoAttributes { [key: string]: unknown[]; } +export interface ArangoPath { + vertices: Node[]; + edges: Edge[]; +} + export interface State { workspaceName: string | null; networkName: string | null; @@ -70,6 +86,8 @@ export interface State { showProvenanceVis: boolean; nodeAttributes: ArangoAttributes; edgeAttributes: ArangoAttributes; + showIntNodeVis: boolean; + connectivityMatrixPaths: {nodes: Node[]; paths: ArangoPath[]}; } export type ProvenanceEventTypes =