mirror of
https://github.com/lana-k/sqliteviz.git
synced 2026-11-04 08:49:25 +08:00
#139 view details of selected points
This commit is contained in:
@@ -33,9 +33,9 @@
|
||||
</template>
|
||||
<template v-if="showValueViewer" #right-pane>
|
||||
<value-viewer
|
||||
:empty="!selectedItem"
|
||||
:empty="!selectedItems || selectedItems.length === 0"
|
||||
emptyMessage="No points selected to view"
|
||||
:value="JSON.stringify(selectedItem)"
|
||||
:value="JSON.stringify(selectedItems)"
|
||||
defaultFormat="json"
|
||||
/>
|
||||
</template>
|
||||
@@ -95,7 +95,7 @@ export default {
|
||||
},
|
||||
resizeObserver: null,
|
||||
useResizeHandler: this.$store.state.isWorkspaceVisible,
|
||||
selectedItem: null
|
||||
selectedItems: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -105,6 +105,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
dataSources() {
|
||||
chartHelper.clearSelection(this.state.data, this.state.layout)
|
||||
// we need to update state.data in order to update the graph
|
||||
// https://github.com/plotly/react-chart-editor/issues/948
|
||||
if (this.dataSources) {
|
||||
@@ -151,11 +152,14 @@ export default {
|
||||
this.$refs.plotlyEditor?.$el?.querySelector('.js-plotly-plot')
|
||||
plotlyDiv?.on('plotly_selected', selectionEvent => {
|
||||
if (selectionEvent) {
|
||||
this.selectedItem = 1
|
||||
this.selectedItems = chartHelper.getRowsByIndexFromDataSources(
|
||||
this.dataSources,
|
||||
selectionEvent.points.map(point => point.pointIndex)
|
||||
)
|
||||
}
|
||||
})
|
||||
plotlyDiv?.on('plotly_deselect', () => {
|
||||
this.selectedItem = null
|
||||
this.selectedItems = null
|
||||
})
|
||||
},
|
||||
activated() {
|
||||
@@ -179,10 +183,8 @@ export default {
|
||||
// TODO: check changes and enable Save button if needed
|
||||
},
|
||||
update(data, layout, frames) {
|
||||
if (layout?.selections?.length > 0) {
|
||||
layout.selections = []
|
||||
data.forEach(dataItem => delete dataItem.selectedpoints)
|
||||
}
|
||||
chartHelper.clearSelection(data, layout)
|
||||
|
||||
this.state = { data, layout, frames }
|
||||
this.$emit('update')
|
||||
},
|
||||
|
||||
@@ -58,7 +58,7 @@
|
||||
</icon-button>
|
||||
|
||||
<icon-button
|
||||
v-if="mode === 'graph'"
|
||||
v-if="mode !== 'pivot'"
|
||||
ref="viewNodeOrEdgeBtn"
|
||||
tooltip="View details"
|
||||
tooltipPosition="top-left"
|
||||
|
||||
@@ -125,6 +125,13 @@ export default {
|
||||
},
|
||||
|
||||
async checkFile(file) {
|
||||
if (!file) {
|
||||
alert(
|
||||
'You should drop a file. ' +
|
||||
'It can be an SQLite database, CSV file, JSON or NDJSON file.'
|
||||
)
|
||||
return
|
||||
}
|
||||
this.state = 'dropping'
|
||||
this.newDb = database.getNewDatabase()
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ export default {
|
||||
events.send(eventName)
|
||||
},
|
||||
_keyListener(e) {
|
||||
if (this.$route.path === '/workspace') {
|
||||
if (this.$route.path === '/workspace' && this.currentInquiryTab) {
|
||||
// Run query Ctrl+R or Ctrl+Enter
|
||||
if ((e.key === 'r' || e.key === 'Enter') && (e.ctrlKey || e.metaKey)) {
|
||||
e.preventDefault()
|
||||
|
||||
Reference in New Issue
Block a user