1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 10:38:54 +08:00

improve events

This commit is contained in:
lana-k
2022-07-20 22:47:40 +02:00
parent 84e66b8167
commit e71e6700c1
14 changed files with 47 additions and 46 deletions

View File

@@ -60,7 +60,7 @@ import TextField from '@/components/TextField'
import CloseIcon from '@/components/svg/close'
import storedInquiries from '@/lib/storedInquiries'
import AppDiagnosticInfo from './AppDiagnosticInfo'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'MainMenu',
@@ -115,7 +115,7 @@ export default {
}
})
send('inquiry.create', undefined, { auto: false })
events.send('inquiry.create', null, { auto: false })
},
cancelSave () {
this.$modal.hide('save')
@@ -169,7 +169,7 @@ export default {
// Signal about saving
this.$root.$emit('inquirySaved')
send('inquiry.save')
events.send('inquiry.save')
},
_keyListener (e) {
if (this.$route.path === '/workspace') {

View File

@@ -33,7 +33,7 @@
<script>
import fIo from '@/lib/utils/fileIo'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
import TableDescription from './TableDescription'
import TextField from '@/components/TextField'
import TreeChevron from '@/components/svg/treeChevron'
@@ -88,7 +88,7 @@ export default {
await csvImport.previewCsv()
csvImport.open()
send('database.import', this.file.size, {
events.send('database.import', this.file.size, {
from: 'csv',
new_db: false
})

View File

@@ -31,7 +31,7 @@ import PlotlyEditor from 'react-chart-editor'
import chartHelper from '@/lib/chartHelper'
import dereference from 'react-chart-editor/lib/lib/dereference'
import fIo from '@/lib/utils/fileIo'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'Chart',
@@ -66,11 +66,10 @@ export default {
notifyOnLogging: 1
})
this.$watch(
() => JSON.stringify(
this.state.data.map(trace => `${trace.type}-${trace.mode}`)
),
() => this.state.data.map(trace => `${trace.type}-${trace.mode}`)
.join(','),
(value) => {
send('viz_plotly.render', undefined, {
events.send('viz_plotly.render', null, {
type: value,
pivot: !!this.forPivot
})

View File

@@ -23,7 +23,7 @@ import pivotHelper from './pivotHelper'
import Chart from '@/views/Main/Workspace/Tabs/Tab/DataView/Chart'
import chartHelper from '@/lib/chartHelper'
import Vue from 'vue'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
const ChartClass = Vue.extend(Chart)
export default {
@@ -96,7 +96,7 @@ export default {
'update:importToSvgEnabled',
this.viewStandartChart || this.viewCustomChart
)
send('viz_pivot.render', undefined, {
events.send('viz_pivot.render', null, {
type: this.pivotOptions.rendererName
})
}

View File

@@ -95,7 +95,7 @@ import ClipboardIcon from '@/components/svg/clipboard'
import cIo from '@/lib/utils/clipboardIo'
import loadingDialog from '@/components/LoadingDialog'
import time from '@/lib/utils/time'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'DataView',
@@ -207,11 +207,11 @@ export default {
eventLabels.pivot = this.plotlyInPivot
}
send(
events.send(
this.mode === 'chart' || this.plotlyInPivot
? 'viz_plotly.export'
: 'viz_pivot.export',
undefined,
null,
eventLabels
)
}

View File

@@ -72,7 +72,7 @@ import fIo from '@/lib/utils/fileIo'
import cIo from '@/lib/utils/clipboardIo'
import time from '@/lib/utils/time'
import loadingDialog from '@/components/LoadingDialog'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'RunResult',
@@ -119,7 +119,7 @@ export default {
exportToCsv () {
if (this.result && this.result.values) {
send('resultset.export',
events.send('resultset.export',
this.result.values[this.result.columns[0]].length,
{ to: 'csv' }
)
@@ -130,7 +130,7 @@ export default {
async prepareCopy () {
if (this.result && this.result.values) {
send('resultset.export',
events.send('resultset.export',
this.result.values[this.result.columns[0]].length,
{ to: 'clipboard' }
)

View File

@@ -56,7 +56,7 @@ import DataView from './DataView'
import RunResult from './RunResult'
import time from '@/lib/utils/time'
import Teleport from 'vue2-teleport'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'Tab',
@@ -110,7 +110,7 @@ export default {
this.layout[from] = this.layout[to]
this.layout[to] = fromPosition
send('inquiry.panel', undefined, { panel: to })
events.send('inquiry.panel', null, { panel: to })
},
onDataViewUpdate () {
this.$store.commit('updateTab', { index: this.tabIndex, isSaved: false })
@@ -126,19 +126,19 @@ export default {
this.time = time.getPeriod(start, new Date())
if (this.result && this.result.values) {
send('resultset.create',
events.send('resultset.create',
this.result.values[this.result.columns[0]].length
)
}
send('query.run', parseFloat(this.time), { status: 'success' })
events.send('query.run', parseFloat(this.time), { status: 'success' })
} catch (err) {
this.error = {
type: 'error',
message: err
}
send('query.run', 0, { status: 'error' })
events.send('query.run', 0, { status: 'error' })
}
state.db.refreshSchema()
this.isGettingResults = false

View File

@@ -19,7 +19,7 @@
import Splitpanes from '@/components/Splitpanes'
import Schema from './Schema'
import Tabs from './Tabs'
import { send } from '@/lib/utils/events'
import events from '@/lib/utils/events'
export default {
name: 'Workspace',
@@ -51,7 +51,7 @@ export default {
const tabId = await this.$store.dispatch('addTab', { query: stmt })
this.$store.commit('setCurrentTabId', tabId)
send('inquiry.create', undefined, { auto: true })
events.send('inquiry.create', null, { auto: true })
}
}
}