mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
#115 add split in result set
This commit is contained in:
@@ -1,31 +1,21 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="run-result-panel" ref="runResultPanel">
|
<div class="run-result-panel">
|
||||||
<div class="run-result-panel-content">
|
<component
|
||||||
<div
|
:is="viewValuePanelVisible ? 'splitpanes':'div'"
|
||||||
v-show="result === null && !isGettingResults && !error"
|
:before="{ size: 50, max: 100 }"
|
||||||
class="table-preview result-before"
|
:after="{ size: 50, max: 100 }"
|
||||||
>
|
:default="{ before: 50, after: 50 }"
|
||||||
Run your query and get results here
|
class="run-result-panel-content"
|
||||||
</div>
|
>
|
||||||
<div v-if="isGettingResults" class="table-preview result-in-progress">
|
<template #left-pane>
|
||||||
<loading-indicator :size="30"/>
|
<div :id="'run-result-left-pane-'+tab.id" class="result-set-container"/>
|
||||||
Fetching results...
|
</template>
|
||||||
</div>
|
<div :id="'run-result-result-set-'+tab.id" class="result-set-container"/>
|
||||||
<div
|
<template #right-pane v-if="viewValuePanelVisible">
|
||||||
v-show="result === undefined && !isGettingResults && !error"
|
<div>hello</div>
|
||||||
class="table-preview result-empty"
|
</template>
|
||||||
>
|
</component>
|
||||||
No rows retrieved according to your query
|
|
||||||
</div>
|
|
||||||
<logs v-if="error" :messages="[error]"/>
|
|
||||||
<sql-table
|
|
||||||
v-if="result"
|
|
||||||
:data-set="result"
|
|
||||||
:time="time"
|
|
||||||
:pageSize="pageSize"
|
|
||||||
class="straight"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<side-tool-bar @switchTo="$emit('switchTo', $event)" panel="table">
|
<side-tool-bar @switchTo="$emit('switchTo', $event)" panel="table">
|
||||||
<icon-button
|
<icon-button
|
||||||
:disabled="!result"
|
:disabled="!result"
|
||||||
@@ -44,6 +34,15 @@
|
|||||||
>
|
>
|
||||||
<clipboard-icon/>
|
<clipboard-icon/>
|
||||||
</icon-button>
|
</icon-button>
|
||||||
|
|
||||||
|
<icon-button
|
||||||
|
:disabled="!result"
|
||||||
|
tooltip="View value"
|
||||||
|
tooltip-position="top-left"
|
||||||
|
@click="toggleViewValuePanel"
|
||||||
|
>
|
||||||
|
<clipboard-icon/>
|
||||||
|
</icon-button>
|
||||||
</side-tool-bar>
|
</side-tool-bar>
|
||||||
|
|
||||||
<loading-dialog
|
<loading-dialog
|
||||||
@@ -56,6 +55,35 @@
|
|||||||
@action="copyToClipboard"
|
@action="copyToClipboard"
|
||||||
@cancel="cancelCopy"
|
@cancel="cancelCopy"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<teleport :to="resultSetTeleportTarget">
|
||||||
|
<div ref="runResultPanel">
|
||||||
|
<div
|
||||||
|
v-show="result === null && !isGettingResults && !error"
|
||||||
|
class="table-preview result-before"
|
||||||
|
>
|
||||||
|
Run your query and get results here
|
||||||
|
</div>
|
||||||
|
<div v-if="isGettingResults" class="table-preview result-in-progress">
|
||||||
|
<loading-indicator :size="30"/>
|
||||||
|
Fetching results...
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-show="result === undefined && !isGettingResults && !error"
|
||||||
|
class="table-preview result-empty"
|
||||||
|
>
|
||||||
|
No rows retrieved according to your query
|
||||||
|
</div>
|
||||||
|
<logs v-if="error" :messages="[error]"/>
|
||||||
|
<sql-table
|
||||||
|
v-if="result"
|
||||||
|
:data-set="result"
|
||||||
|
:time="time"
|
||||||
|
:pageSize="pageSize"
|
||||||
|
class="straight"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</teleport>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -63,7 +91,8 @@
|
|||||||
import Logs from '@/components/Logs'
|
import Logs from '@/components/Logs'
|
||||||
import SqlTable from '@/components/SqlTable'
|
import SqlTable from '@/components/SqlTable'
|
||||||
import LoadingIndicator from '@/components/LoadingIndicator'
|
import LoadingIndicator from '@/components/LoadingIndicator'
|
||||||
import SideToolBar from './SideToolBar'
|
import SideToolBar from '../SideToolBar'
|
||||||
|
import Splitpanes from '@/components/Splitpanes'
|
||||||
import ExportToCsvIcon from '@/components/svg/exportToCsv'
|
import ExportToCsvIcon from '@/components/svg/exportToCsv'
|
||||||
import ClipboardIcon from '@/components/svg/clipboard'
|
import ClipboardIcon from '@/components/svg/clipboard'
|
||||||
import IconButton from '@/components/IconButton'
|
import IconButton from '@/components/IconButton'
|
||||||
@@ -73,16 +102,24 @@ import cIo from '@/lib/utils/clipboardIo'
|
|||||||
import time from '@/lib/utils/time'
|
import time from '@/lib/utils/time'
|
||||||
import loadingDialog from '@/components/LoadingDialog'
|
import loadingDialog from '@/components/LoadingDialog'
|
||||||
import events from '@/lib/utils/events'
|
import events from '@/lib/utils/events'
|
||||||
|
import Teleport from 'vue2-teleport'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'RunResult',
|
name: 'RunResult',
|
||||||
props: ['result', 'isGettingResults', 'error', 'time'],
|
props: {
|
||||||
|
tab: Object,
|
||||||
|
result: Object,
|
||||||
|
isGettingResults: Boolean,
|
||||||
|
error: Object,
|
||||||
|
time: [String, Number]
|
||||||
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
resizeObserver: null,
|
resizeObserver: null,
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
preparingCopy: false,
|
preparingCopy: false,
|
||||||
dataToCopy: null
|
dataToCopy: null,
|
||||||
|
viewValuePanelVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@@ -93,7 +130,19 @@ export default {
|
|||||||
ExportToCsvIcon,
|
ExportToCsvIcon,
|
||||||
IconButton,
|
IconButton,
|
||||||
ClipboardIcon,
|
ClipboardIcon,
|
||||||
loadingDialog
|
loadingDialog,
|
||||||
|
Splitpanes,
|
||||||
|
Teleport
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
resultSetTeleportTarget () {
|
||||||
|
const base = `#${this.viewValuePanelVisible
|
||||||
|
? 'run-result-left-pane'
|
||||||
|
: 'run-result-result-set'
|
||||||
|
}`
|
||||||
|
const tabIdPostfix = `-${this.tab.id}`
|
||||||
|
return base + tabIdPostfix
|
||||||
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.resizeObserver = new ResizeObserver(this.handleResize)
|
this.resizeObserver = new ResizeObserver(this.handleResize)
|
||||||
@@ -167,6 +216,10 @@ export default {
|
|||||||
cancelCopy () {
|
cancelCopy () {
|
||||||
this.dataToCopy = null
|
this.dataToCopy = null
|
||||||
this.$modal.hide('prepareCSVCopy')
|
this.$modal.hide('prepareCSVCopy')
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleViewValuePanel () {
|
||||||
|
this.viewValuePanelVisible = !this.viewValuePanelVisible
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -180,10 +233,15 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.run-result-panel-content {
|
.run-result-panel-content {
|
||||||
position: relative;
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 0;
|
width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.result-set-container {
|
||||||
|
position: relative;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
<teleport :to="`#${tab.layout.table}-${tab.id}`">
|
<teleport :to="`#${tab.layout.table}-${tab.id}`">
|
||||||
<run-result
|
<run-result
|
||||||
|
:tab="tab"
|
||||||
:result="tab.result"
|
:result="tab.result"
|
||||||
:is-getting-results="tab.isGettingResults"
|
:is-getting-results="tab.isGettingResults"
|
||||||
:error="tab.error"
|
:error="tab.error"
|
||||||
|
|||||||
Reference in New Issue
Block a user