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

Empty state for my queries #8

This commit is contained in:
lana-k
2020-11-12 18:11:36 +01:00
parent f65953a2e1
commit 19f3e8b74a
2 changed files with 29 additions and 54 deletions

View File

@@ -1,47 +1 @@
{
"query": "select * from invoices",
"chart": {
"data": [
{
"type": "scatter",
"mode": "lines",
"x": null,
"xsrc": "InvoiceId",
"meta": {
"columnNames": {
"x": "InvoiceId",
"y": "Total"
}
},
"y": null,
"ysrc": "Total"
}
],
"layout": {
"xaxis": {
"range": [
1,
412
],
"autorange": true,
"type": "linear"
},
"yaxis": {
"range": [
-0.39166666666666683,
27.241666666666667
],
"autorange": true,
"type": "linear"
},
"autosize": true,
"mapbox": {
"style": "open-street-map"
}
},
"frames": []
},
"name": "Invoices",
"id": "ieZfcITwDUTADwOmQlYyL",
"createdAt": "2020-11-03T14:17:49.524Z"
}
[]

View File

@@ -1,6 +1,12 @@
<template>
<div>
<div id="my-queries-content">
<div id="start-guide" v-if="showedQueries.length === 0">
You don't have saved queries so far.
<span class="link" @click="create">Create</span>
the one from scratch or
<label for="import-file" class="link">import</label> from a file.
</div>
<div id="my-queries-content" v-show="showedQueries.length > 0">
<div id="my-queries-toolbar">
<div id="toolbar-buttons">
<input
@@ -244,7 +250,12 @@ export default {
},
methods: {
calcNameWidth () {
this.$refs['name-th'].style = `width: ${this.$refs['name-td'][0].offsetWidth}px`
const nameWidth = this.$refs['name-td'] ? this.$refs['name-td'][0].offsetWidth : 0
this.$refs['name-th'].style = `width: ${nameWidth}px`
},
create () {
this.$root.$emit('createNewQuery')
this.$router.push('/editor')
},
openQuery (index) {
const tab = JSON.parse(JSON.stringify(this.showedQueries[index]))
@@ -428,6 +439,16 @@ export default {
</script>
<style scoped>
#start-guide {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: var(--color-text-base);
font-size: 14px;
text-align: center;
}
#my-queries-content {
padding: 52px;
}