Skip to content

Commit 7094366

Browse files
committed
add resizer in graph overview panel
1 parent 3a1ff4c commit 7094366

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

src/components/OutputPanel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ onMounted(() => {
167167
:nodes="nodes"
168168
:relationships="relationships"
169169
:expandedNodesState="expandedNodesState"
170+
:disableResizer="GlobalVariables.disableGraphOverviewPanelResizer"
170171
@nodeExpanded="handleNodeExpanded"
171172
@nodeUnexpanded="handleNodeUnexpanded"
172173
@nodeDeleted="handleNodeDeleted"

src/components/output/GraphOutput.vue

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ import {
99
ClickInteraction
1010
} from '@neo4j-nvl/interaction-handlers'
1111
import { useQuasar } from 'quasar'
12+
import interact from 'interactjs'
1213
1314
const Neo4jApi = inject('Neo4jApi')
15+
const GlobalVariables = inject('GlobalVariables')
1416
const emit = defineEmits(['nodeExpanded', 'nodeUnexpanded', 'nodeDeleted'])
15-
const props = defineProps(['nodes', 'relationships', 'expandedNodesState'])
17+
const props = defineProps(['nodes', 'relationships', 'expandedNodesState', 'disableResizer'])
1618
1719
const q = useQuasar()
1820
const expandedNodesMap = ref(props.expandedNodesState)
@@ -34,6 +36,7 @@ const nodeRightClickMenu = ref({
3436
node: null,
3537
clicked: false
3638
})
39+
const graphOverviewPanelWidth = ref(`${GlobalVariables.graphOverviewPanelWidth}px`)
3740
3841
const options = {
3942
disableTelemetry: true,
@@ -293,6 +296,25 @@ const init = (nodes, relationships) => {
293296
294297
onMounted(async () => {
295298
init(props.nodes, props.relationships)
299+
if (!props.disableResizer) {
300+
interact(overview.value)
301+
.origin('self')
302+
.resizable({
303+
edges: { top: false, left: true, bottom: false, right: false },
304+
inertia: true,
305+
listeners: {
306+
move: (event) => {
307+
overview.value.style.width = `${event.rect.width}px`
308+
}
309+
},
310+
modifiers: [
311+
interact.modifiers.restrictSize({
312+
min: { width: GlobalVariables.graphOverviewPanelWidth },
313+
max: { width: 800 }
314+
})
315+
]
316+
})
317+
}
296318
})
297319
298320
onUnmounted(() => {
@@ -343,7 +365,8 @@ onUnmounted(() => {
343365
</q-list>
344366
</q-menu>
345367
</div>
346-
<q-card class="overview" ref="overview">
368+
<div class="overview" ref="overview">
369+
<q-card class="overview-card">
347370
<q-bar class="fixed-top overview-bar">
348371
<div class="row justify-between" style="width: 100%">
349372
<q-btn icon="zoom_in" flat square color="white" @click="zoomIn" />
@@ -416,6 +439,7 @@ onUnmounted(() => {
416439
</q-markup-table>
417440
</q-card-section>
418441
</q-card>
442+
</div>
419443
</div>
420444
</template>
421445
@@ -431,13 +455,17 @@ onUnmounted(() => {
431455
position: absolute;
432456
top: 0px;
433457
right: 0px;
434-
width: 250px;
458+
width: v-bind('graphOverviewPanelWidth');
459+
height: 100%;
460+
overflow-y: auto;
461+
}
462+
.overview-card {
435463
height: 100%;
464+
overflow-y: auto;
436465
border-top-left-radius: 4px;
437466
border-top-right-radius: 0px;
438467
border-bottom-left-radius: 0px;
439468
border-bottom-right-radius: 0px;
440-
overflow-y: auto;
441469
}
442470
.overview-property-key {
443471
max-width: 70px;

src/plugins/GlobalVariables.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
const GlobalVariables = {
22
install: (app) => {
33
const GlobalVariables = {
4-
outputPanelHeight: 580
4+
outputPanelHeight: 580,
5+
graphOverviewPanelWidth: 250,
6+
disableOutputPanelResizer: false,
7+
disableGraphOverviewPanelResizer: false,
58
}
69
app.provide('GlobalVariables', GlobalVariables)
710
}

src/views/BrowserView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ watch(
7272
:query="query.query"
7373
:disable-input="false"
7474
:disable-top-bar="false"
75-
:disable-resizer="false"
75+
:disable-resizer="GlobalVariables.disableOutputPanelResizer"
7676
@clear="clearQuery(query.uuid)"
7777
@share="shareQuery(query)"
7878
@update="updateQuery($event, query.uuid)"

0 commit comments

Comments
 (0)