Compare commits
392 Commits
build
...
fff6ae4ec8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fff6ae4ec8 | ||
|
|
4c5148c7e0 | ||
|
|
f1c1f7bdf3 | ||
|
|
9a9d51fc72 | ||
|
|
7a6703648d | ||
|
|
053a7a4614 | ||
|
|
22120fcff5 | ||
|
|
c35eaf2c58 | ||
|
|
3e2809655c | ||
|
|
783613f55f | ||
|
|
001f400142 | ||
|
|
932a8b20a1 | ||
|
|
140eda15c3 | ||
|
|
1bdc528dff | ||
|
|
edcf104b1a | ||
|
|
0a18dca5bd | ||
|
|
d249e0ac02 | ||
|
|
5c53d24ef7 | ||
|
|
7660689c27 | ||
|
|
092a77a544 | ||
|
|
a268941f01 | ||
|
|
17514249e7 | ||
|
|
f574ead7ea | ||
|
|
9de01dbe2e | ||
|
|
2397ea6fb3 | ||
|
|
27bb23ac3d | ||
|
|
0698522fa5 | ||
|
|
73849ee820 | ||
|
|
7dde645fbc | ||
|
|
b273d7677d | ||
|
|
f9561b8678 | ||
|
|
310a939109 | ||
|
|
bb9ba08902 | ||
|
|
c7c727ff78 | ||
|
|
8669a6a9e5 | ||
|
|
c1cc5bb95e | ||
|
|
9c55e76a41 | ||
|
|
70a9edf57e | ||
|
|
b2c2344951 | ||
|
|
cbec91e78a | ||
|
|
816b0e6218 | ||
|
|
4ed93bbea7 | ||
|
|
3e3a70430f | ||
|
|
bce3854792 | ||
|
|
307cac06e6 | ||
|
|
c4b0bdc870 | ||
|
|
69e0b2129b | ||
|
|
4ebb3715d6 | ||
|
|
858e32c9fd | ||
|
|
42cce95ed0 | ||
|
|
61ffcc82d6 | ||
|
|
4716bcf258 | ||
|
|
23d2421584 | ||
|
|
4730afc68a | ||
|
|
6b902d5f00 | ||
|
|
a484c1e022 | ||
|
|
1ed5bf2fae | ||
|
|
da8dc71f23 | ||
|
|
ebac3d8f6c | ||
|
|
0336168bdc | ||
|
|
e38f482933 | ||
|
|
bcd98fe1ad | ||
|
|
ec3ec6f57a | ||
|
|
ae9e2bc03c | ||
|
|
fe11d446f3 | ||
|
|
e6bef139f1 | ||
|
|
d7e0e52da5 | ||
|
|
09cec13a9c | ||
|
|
0cae368350 | ||
|
|
88c62a1dfb | ||
|
|
ead861b610 | ||
|
|
949e6b626e | ||
|
|
6dc81f7be6 | ||
|
|
bb39dcbc2f | ||
|
|
131efb55df | ||
|
|
b33974c26c | ||
|
|
e9c97beb5a | ||
|
|
cabc4f8acd | ||
|
|
679a785d70 | ||
|
|
a91add40cc | ||
|
|
53b2d8372f | ||
|
|
f3e8448851 | ||
|
|
4213e9df5c | ||
|
|
9f32323a80 | ||
|
|
2ed5160f65 | ||
|
|
fe8ab3f3e8 | ||
|
|
848112979b | ||
|
|
2830df2adc | ||
|
|
5017b55944 | ||
|
|
8d0bc6affe | ||
|
|
d07506266c | ||
|
|
cea1d40797 | ||
|
|
0f2dc9f11e | ||
|
|
23250259eb | ||
|
|
fb930028de | ||
|
|
1ff4adf95c | ||
|
|
78cdb3809c | ||
|
|
3a6628cab9 | ||
|
|
418809d27d | ||
|
|
f9edeafd40 | ||
|
|
a37ed93306 | ||
|
|
cf4b83f7d4 | ||
|
|
2abd42c9c3 | ||
|
|
1251c542cb | ||
|
|
ac89259924 | ||
|
|
179ff8b1e1 | ||
|
|
99a10225a3 | ||
|
|
c96deb5766 | ||
|
|
700970e1cc | ||
|
|
e2be61e2cf | ||
|
|
9c2c8f3692 | ||
|
|
414a116f94 | ||
|
|
3e503f85a9 | ||
|
|
88257bfcf6 | ||
|
|
bdcc494138 | ||
|
|
d750541c80 | ||
|
|
75f743ff9e | ||
|
|
8a9f4b3c0a | ||
|
|
77468d34ae | ||
|
|
a0577ec0ce | ||
|
|
e7d1398546 | ||
|
|
aa52048d51 | ||
|
|
33913f8f5c | ||
|
|
51eb7a543c | ||
|
|
a3fb38b23c | ||
|
|
3bb40b4eb7 | ||
|
|
6864bf84f8 | ||
|
|
9f1b3823f6 | ||
|
|
7574f529c3 | ||
|
|
653f8eff7b | ||
|
|
9b3dda6cff | ||
|
|
d94604ebfb | ||
|
|
16868ef430 | ||
|
|
b162c7043e | ||
|
|
8e856063b8 | ||
|
|
8684b4cef9 | ||
|
|
bcaebd4840 | ||
|
|
4619461af8 | ||
|
|
9fff1d699a | ||
|
|
5ab19c3fae | ||
|
|
cc483f4720 | ||
|
|
a07f2d3d99 | ||
|
|
b9844b8696 | ||
|
|
464bff3db8 | ||
|
|
00e434e142 | ||
|
|
5d6280abec | ||
|
|
7a39e905b9 | ||
|
|
297ea2c18a | ||
|
|
1f2327a724 | ||
|
|
6d512422cf | ||
|
|
8ce9a01372 | ||
|
|
acd56a85cb | ||
|
|
a45e218e3f | ||
|
|
a2bc495259 | ||
|
|
7f4b167dc2 | ||
|
|
5ded99e89f | ||
|
|
a991b02a20 | ||
|
|
9b6aa3d6c7 | ||
|
|
92022f9083 | ||
|
|
15636fed5f | ||
|
|
9ed53e0d25 | ||
|
|
35baaf2722 | ||
|
|
453098b410 | ||
|
|
a469de3674 | ||
|
|
24411ac18f | ||
|
|
a7ef152140 | ||
|
|
97c0c6191b | ||
|
|
9a91dd19bf | ||
|
|
472794e203 | ||
|
|
58d4a7bacd | ||
|
|
d0c624a3cc | ||
|
|
9e29a12ebb | ||
|
|
fdbac941d5 | ||
|
|
628e9cee62 | ||
|
|
803622f18f | ||
|
|
edd45b317a | ||
|
|
6ce5d2b201 | ||
|
|
5c9a5560b7 | ||
|
|
13a8b33815 | ||
|
|
5ba371e339 | ||
|
|
5db8376f95 | ||
|
|
be56079e4e | ||
|
|
a7c8c29624 | ||
|
|
9ce1c27cf5 | ||
|
|
b2d21cc859 | ||
|
|
1945467dc7 | ||
|
|
73c0936927 | ||
|
|
8867092601 | ||
|
|
c7039e144a | ||
|
|
b30eeb6788 | ||
|
|
c2864b4308 | ||
|
|
ba75685a23 | ||
|
|
9314e27d0e | ||
|
|
d4d68bb682 | ||
|
|
05b642bc86 | ||
|
|
62386d3fc0 | ||
|
|
2acfc75da2 | ||
|
|
98cc09741c | ||
|
|
abc852624a | ||
|
|
7791f477cb | ||
|
|
eb950c1b9c | ||
|
|
e60a28ca23 | ||
|
|
4b67fb268b | ||
|
|
8f445ba570 | ||
|
|
0bf5300c9d | ||
|
|
a8e12d64a0 | ||
|
|
aa63aa94ee | ||
|
|
8decda51a4 | ||
|
|
d52f822c15 | ||
|
|
507e978386 | ||
|
|
a457f967c0 | ||
|
|
854d2adfca | ||
|
|
6118a12672 | ||
|
|
7bd8388fd6 | ||
|
|
664c43bce1 | ||
|
|
95d6d6131e | ||
|
|
46757bd5ef | ||
|
|
43cfc8d815 | ||
|
|
6cb0d2d95d | ||
|
|
8e5e2787c7 | ||
|
|
4014aa5730 | ||
|
|
869da1da74 | ||
|
|
3b34f81d56 | ||
|
|
720f23745f | ||
|
|
797430e9f8 | ||
|
|
f6559c1015 | ||
|
|
2974bc6d34 | ||
|
|
f3beeb9f1c | ||
|
|
36f0809546 | ||
|
|
896b8af1a2 | ||
|
|
7e26446573 | ||
|
|
9a7dca3482 | ||
|
|
f6c7c9283e | ||
|
|
840f4fa450 | ||
|
|
d68616b543 | ||
|
|
9e41dab43e | ||
|
|
5006f6935a | ||
|
|
9d38f2a047 | ||
|
|
a787d9afb2 | ||
|
|
82592ed69d | ||
|
|
3bcf0b9ea6 | ||
|
|
cd866fcf50 | ||
|
|
8eb33633e2 | ||
|
|
5c17638a90 | ||
|
|
7550c1e8bd | ||
|
|
82b80e4760 | ||
|
|
6cf22cef09 | ||
|
|
a8f49d9187 | ||
|
|
d45212733d | ||
|
|
f640727d96 | ||
|
|
242b65c446 | ||
|
|
e041e58e7f | ||
|
|
083386383e | ||
|
|
3aa9c144e3 | ||
|
|
ba44a6dfc6 | ||
|
|
8652edc139 | ||
|
|
6886b7903f | ||
|
|
1be139d327 | ||
|
|
86825475f0 | ||
|
|
eb1f71608d | ||
|
|
58401edc35 | ||
|
|
6dede6ee4d | ||
|
|
42199f6ebc | ||
|
|
badcefc4f7 | ||
|
|
b55dec55ee | ||
|
|
8e73e526ec | ||
|
|
fd6d7b8b3a | ||
|
|
6612f4444b | ||
|
|
3168c77c17 | ||
|
|
33a9b261bf | ||
|
|
11721590c1 | ||
|
|
78e803b95d | ||
|
|
8d083a93c4 | ||
|
|
9035cae19f | ||
|
|
e98fa8793b | ||
|
|
ef461be3e5 | ||
|
|
4c2da33d01 | ||
|
|
c3ae115546 | ||
|
|
bbcb553fdc | ||
|
|
08e4f5333d | ||
|
|
dc3979584c | ||
|
|
34764a6e33 | ||
|
|
1150b2e7c4 | ||
|
|
d66eb48088 | ||
|
|
07cc00671f | ||
|
|
c1504dc2b3 | ||
|
|
bc3524e1a7 | ||
|
|
71f585eef5 | ||
|
|
02091dddb7 | ||
|
|
9fca9b29dc | ||
|
|
94bb793b23 | ||
|
|
e2db4e2634 | ||
|
|
6e29791892 | ||
|
|
068195589a | ||
|
|
6b72a937ea | ||
|
|
43e357de5b | ||
|
|
00c2fb86c5 | ||
|
|
085813ec50 | ||
|
|
0339aafe14 | ||
|
|
c2a155c561 | ||
|
|
5dbffe0c56 | ||
|
|
00d671fac0 | ||
|
|
18c8b30bef | ||
|
|
0df9a7b982 | ||
|
|
0c777b9f30 | ||
|
|
2aac74fba2 | ||
|
|
6a1dcfc187 | ||
|
|
cb49b7b6cb | ||
|
|
a1a330986d | ||
|
|
3b43fcddb4 | ||
|
|
5ed3266942 | ||
|
|
debaa21b96 | ||
|
|
1996c1d853 | ||
|
|
79c3eb7dd2 | ||
|
|
bd3e3399b3 | ||
|
|
42d817f261 | ||
|
|
37d3f33926 | ||
|
|
595199a3c2 | ||
|
|
bf62fcf0b9 | ||
|
|
e1969bf553 | ||
|
|
3d059ecf0c | ||
|
|
e72510f236 | ||
|
|
d586e43d6e | ||
|
|
20c1e3f1cc | ||
|
|
c991691fcb | ||
|
|
39151732cf | ||
|
|
92e6150ea5 | ||
|
|
d4c233e1ef | ||
|
|
05243ec991 | ||
|
|
ec2b2b21d0 | ||
|
|
1ae68a0043 | ||
|
|
19f3e8b74a | ||
|
|
f65953a2e1 | ||
|
|
c5fa3e903a | ||
|
|
3f0a7597a2 | ||
|
|
9912ed24cf | ||
|
|
4c685b6d7c | ||
|
|
a37edc501b | ||
|
|
46a9d1613b | ||
|
|
b08265fab9 | ||
|
|
f1b5f5e3c7 | ||
|
|
e08fdbecbc | ||
|
|
a5ba1cb821 | ||
|
|
7da1cb36fa | ||
|
|
57c8fe5bc8 | ||
|
|
e7d3da8869 | ||
|
|
5dc80751c4 | ||
|
|
3e52dcac2c | ||
|
|
1037185a6a | ||
|
|
fec8fb5ac0 | ||
|
|
621a41844e | ||
|
|
0a3a94444e | ||
|
|
37aa2d35d5 | ||
|
|
5f91180a8c | ||
|
|
b8c5a2bfd7 | ||
|
|
880c15762b | ||
|
|
df54c9086b | ||
|
|
fdd50b2f86 | ||
|
|
b39a6bdb86 | ||
|
|
5a8b2584ff | ||
|
|
aae47eff86 | ||
|
|
65db2556c0 | ||
|
|
d132127143 | ||
|
|
3e5e4b29c1 | ||
|
|
71c70e0232 | ||
|
|
8f49c0509f | ||
|
|
5e29a051b2 | ||
|
|
8b76258260 | ||
|
|
518270e1f5 | ||
|
|
f16fab2d7a | ||
|
|
769c146d95 | ||
|
|
39d958de86 | ||
|
|
fbccb3d9be | ||
|
|
f25a4d5c07 | ||
|
|
805f2861aa | ||
|
|
9c6aae7c02 | ||
|
|
d7782733ed | ||
|
|
343dea6ba8 | ||
|
|
6a178a6436 | ||
|
|
dbc2e3d0f3 | ||
|
|
24e8e3e520 | ||
|
|
36f3fa87e3 | ||
|
|
2531afb07f | ||
|
|
0904b49c6c | ||
|
|
7448d03c86 | ||
|
|
2169b9ac76 | ||
|
|
30086097cd | ||
|
|
9d1a1ef5da | ||
|
|
17353810da | ||
|
|
655f138905 | ||
|
|
67bca051d9 | ||
|
|
8480dcbf96 |
@@ -1,3 +0,0 @@
|
||||
> 1%
|
||||
last 2 versions
|
||||
not dead
|
||||
@@ -1,5 +0,0 @@
|
||||
[*.{js,jsx,ts,tsx,vue}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
28
.eslintrc.js
@@ -1,28 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
extends: [
|
||||
'plugin:vue/essential',
|
||||
'@vue/standard'
|
||||
],
|
||||
parserOptions: {
|
||||
parser: 'babel-eslint'
|
||||
},
|
||||
rules: {
|
||||
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
|
||||
},
|
||||
overrides: [
|
||||
{
|
||||
files: [
|
||||
'**/__tests__/*.{j,t}s?(x)',
|
||||
'**/tests/unit/**/*.spec.{j,t}s?(x)'
|
||||
],
|
||||
env: {
|
||||
mocha: true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
22
.gitignore
vendored
@@ -1,22 +0,0 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
108
Basic-usage.md
Normal file
@@ -0,0 +1,108 @@
|
||||
# Basic usage
|
||||
|
||||
## Choose SQLite database, CSV file, JSON or NDJSON file
|
||||
|
||||
You can choose a database, a CSV file, a JSON or NDJSON file right on the welcom page (fig. 1). The
|
||||
supported file extentions: `.csv`, `.json`, `.ndjson`, `.db`,`.sqlite` and `.sqlite3`.
|
||||
|
||||

|
||||
|
||||
|
||||
If you choose a CSV, JSON or NDJSON file it will be parsed. Then sqliteviz creates a new
|
||||
database with data from the file. You can change table name
|
||||
in the dialog which is shown automatically if you choose a CSV, JSON or NDJSON file.
|
||||
For CSV you can also change parsing settings (fig. 2).
|
||||
|
||||

|
||||
|
||||
|
||||
If you don't have a database or CSV or JSON/NDJSON press `Create empty database` button and
|
||||
then fill an empty database using DDL and DML statements. A tab with an example
|
||||
of how to do it will be opened automatically (fig. 3).
|
||||
|
||||

|
||||
|
||||
|
||||
Database tables, columns and their types are shown in the left panel of the
|
||||
`Workspace` (fig. 4).
|
||||
|
||||

|
||||
|
||||
|
||||
## Create inquiry
|
||||
|
||||
### Open new tab
|
||||
|
||||
Press `Create` button in the top toolbar or use `Ctrl+b` (`Cmd+b` for MacOS)
|
||||
keyboard shortcut to open a new tab for an inquiry. An inquiry consists of three
|
||||
parts: SQL query, result set (result of the query execution) and visualisation
|
||||
of the result set. A tab consists of two panels. Each of them can show one of
|
||||
the three parts of inquiry. By default, the top panel shows SQL query editor and
|
||||
the bottom panel shows the result set. You can switch any panel to any other
|
||||
view with the corresponding buttons in the right side toolbar.
|
||||
|
||||
*  – Switch the panel to an SQL query editor. In that
|
||||
editor, you can specify and run not only a `SELECT` statement for getting data
|
||||
but also DDL/DML statements for modifying the database.
|
||||
*  – Switch the panel to the result set. Here you
|
||||
can see the result of the query execution.
|
||||
*  – Switch the panel to visualisation. This
|
||||
panel allows building a pivot table, a graph or charts from the result set.
|
||||
|
||||
> **Note:** The query editor can show you hints: SQL keywords, table and column
|
||||
> names. In a common case, column names are shown in the hint if you specify the
|
||||
> table name, e.g. `SELECT table_name.`. But if there is only one table in your
|
||||
> database column names will be always available in the hint. Press `Ctrl+Space`
|
||||
> to show a hint explicitly.
|
||||
|
||||
### Run query
|
||||
|
||||
Press  button in the right side toolbar of an SQL
|
||||
editor panel or use `Ctrl+r` or `Ctrl+Enter` (`Cmd+r` or `Cmd+Enter` for MacOS)
|
||||
keyboard shortcut to execute a query in the current open tab.
|
||||
|
||||
> **Note:** Running is not available if a query for the current tab is not
|
||||
> specified.
|
||||
|
||||
The query result will be displayed in the result panel (fig. 4).
|
||||
|
||||
### Create visualisation
|
||||
|
||||
After running a query switch any panel to the visualisation. Switch to the
|
||||
disired type of visualisation with buttons in the right side toolbar of the
|
||||
visualisation panel.
|
||||
|
||||
*  – Switch to a chart type visualisation.
|
||||
*  – Switch to a pivot type visualisation.
|
||||
*  – Switch to a graph type visualisation.
|
||||
|
||||
A pivot table can be represented as a regular or multi-header table or
|
||||
visualised with a chart.
|
||||
Read more details of working with pivot in [Pivot tables][2].
|
||||
|
||||
There are some requirements for the result set to build a graph.
|
||||
Read more in [Graph][3].
|
||||
|
||||
All customised charts in sqliteviz are created with a `react-chart-editor`
|
||||
component (fig. 5). The same component with some additional features is used in
|
||||
Plotly Chart Studio. Explore its [documentation][1] to learn how to build charts
|
||||
with `react-chart-editor`.
|
||||
|
||||

|
||||
|
||||
You can save any visualisation as an image by clicking .
|
||||
|
||||
## Save inquiry
|
||||
|
||||
Press `Save` button in the top toolbar or use `Ctrl+s` (`Cmd+s` for MacOS)
|
||||
keyboard shortcut to save an inquiry in the current opened tab to local storage
|
||||
of your browser.
|
||||
|
||||
After that, the inquiry will be in the list on `Inquiries` page.
|
||||
|
||||
> **Note:** Only the text of the SQL query and the visualisation settings will
|
||||
> be saved. The result of the query execution won't be saved.
|
||||
|
||||
[1]: https://plotly.com/chart-studio-help/tutorials/#basic
|
||||
[2]: ../Pivot-table
|
||||
[3]: ../Graph
|
||||
10
Diagnostic-information.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Diagnostic information
|
||||
|
||||
SQLite running in sqliteviz is compiled with particular [options][1] that can
|
||||
enable or disable some SQLite features. You can get a list of them in `App
|
||||
info` dialog (fig. 1) by clicking on  icon in the top
|
||||
toolbar.
|
||||
|
||||

|
||||
|
||||
[1]: https://sqlite.org/compile.html
|
||||
6
Export-current-database.md
Normal file
@@ -0,0 +1,6 @@
|
||||
# Export current database
|
||||
|
||||
Sqliteviz allows running not only `SELECT` statements but DML/DDL statements
|
||||
too. You can save database modifications into a `.sqlite` file by clicking on
|
||||
icon  next to the database name on `Workspace`
|
||||
page.
|
||||
54
Graph.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Graph
|
||||
|
||||
## Pivot table UI
|
||||
|
||||
Sqliteviz allows building pivot tables and visualizing them. To build a graph
|
||||
run a query to get data. Then open visualisation panel by clicking 
|
||||
in any of the two side toolbars and choose a pivot mode by clicking .
|
||||
|
||||
A pivot visualisation has the following settings:
|
||||
|
||||
- Columns – choose one or more column names from the result set. The values in
|
||||
the chosen columns will be column names of the pivot table.
|
||||
- Rows – choose one or more column names from the result set. The values in the
|
||||
chosen columns will be row names of the pivot table.
|
||||
- Order of columns and rows.
|
||||
- Aggregator and its arguments – a function which will be used for pivot cell
|
||||
calculation. An aggregator can have from zero to two arguments. An aggregator
|
||||
argument is one of the columns of the result set.
|
||||
- View – pivot table visualisation. It can be a table, a heatmap, a chart,
|
||||
etc. See some examples of different views of the same pivot table below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
There are several built-in chart views for a pivot. But you can build your own
|
||||
with `Custom chart` view (fig. 4).
|
||||
|
||||

|
||||
|
||||
> **Note:** You can switch to other pivot views and back to `Custom chart` –
|
||||
> all your custom chart settings will be remembered. But if you switch the
|
||||
> visualisation mode from pivot to any other mode, unsaved changes will be lost.
|
||||
|
||||
You can save any visualisation as an image by clicking .
|
||||
|
||||
## Pivot table SQL
|
||||
|
||||
Pivot table (in the form of a result set) can be built on the SQL-level and,
|
||||
technically speaking, can be visualised as any other result set. Practically
|
||||
though there are a couple of challenges with that:
|
||||
|
||||
1. Visualising a dataset of long/tall shape is much more convenient in Plotly
|
||||
(chart editor) rather than one of wide/fat shape.
|
||||
2. SQLite doesn't have a special constructs like `PIVOT` or `CROSSTAB` in
|
||||
its SQL dialect.
|
||||
|
||||
[How to build a pivot table in SQL(ite)][1] explores two options with static
|
||||
(or beforehand-known) and dynamic columns.
|
||||
|
||||
[1]: ../How-to-build-a-pivot-table-in-SQ-Lite
|
||||
|
||||
36
Home.md
Normal file
@@ -0,0 +1,36 @@
|
||||
Welcome to the sqliteviz wiki!
|
||||
|
||||
# For users
|
||||
1. [Installation][0]
|
||||
2. [Basic usage][1]
|
||||
3. [Multiple file import][9]
|
||||
4. [Manage inquiries][2]
|
||||
5. [Export current database][4]
|
||||
6. [Graph][13]
|
||||
7. [Pivot table][3]
|
||||
8. [Predefined inquiries][5]
|
||||
9. [Sharing][11]
|
||||
10. [Diagnostic information][6]
|
||||
|
||||
## Examples and tutorials
|
||||
1. [How to rename tables and columns after CSV import][8]
|
||||
2. [How to build a pivot table in SQL(ite)][10]
|
||||
3. [How to rename tables and columns after CSV import][12]
|
||||
|
||||
# For developers
|
||||
1. [Integrate predefined inquiries][7]
|
||||
|
||||
[0]: Installation
|
||||
[1]: Basic-usage
|
||||
[2]: Manage-inquiries
|
||||
[3]: Pivot-table
|
||||
[4]: Export-current-database
|
||||
[5]: Predefined-inquiries
|
||||
[6]: Diagnostic-information
|
||||
[7]: Integrate-predefined-inquiries
|
||||
[8]: How-to-rename-tables-and-columns-after-CSV-import
|
||||
[9]: Multiple-CSV-file-import
|
||||
[10]: How-to-build-a-pivot-table-in-SQLite
|
||||
[11]: Sharing
|
||||
[12]: How-to-rename-tables-and-columns-after-csv-import
|
||||
[13]: Graph
|
||||
137
How-to-build-a-pivot-table-in-SQLite.md
Normal file
@@ -0,0 +1,137 @@
|
||||
# How to build a pivot table in SQLite
|
||||
|
||||
This how-to explores how to build pivot tables in SQLite, which doesn't have a
|
||||
special constructs like `PIVOT` or `CROSSTAB` in its SQL dialect.
|
||||
|
||||
## Static-column pivot table
|
||||
|
||||
If the columns of a pivot table are known beforehand, it's possible to write a
|
||||
standard, say SQL-92, query that would produce a pivot table in its result set.
|
||||
This example uses World Bank [country indicators][1]. This query calculates
|
||||
average fertility and life expectancy for a few country groups.
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
"Country Name",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 196 AND "Indicator Name" LIKE 'Fertility rate%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "FR 196x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 196 AND "Indicator Name" LIKE 'Life expectancy%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "LE 196x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 197 AND "Indicator Name" LIKE 'Fertility rate%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "FR 197x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 197 AND "Indicator Name" LIKE 'Life expectancy%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "LE 197x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 198 AND "Indicator Name" LIKE 'Fertility rate%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "FR 198x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 198 AND "Indicator Name" LIKE 'Life expectancy%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "LE 198x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 199 AND "Indicator Name" LIKE 'Fertility rate%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "FR 199x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 199 AND "Indicator Name" LIKE 'Life expectancy%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "LE 199x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 200 AND "Indicator Name" LIKE 'Fertility rate%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "FR 200x",
|
||||
AVG(IIF(
|
||||
FLOOR(year / 10) = 200 AND "Indicator Name" LIKE 'Life expectancy%',
|
||||
value,
|
||||
NULL
|
||||
)) AS "LE 200x"
|
||||
FROM country_indicators
|
||||
WHERE "Country Name" IN(
|
||||
'Arab World',
|
||||
'Central Europe and the Baltics',
|
||||
'East Asia & Pacific',
|
||||
'European Union',
|
||||
'Latin America & Caribbean',
|
||||
'High income',
|
||||
'Middle income',
|
||||
'Low income'
|
||||
)
|
||||
GROUP BY 1
|
||||
ORDER BY
|
||||
CASE "Country Name"
|
||||
WHEN 'High income' THEN 1
|
||||
WHEN 'Middle income' THEN 2
|
||||
WHEN 'Low income' THEN 3
|
||||
WHEN 'European Union' THEN 4
|
||||
WHEN 'Central Europe and the Baltics' THEN 5
|
||||
WHEN 'East Asia & Pacific' THEN 6
|
||||
WHEN 'Latin America & Caribbean' THEN 7
|
||||
WHEN 'Arab World' THEN 8
|
||||
ELSE 99
|
||||
END
|
||||
```
|
||||
|
||||
## Dynamic-column pivot table
|
||||
|
||||
SQLite in sqliteviz is built with [pivot_vtab][2] extension. The same result set
|
||||
can be produced with this, arguably simpler and more maintainable, query.
|
||||
|
||||
```sql
|
||||
CREATE VIRTUAL TABLE temp.pivot USING pivot_vtab(
|
||||
(
|
||||
WITH t(country_name) AS (VALUES
|
||||
('High income'),
|
||||
('Middle income'),
|
||||
('Low income'),
|
||||
('European Union'),
|
||||
('Central Europe and the Baltics'),
|
||||
('East Asia & Pacific'),
|
||||
('Latin America & Caribbean'),
|
||||
('Arab World')
|
||||
)
|
||||
SELECT country_name FROM t
|
||||
),
|
||||
(
|
||||
SELECT
|
||||
FLOOR(year / 10) || '|' || "Indicator Name" column_key,
|
||||
CASE
|
||||
WHEN "Indicator Name" LIKE 'Fertility rate%' THEN 'FR'
|
||||
WHEN "Indicator Name" LIKE 'Life expectancy%' THEN 'LE'
|
||||
END || ' ' || FLOOR(year / 10) || 'x' column_name
|
||||
FROM country_indicators
|
||||
WHERE
|
||||
"Indicator Name" LIKE 'Fertility rate%'
|
||||
OR "Indicator Name" LIKE 'Life expectancy%'
|
||||
GROUP BY 1
|
||||
),
|
||||
(
|
||||
SELECT AVG(value)
|
||||
FROM country_indicators
|
||||
WHERE
|
||||
"Country Name" = :country_name
|
||||
AND FLOOR(year / 10) || '|' || "Indicator Name" = :column_key
|
||||
)
|
||||
);
|
||||
SELECT * FROM pivot
|
||||
```
|
||||
|
||||
[1]: https://github.com/plotly/datasets/blob/master/country_indicators.csv
|
||||
[2]: https://github.com/jakethaw/pivot_vtab
|
||||
26
How-to-migrate-to-sqliteviz-dot-com.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# How to migrate to sqliteviz.com
|
||||
|
||||
All upcoming sqliteviz releases will be deployed on sqliteviz.com instead of
|
||||
[Github Pages](https://lana-k.github.io/sqliteviz/#/). The saved inquiries that
|
||||
you still care about can be imported to sqliteviz.com as usual.
|
||||
|
||||
## Step 1: export inquiries
|
||||
|
||||
- Click `Inquiries` in the main top menu
|
||||
- Select all inquiries by clicking the checkbox in the table header
|
||||
- Click `Export` and save your inquiries in a JSON file
|
||||
|
||||
## Step 2: uninstall sqliteviz
|
||||
|
||||
If you installed sqliteviz as PWA uninstall it before install the new version.
|
||||
|
||||
- Go to `chrome://apps/` in your browser
|
||||
- Right click on sqliteviz icon
|
||||
- Choose `Remove from Chrome`
|
||||
|
||||
## Step 3: import inquiries
|
||||
|
||||
- Go to [https://sqliteviz.com/app/#/workspace](https://sqliteviz.com/app/#/workspace)
|
||||
- Click `Inquiries` in the main top menu
|
||||
- Click `Import`
|
||||
- Choose the file where you exported your inquiries
|
||||
54
How-to-rename-tables-and-columns-after-CSV-import.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# How to rename tables and columns after CSV import
|
||||
|
||||
## Rename columns
|
||||
|
||||
If sqliteviz parses CSV without `Use first row as column headers` option then
|
||||
it will name the columns like `col1`, `col2` etc. You can easily rename the
|
||||
columns after import with `ALTER TABLE` statements like this:
|
||||
|
||||
```sql
|
||||
ALTER TABLE your_table_name
|
||||
RENAME COLUMN current_column_name TO new_column_name;
|
||||
```
|
||||
|
||||
### Column rename example
|
||||
|
||||
There is a table `dots` with columns `col1`, `col2`, `col3`. Here are the steps
|
||||
to rename the columns to `x`, `y` and `z` respectively:
|
||||
|
||||
- Click `Create` in the top toolbar
|
||||
- In the opened query editor write a script
|
||||
|
||||
```sql
|
||||
ALTER TABLE dots
|
||||
RENAME COLUMN col1 TO x;
|
||||
|
||||
ALTER TABLE dots
|
||||
RENAME COLUMN col2 TO y;
|
||||
|
||||
ALTER TABLE dots
|
||||
RENAME COLUMN col3 TO z;
|
||||
```
|
||||
|
||||
- Click  to run the script
|
||||
|
||||
|
||||
## Rename table
|
||||
|
||||
```sql
|
||||
ALTER TABLE current_table_name
|
||||
RENAME TO new_table_name;
|
||||
```
|
||||
|
||||
### Table rename example
|
||||
|
||||
There is a table `dots`. Here are the steps to rename it to `point`:
|
||||
|
||||
- Click `Create` in the top toolbar
|
||||
- In the opened query editor write a script
|
||||
|
||||
```sql
|
||||
ALTER TABLE dots RENAME TO point
|
||||
```
|
||||
|
||||
- Click  to run the script
|
||||
16
Installation.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Installation
|
||||
|
||||
The latest release of sqliteviz is running on [sqliteviz.com/app][1].
|
||||
|
||||
Basically, you don't need to install sqliteviz. But if you want you can install
|
||||
it and use it as a regular desktop application with the following steps:
|
||||
|
||||
1. Open sqliteviz with [Chrome browser][2]
|
||||
2. At the top right of the address bar, click `Install`
|
||||
3. Confirm installation
|
||||
|
||||
See more about PWA on [Google Chrome Help][3].
|
||||
|
||||
[1]: https://sqliteviz.com/app/
|
||||
[2]: https://www.google.com/chrome
|
||||
[3]: https://support.google.com/chrome/answer/9658361?hl=en&ref_topic=7439636
|
||||
12
Integrate-predefined-inquiries.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Integrate predefined inquiries
|
||||
|
||||
If you run sqliteviz on your own server you can specify predefined inquiries.
|
||||
These inquiries will appear in `Inquiries` list for all users working with
|
||||
sqliteviz on your server.
|
||||
|
||||
To create a list of predefined inquiries choose inquiries in `Inquiries` list
|
||||
and export them to `inquiries.json`. Then (re)place this file on the server in
|
||||
the same directory as `index.html`.
|
||||
|
||||
A user can't edit, rename or delete a predefined inquiry. The rest operations
|
||||
are available.
|
||||
39
Manage-inquiries.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Manage inquiries
|
||||
|
||||
## Organise
|
||||
|
||||
You can find all inquiries that you saved in `Inquiries` (fig. 1).
|
||||
|
||||

|
||||
|
||||
To manipulate one inquiry hover the cursor over the row with the inquiry and
|
||||
choose the action:
|
||||
|
||||
*  – rename an inquiry
|
||||
*  – duplicate an inquiry
|
||||
*  – export an inquiry to JSON file
|
||||
*  – delete an inquiry
|
||||
|
||||
To edit a query or visualisation settings of an inquiry click on the respective
|
||||
row. You will be redirected to `Workspace` where the chosen inquiry will be
|
||||
opened in a tab.
|
||||
|
||||
> **Note:** After opening an inquiry there will be no visualisation for it even
|
||||
> if you specified it and saved. That is so because there is no data to build
|
||||
> the visualisation. Run the query and all saved chart settings will be applied.
|
||||
|
||||
You can also delete or export a group of inquiries to a JSON file. Select
|
||||
inquiries with checkboxes and press `Delete`/`Export` button above the grid
|
||||
(fig. 2).
|
||||
|
||||

|
||||
|
||||
> **Note:** Some operations are not available for predefined inquiries. Read
|
||||
> [Predefined inquiries][1] for details.
|
||||
|
||||
## Import
|
||||
|
||||
Click `Import` button on `Inquiries` page to import inquiries from a JSON file
|
||||
generated by export.
|
||||
|
||||
[1]: ../Predefined-inquiries
|
||||
12
Multiple-CSV-file-import.md
Normal file
@@ -0,0 +1,12 @@
|
||||
# Multiple CSV, JSON or NDJSON file import
|
||||
|
||||
Sometimes it's useful to import several files as tables in one database. For
|
||||
example, to be able to `JOIN` them in SQL.
|
||||
|
||||
In sqliteviz you can not only create a database from a CSV, JSON or NDJSON file, but also add
|
||||
another table from CSV, JSON or NDJSON to the existing database.
|
||||
|
||||
- Click  icon in the schema panel on `Workspace`
|
||||
page
|
||||
- Choose a file
|
||||
- Import it with `import` dialog.
|
||||
54
Pivot-table.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Pivot table
|
||||
|
||||
## Pivot table UI
|
||||
|
||||
Sqliteviz allows building pivot tables and visualizing them. To build a pivot
|
||||
run a query to get data. Then open visualisation panel by clicking 
|
||||
in any of the two side toolbars and choose a pivot mode by clicking .
|
||||
|
||||
A pivot visualisation has the following settings:
|
||||
|
||||
- Columns – choose one or more column names from the result set. The values in
|
||||
the chosen columns will be column names of the pivot table.
|
||||
- Rows – choose one or more column names from the result set. The values in the
|
||||
chosen columns will be row names of the pivot table.
|
||||
- Order of columns and rows.
|
||||
- Aggregator and its arguments – a function which will be used for pivot cell
|
||||
calculation. An aggregator can have from zero to two arguments. An aggregator
|
||||
argument is one of the columns of the result set.
|
||||
- View – pivot table visualisation. It can be a table, a heatmap, a chart,
|
||||
etc. See some examples of different views of the same pivot table below.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
There are several built-in chart views for a pivot. But you can build your own
|
||||
with `Custom chart` view (fig. 4).
|
||||
|
||||

|
||||
|
||||
> **Note:** You can switch to other pivot views and back to `Custom chart` –
|
||||
> all your custom chart settings will be remembered. But if you switch the
|
||||
> visualisation mode from pivot to any other mode, unsaved changes will be lost.
|
||||
|
||||
You can save any visualisation as an image by clicking .
|
||||
|
||||
## Pivot table SQL
|
||||
|
||||
Pivot table (in the form of a result set) can be built on the SQL-level and,
|
||||
technically speaking, can be visualised as any other result set. Practically
|
||||
though there are a couple of challenges with that:
|
||||
|
||||
1. Visualising a dataset of long/tall shape is much more convenient in Plotly
|
||||
(chart editor) rather than one of wide/fat shape.
|
||||
2. SQLite doesn't have a special constructs like `PIVOT` or `CROSSTAB` in
|
||||
its SQL dialect.
|
||||
|
||||
[How to build a pivot table in SQL(ite)][1] explores two options with static
|
||||
(or beforehand-known) and dynamic columns.
|
||||
|
||||
[1]: ../How-to-build-a-pivot-table-in-SQ-Lite
|
||||
|
||||
16
Predefined-inquiries.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Predefined inquiries
|
||||
|
||||
Predefined inquiries come out of the box on the sqliteviz instance. In sqliteviz
|
||||
deployed on [Github Pages][1] there are no predefined inquiries, but you may
|
||||
see them if you use sqliteviz integrated into another app.
|
||||
|
||||
These inquiries are shown in `Inqueries` list with a special label on the mouse
|
||||
over (fig. 1).
|
||||
|
||||

|
||||
|
||||
As a user, you can't rename or delete a predefined inquiry. You can't save
|
||||
changes in a predefined inquiry, but you can save them as a new inquiry. The
|
||||
rest operations, copy and export, are available.
|
||||
|
||||
[1]: https://lana-k.github.io/sqliteviz
|
||||
21
README.md
@@ -1,21 +0,0 @@
|
||||
# sqliteviz
|
||||
|
||||
**Note: This is a work-in-progress project.**
|
||||
|
||||
Sqliteviz is a single-page application for fully client-side visualisation of SQLite databases.
|
||||
It's a kind of middleground between [Plotly Falcon][1] and [Redash][2].
|
||||
It is built on top of [react-chart-editor][3] and [sql.js][4] in [Vue.js][5].
|
||||
|
||||
## Features
|
||||
|
||||
1. Ad-hoc and prepared visualisation of a SQLite database using flexibility
|
||||
of SQL and richness of Plotly's `react-chart-editor`
|
||||
2. Visualisation pallete, SQL and chart definitions, kept in local
|
||||
storage with import/export
|
||||
3. Integration-side provided pallete
|
||||
|
||||
[1]: https://github.com/plotly/falcon
|
||||
[2]: https://github.com/getredash/redash
|
||||
[3]: https://github.com/plotly/react-chart-editor
|
||||
[4]: https://github.com/sql-js/sql.js
|
||||
[5]: https://github.com/vuejs/vue
|
||||
25
Sharing.md
Normal file
@@ -0,0 +1,25 @@
|
||||
# Sharing
|
||||
|
||||
You can generate a share link. That allows to share not only inquiries but also
|
||||
a database and inquiry display settings. Sqliteviz will automatically load
|
||||
database and inquiries, open them and run the query for the first inquiry.
|
||||
|
||||
The share link can have the following query parameters:
|
||||
|
||||
| Parameter | Values | Description |
|
||||
|--------------|----------------------------------|-------------|
|
||||
| `data_url` | | A URL to an SQLite database file. If not provided sqliteviz will run inquiries agains an empty database.|
|
||||
| `data_format`|`sqlite` | Currently share links support only "sqlite" data format.
|
||||
| `inquiry_url`| | A URL to an inquiry JSON file (you can make that file with inquiry export – see [Manage inquiries][3]).|
|
||||
| `inquiry_id` | | If `inquiry_id` is provided (can occure multiple times) sqliteviz will load only inquiries with provided IDs. If not provided it will get them all.|
|
||||
| `maximize` | `table`, `sqlEditor`, `dataView` | Specify which panel should be maximised for each inquiry. If not provided the inquiries will be opened in the default state: SQL editor on top and result set at the bottom.|
|
||||
|
||||
> **Note:** the server where you host your database or inquiry files must allow
|
||||
cross-origin access. For example you can place your files on [GitHub Gist][1].
|
||||
You can check your URLs with [CORS tester][2].
|
||||
|
||||
Use the following form to generate a share link:
|
||||
|
||||
[1]: https://gist.github.com/
|
||||
[2]: https://cors-test.codehappy.dev/?origin=https%3A%2F%2Fsqliteviz.com%2F&method=get
|
||||
[3]: ../Manage-inquiries
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
1
dist/css/app.28dcc10a.css
vendored
1
dist/css/chunk-vendors.0e10a006.css
vendored
BIN
dist/favicon.ico
vendored
|
Before Width: | Height: | Size: 4.2 KiB |
3
dist/img/chevron.47c36bae.svg
vendored
@@ -1,3 +0,0 @@
|
||||
<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992 5.79997L1.99992 11.2L0.721924 9.93097Z" fill="#506784"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 243 B |
1
dist/index.html
vendored
@@ -1 +0,0 @@
|
||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>sqliteviz</title><link href=/css/app.28dcc10a.css rel=preload as=style><link href=/css/chunk-vendors.0e10a006.css rel=preload as=style><link href=/js/app.ea875e01.js rel=preload as=script><link href=/js/chunk-vendors.bcee47d0.js rel=preload as=script><link href=/css/chunk-vendors.0e10a006.css rel=stylesheet><link href=/css/app.28dcc10a.css rel=stylesheet></head><body><noscript><strong>We're sorry but sqliteviz doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.bcee47d0.js></script><script src=/js/app.ea875e01.js></script></body></html>
|
||||
2
dist/js/app.ea875e01.js
vendored
1
dist/js/app.ea875e01.js.map
vendored
129
dist/js/chunk-vendors.bcee47d0.js
vendored
1
dist/js/chunk-vendors.bcee47d0.js.map
vendored
BIN
dist/js/sql-wasm.wasm
vendored
298
dist/js/worker.sql-wasm.js
vendored
@@ -1,298 +0,0 @@
|
||||
|
||||
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
|
||||
// https://github.com/kripken/emscripten/issues/5820
|
||||
// In addition, When you use emcc's modularization, it still expects to export a global object called `Module`,
|
||||
// which is able to be used/called before the WASM is loaded.
|
||||
// The modularization below exports a promise that loads and resolves to the actual sql.js module.
|
||||
// That way, this module can't be used before the WASM is finished loading.
|
||||
|
||||
// We are going to define a function that a user will call to start loading initializing our Sql.js library
|
||||
// However, that function might be called multiple times, and on subsequent calls, we don't actually want it to instantiate a new instance of the Module
|
||||
// Instead, we want to return the previously loaded module
|
||||
|
||||
// TODO: Make this not declare a global if used in the browser
|
||||
var initSqlJsPromise = undefined;
|
||||
|
||||
var initSqlJs = function (moduleConfig) {
|
||||
|
||||
if (initSqlJsPromise){
|
||||
return initSqlJsPromise;
|
||||
}
|
||||
// If we're here, we've never called this function before
|
||||
initSqlJsPromise = new Promise(function (resolveModule, reject) {
|
||||
|
||||
// We are modularizing this manually because the current modularize setting in Emscripten has some issues:
|
||||
// https://github.com/kripken/emscripten/issues/5820
|
||||
|
||||
// The way to affect the loading of emcc compiled modules is to create a variable called `Module` and add
|
||||
// properties to it, like `preRun`, `postRun`, etc
|
||||
// We are using that to get notified when the WASM has finished loading.
|
||||
// Only then will we return our promise
|
||||
|
||||
// If they passed in a moduleConfig object, use that
|
||||
// Otherwise, initialize Module to the empty object
|
||||
var Module = typeof moduleConfig !== 'undefined' ? moduleConfig : {};
|
||||
|
||||
// EMCC only allows for a single onAbort function (not an array of functions)
|
||||
// So if the user defined their own onAbort function, we remember it and call it
|
||||
var originalOnAbortFunction = Module['onAbort'];
|
||||
Module['onAbort'] = function (errorThatCausedAbort) {
|
||||
reject(new Error(errorThatCausedAbort));
|
||||
if (originalOnAbortFunction){
|
||||
originalOnAbortFunction(errorThatCausedAbort);
|
||||
}
|
||||
};
|
||||
|
||||
Module['postRun'] = Module['postRun'] || [];
|
||||
Module['postRun'].push(function () {
|
||||
// When Emscripted calls postRun, this promise resolves with the built Module
|
||||
resolveModule(Module);
|
||||
});
|
||||
|
||||
// There is a section of code in the emcc-generated code below that looks like this:
|
||||
// (Note that this is lowercase `module`)
|
||||
// if (typeof module !== 'undefined') {
|
||||
// module['exports'] = Module;
|
||||
// }
|
||||
// When that runs, it's going to overwrite our own modularization export efforts in shell-post.js!
|
||||
// The only way to tell emcc not to emit it is to pass the MODULARIZE=1 or MODULARIZE_INSTANCE=1 flags,
|
||||
// but that carries with it additional unnecessary baggage/bugs we don't want either.
|
||||
// So, we have three options:
|
||||
// 1) We undefine `module`
|
||||
// 2) We remember what `module['exports']` was at the beginning of this function and we restore it later
|
||||
// 3) We write a script to remove those lines of code as part of the Make process.
|
||||
//
|
||||
// Since those are the only lines of code that care about module, we will undefine it. It's the most straightforward
|
||||
// of the options, and has the side effect of reducing emcc's efforts to modify the module if its output were to change in the future.
|
||||
// That's a nice side effect since we're handling the modularization efforts ourselves
|
||||
module = undefined;
|
||||
|
||||
// The emcc-generated code and shell-post.js code goes below,
|
||||
// meaning that all of it runs inside of this promise. If anything throws an exception, our promise will abort
|
||||
|
||||
var e;e||(e=typeof Module !== 'undefined' ? Module : {});
|
||||
e.onRuntimeInitialized=function(){function a(h,m){this.Na=h;this.db=m;this.Ma=1;this.eb=[]}function b(h){this.filename="dbfile_"+(4294967295*Math.random()>>>0);if(null!=h){var m=this.filename,q=m?k("//"+m):"/";m=aa(!0,!0);q=ba(q,(void 0!==m?m:438)&4095|32768,0);if(h){if("string"===typeof h){for(var v=Array(h.length),B=0,Q=h.length;B<Q;++B)v[B]=h.charCodeAt(B);h=v}ca(q,m|146);v=l(q,"w");da(v,h,0,h.length,0,void 0);ea(v);ca(q,m)}}this.handleError(f(this.filename,c));this.db=p(c,"i32");uc(this.db);this.bb=
|
||||
{};this.Ta={}}null;var c=t(4),d=e.cwrap,f=d("sqlite3_open","number",["string","number"]),g=d("sqlite3_close_v2","number",["number"]),n=d("sqlite3_exec","number",["number","string","number","number","number"]),r=d("sqlite3_changes","number",["number"]),w=d("sqlite3_prepare_v2","number",["number","string","number","number","number"]),u=d("sqlite3_prepare_v2","number",["number","number","number","number","number"]),C=d("sqlite3_bind_text","number",["number","number","number","number","number"]),H=d("sqlite3_bind_blob",
|
||||
"number",["number","number","number","number","number"]),ma=d("sqlite3_bind_double","number",["number","number","number"]),na=d("sqlite3_bind_int","number",["number","number","number"]),vc=d("sqlite3_bind_parameter_index","number",["number","string"]),wc=d("sqlite3_step","number",["number"]),xc=d("sqlite3_errmsg","string",["number"]),wb=d("sqlite3_data_count","number",["number"]),yc=d("sqlite3_column_double","number",["number","number"]),zc=d("sqlite3_column_text","string",["number","number"]),Ac=
|
||||
d("sqlite3_column_blob","number",["number","number"]),Bc=d("sqlite3_column_bytes","number",["number","number"]),Cc=d("sqlite3_column_type","number",["number","number"]),Dc=d("sqlite3_column_name","string",["number","number"]),Ec=d("sqlite3_reset","number",["number"]),Fc=d("sqlite3_clear_bindings","number",["number"]),Gc=d("sqlite3_finalize","number",["number"]),Hc=d("sqlite3_create_function_v2","number","number string number number number number number number number".split(" ")),Ic=d("sqlite3_value_type",
|
||||
"number",["number"]),Jc=d("sqlite3_value_bytes","number",["number"]),Kc=d("sqlite3_value_text","string",["number"]),Lc=d("sqlite3_value_blob","number",["number"]),Mc=d("sqlite3_value_double","number",["number"]),Nc=d("sqlite3_result_double","",["number","number"]),xb=d("sqlite3_result_null","",["number"]),Oc=d("sqlite3_result_text","",["number","string","number","number"]),Pc=d("sqlite3_result_blob","",["number","number","number","number"]),Qc=d("sqlite3_result_int","",["number","number"]),yb=d("sqlite3_result_error",
|
||||
"",["number","string","number"]),uc=d("RegisterExtensionFunctions","number",["number"]);a.prototype.bind=function(h){if(!this.Na)throw"Statement closed";this.reset();return Array.isArray(h)?this.sb(h):null!=h&&"object"===typeof h?this.tb(h):!0};a.prototype.step=function(){if(!this.Na)throw"Statement closed";this.Ma=1;var h=wc(this.Na);switch(h){case 100:return!0;case 101:return!1;default:throw this.db.handleError(h);}};a.prototype.zb=function(h){null==h&&(h=this.Ma,this.Ma+=1);return yc(this.Na,h)};
|
||||
a.prototype.Ab=function(h){null==h&&(h=this.Ma,this.Ma+=1);return zc(this.Na,h)};a.prototype.getBlob=function(h){null==h&&(h=this.Ma,this.Ma+=1);var m=Bc(this.Na,h);var q=Ac(this.Na,h);var v=new Uint8Array(m);for(h=0;h<m;)v[h]=x[q+h],h+=1;return v};a.prototype.get=function(h){var m;null!=h&&this.bind(h)&&this.step();var q=[];h=0;for(m=wb(this.Na);h<m;){switch(Cc(this.Na,h)){case 1:case 2:q.push(this.zb(h));break;case 3:q.push(this.Ab(h));break;case 4:q.push(this.getBlob(h));break;default:q.push(null)}h+=
|
||||
1}return q};a.prototype.getColumnNames=function(){var h;var m=[];var q=0;for(h=wb(this.Na);q<h;)m.push(Dc(this.Na,q)),q+=1;return m};a.prototype.getAsObject=function(h){var m;var q=this.get(h);var v=this.getColumnNames();var B={};h=0;for(m=v.length;h<m;){var Q=v[h];B[Q]=q[h];h+=1}return B};a.prototype.run=function(h){null!=h&&this.bind(h);this.step();return this.reset()};a.prototype.wb=function(h,m){null==m&&(m=this.Ma,this.Ma+=1);h=fa(h);var q=ha(h);this.eb.push(q);this.db.handleError(C(this.Na,
|
||||
m,q,h.length-1,0))};a.prototype.rb=function(h,m){null==m&&(m=this.Ma,this.Ma+=1);var q=ha(h);this.eb.push(q);this.db.handleError(H(this.Na,m,q,h.length,0))};a.prototype.vb=function(h,m){null==m&&(m=this.Ma,this.Ma+=1);this.db.handleError((h===(h|0)?na:ma)(this.Na,m,h))};a.prototype.ub=function(h){null==h&&(h=this.Ma,this.Ma+=1);H(this.Na,h,0,0,0)};a.prototype.kb=function(h,m){null==m&&(m=this.Ma,this.Ma+=1);switch(typeof h){case "string":this.wb(h,m);return;case "number":case "boolean":this.vb(h+
|
||||
0,m);return;case "object":if(null===h){this.ub(m);return}if(null!=h.length){this.rb(h,m);return}}throw"Wrong API use : tried to bind a value of an unknown type ("+h+").";};a.prototype.tb=function(h){var m=this;Object.keys(h).forEach(function(q){var v=vc(m.Na,q);0!==v&&m.kb(h[q],v)});return!0};a.prototype.sb=function(h){var m;for(m=0;m<h.length;)this.kb(h[m],m+1),m+=1;return!0};a.prototype.reset=function(){return 0===Fc(this.Na)&&0===Ec(this.Na)};a.prototype.freemem=function(){for(var h;void 0!==(h=
|
||||
this.eb.pop());)ia(h)};a.prototype.free=function(){var h=0===Gc(this.Na);delete this.db.bb[this.Na];this.Na=0;return h};b.prototype.run=function(h,m){if(!this.db)throw"Database closed";if(m){h=this.prepare(h,m);try{h.step()}finally{h.free()}}else this.handleError(n(this.db,h,0,0,c));return this};b.prototype.exec=function(h,m){if(!this.db)throw"Database closed";var q=ja();try{var v=ka(h)+1,B=t(v);la(h,x,B,v);var Q=B;var F=t(4);for(h=[];0!==p(Q,"i8");){oa(c);oa(F);this.handleError(u(this.db,Q,-1,c,
|
||||
F));var pa=p(c,"i32");Q=p(F,"i32");if(0!==pa){var S=null;var A=new a(pa,this);for(null!=m&&A.bind(m);A.step();)null===S&&(S={columns:A.getColumnNames(),values:[]},h.push(S)),S.values.push(A.get());A.free()}}return h}catch(M){throw A&&A.free(),M;}finally{qa(q)}};b.prototype.each=function(h,m,q,v){"function"===typeof m&&(v=q,q=m,m=void 0);h=this.prepare(h,m);try{for(;h.step();)q(h.getAsObject())}finally{h.free()}if("function"===typeof v)return v()};b.prototype.prepare=function(h,m){oa(c);this.handleError(w(this.db,
|
||||
h,-1,c,0));h=p(c,"i32");if(0===h)throw"Nothing to prepare";var q=new a(h,this);null!=m&&q.bind(m);return this.bb[h]=q};b.prototype["export"]=function(){Object.values(this.bb).forEach(function(m){m.free()});Object.values(this.Ta).forEach(ra);this.Ta={};this.handleError(g(this.db));var h=sa(this.filename);this.handleError(f(this.filename,c));this.db=p(c,"i32");return h};b.prototype.close=function(){null!==this.db&&(Object.values(this.bb).forEach(function(h){h.free()}),Object.values(this.Ta).forEach(ra),
|
||||
this.Ta={},this.handleError(g(this.db)),ta("/"+this.filename),this.db=null)};b.prototype.handleError=function(h){if(0===h)return null;h=xc(this.db);throw Error(h);};b.prototype.getRowsModified=function(){return r(this.db)};b.prototype.create_function=function(h,m){Object.prototype.hasOwnProperty.call(this.Ta,h)&&(ua(this.Ta[h]),delete this.Ta[h]);var q=va(function(v,B,Q){for(var F,pa=[],S=0;S<B;S+=1){var A=p(Q+4*S,"i32"),M=Ic(A);if(1===M||2===M)A=Mc(A);else if(3===M)A=Kc(A);else if(4===M){M=A;A=Jc(M);
|
||||
M=Lc(M);for(var Db=new Uint8Array(A),Da=0;Da<A;Da+=1)Db[Da]=x[M+Da];A=Db}else A=null;pa.push(A)}try{F=m.apply(null,pa)}catch(Tc){yb(v,Tc,-1);return}switch(typeof F){case "boolean":Qc(v,F?1:0);break;case "number":Nc(v,F);break;case "string":Oc(v,F,-1,-1);break;case "object":null===F?xb(v):null!=F.length?(B=ha(F),Pc(v,B,F.length,-1),ia(B)):yb(v,"Wrong API use : tried to return a value of an unknown type ("+F+").",-1);break;default:xb(v)}});this.Ta[h]=q;this.handleError(Hc(this.db,h,m.length,1,0,q,0,
|
||||
0,0));return this};e.Database=b};var wa={},y;for(y in e)e.hasOwnProperty(y)&&(wa[y]=e[y]);var xa="./this.program",ya=!1,za=!1,Aa=!1,Ba=!1;ya="object"===typeof window;za="function"===typeof importScripts;Aa="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node;Ba=!ya&&!Aa&&!za;var z="",Ca,Ea,Fa,Ga;
|
||||
if(Aa)z=za?require("path").dirname(z)+"/":__dirname+"/",Ca=function(a,b){Fa||(Fa=require("fs"));Ga||(Ga=require("path"));a=Ga.normalize(a);return Fa.readFileSync(a,b?null:"utf8")},Ea=function(a){a=Ca(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},1<process.argv.length&&(xa=process.argv[1].replace(/\\/g,"/")),process.argv.slice(2),"undefined"!==typeof module&&(module.exports=e),process.on("unhandledRejection",D),e.inspect=function(){return"[Emscripten Module object]"};else if(Ba)"undefined"!=
|
||||
typeof read&&(Ca=function(a){return read(a)}),Ea=function(a){if("function"===typeof readbuffer)return new Uint8Array(readbuffer(a));a=read(a,"binary");assert("object"===typeof a);return a},"undefined"!==typeof print&&("undefined"===typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!==typeof printErr?printErr:print);else if(ya||za)za?z=self.location.href:document.currentScript&&(z=document.currentScript.src),z=0!==z.indexOf("blob:")?z.substr(0,z.lastIndexOf("/")+
|
||||
1):"",Ca=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.send(null);return b.responseText},za&&(Ea=function(a){var b=new XMLHttpRequest;b.open("GET",a,!1);b.responseType="arraybuffer";b.send(null);return new Uint8Array(b.response)});var Ha=e.print||console.log.bind(console),E=e.printErr||console.warn.bind(console);for(y in wa)wa.hasOwnProperty(y)&&(e[y]=wa[y]);wa=null;e.thisProgram&&(xa=e.thisProgram);function Ia(a){var b=G[Ja>>2];G[Ja>>2]=b+a+15&-16;return b}var Ka=[],La;
|
||||
function ua(a){La.delete(I.get(a));Ka.push(a)}
|
||||
function va(a){if(!La){La=new WeakMap;for(var b=0;b<I.length;b++){var c=I.get(b);c&&La.set(c,b)}}if(La.has(a))a=La.get(a);else{if(Ka.length)b=Ka.pop();else{b=I.length;try{I.grow(1)}catch(g){if(!(g instanceof RangeError))throw g;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";}}try{I.set(b,a)}catch(g){if(!(g instanceof TypeError))throw g;assert(!0,"Missing signature argument to addFunction");if("function"===typeof WebAssembly.Function){var d={i:"i32",j:"i64",f:"f32",d:"f64"},f={parameters:[],
|
||||
results:[]};for(c=1;4>c;++c)f.parameters.push(d["viii"[c]]);c=new WebAssembly.Function(f,a)}else{d=[1,0,1,96];f={i:127,j:126,f:125,d:124};d.push(3);for(c=0;3>c;++c)d.push(f["iii"[c]]);d.push(0);d[1]=d.length-2;c=new Uint8Array([0,97,115,109,1,0,0,0].concat(d,[2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0]));c=new WebAssembly.Module(c);c=(new WebAssembly.Instance(c,{e:{f:a}})).exports.f}I.set(b,c)}La.set(a,b);a=b}return a}function ra(a){ua(a)}var Ma;e.wasmBinary&&(Ma=e.wasmBinary);var noExitRuntime;
|
||||
e.noExitRuntime&&(noExitRuntime=e.noExitRuntime);"object"!==typeof WebAssembly&&E("no native wasm support detected");
|
||||
function oa(a){var b="i32";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":x[a>>0]=0;break;case "i8":x[a>>0]=0;break;case "i16":Na[a>>1]=0;break;case "i32":G[a>>2]=0;break;case "i64":J=[0,(K=0,1<=+Oa(K)?0<K?(Pa(+Qa(K/4294967296),4294967295)|0)>>>0:~~+Ra((K-+(~~K>>>0))/4294967296)>>>0:0)];G[a>>2]=J[0];G[a+4>>2]=J[1];break;case "float":Sa[a>>2]=0;break;case "double":Ta[a>>3]=0;break;default:D("invalid type for setValue: "+b)}}
|
||||
function p(a,b){b=b||"i8";"*"===b.charAt(b.length-1)&&(b="i32");switch(b){case "i1":return x[a>>0];case "i8":return x[a>>0];case "i16":return Na[a>>1];case "i32":return G[a>>2];case "i64":return G[a>>2];case "float":return Sa[a>>2];case "double":return Ta[a>>3];default:D("invalid type for getValue: "+b)}return null}var Ua,I=new WebAssembly.Table({initial:387,element:"anyfunc"}),Va=!1;function assert(a,b){a||D("Assertion failed: "+b)}
|
||||
function Wa(a){var b=e["_"+a];assert(b,"Cannot call unknown function "+a+", make sure it is exported");return b}
|
||||
function Xa(a,b,c,d){var f={string:function(u){var C=0;if(null!==u&&void 0!==u&&0!==u){var H=(u.length<<2)+1;C=t(H);la(u,L,C,H)}return C},array:function(u){var C=t(u.length);x.set(u,C);return C}},g=Wa(a),n=[];a=0;if(d)for(var r=0;r<d.length;r++){var w=f[c[r]];w?(0===a&&(a=ja()),n[r]=w(d[r])):n[r]=d[r]}c=g.apply(null,n);c=function(u){return"string"===b?N(u):"boolean"===b?!!u:u}(c);0!==a&&qa(a);return c}var Ya=0,Za=3;
|
||||
function ha(a){var b=Ya;if("number"===typeof a){var c=!0;var d=a}else c=!1,d=a.length;var f;b==Za?f=g:f=[$a,t,Ia][b](Math.max(d,1));if(c){var g=f;assert(0==(f&3));for(a=f+(d&-4);g<a;g+=4)G[g>>2]=0;for(a=f+d;g<a;)x[g++>>0]=0;return f}a.subarray||a.slice?L.set(a,f):L.set(new Uint8Array(a),f);return f}var ab="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0;
|
||||
function bb(a,b,c){var d=b+c;for(c=b;a[c]&&!(c>=d);)++c;if(16<c-b&&a.subarray&&ab)return ab.decode(a.subarray(b,c));for(d="";b<c;){var f=a[b++];if(f&128){var g=a[b++]&63;if(192==(f&224))d+=String.fromCharCode((f&31)<<6|g);else{var n=a[b++]&63;f=224==(f&240)?(f&15)<<12|g<<6|n:(f&7)<<18|g<<12|n<<6|a[b++]&63;65536>f?d+=String.fromCharCode(f):(f-=65536,d+=String.fromCharCode(55296|f>>10,56320|f&1023))}}else d+=String.fromCharCode(f)}return d}function N(a){return a?bb(L,a,void 0):""}
|
||||
function la(a,b,c,d){if(!(0<d))return 0;var f=c;d=c+d-1;for(var g=0;g<a.length;++g){var n=a.charCodeAt(g);if(55296<=n&&57343>=n){var r=a.charCodeAt(++g);n=65536+((n&1023)<<10)|r&1023}if(127>=n){if(c>=d)break;b[c++]=n}else{if(2047>=n){if(c+1>=d)break;b[c++]=192|n>>6}else{if(65535>=n){if(c+2>=d)break;b[c++]=224|n>>12}else{if(c+3>=d)break;b[c++]=240|n>>18;b[c++]=128|n>>12&63}b[c++]=128|n>>6&63}b[c++]=128|n&63}}b[c]=0;return c-f}
|
||||
function ka(a){for(var b=0,c=0;c<a.length;++c){var d=a.charCodeAt(c);55296<=d&&57343>=d&&(d=65536+((d&1023)<<10)|a.charCodeAt(++c)&1023);127>=d?++b:b=2047>=d?b+2:65535>=d?b+3:b+4}return b}function cb(a){var b=ka(a)+1,c=$a(b);c&&la(a,x,c,b);return c}var db,x,L,Na,G,Sa,Ta;
|
||||
function eb(a){db=a;e.HEAP8=x=new Int8Array(a);e.HEAP16=Na=new Int16Array(a);e.HEAP32=G=new Int32Array(a);e.HEAPU8=L=new Uint8Array(a);e.HEAPU16=new Uint16Array(a);e.HEAPU32=new Uint32Array(a);e.HEAPF32=Sa=new Float32Array(a);e.HEAPF64=Ta=new Float64Array(a)}var Ja=63056,fb=e.INITIAL_MEMORY||16777216;e.wasmMemory?Ua=e.wasmMemory:Ua=new WebAssembly.Memory({initial:fb/65536,maximum:32768});Ua&&(db=Ua.buffer);fb=db.byteLength;eb(db);G[Ja>>2]=5306096;
|
||||
function gb(a){for(;0<a.length;){var b=a.shift();if("function"==typeof b)b(e);else{var c=b.yb;"number"===typeof c?void 0===b.fb?e.dynCall_v(c):e.dynCall_vi(c,b.fb):c(void 0===b.fb?null:b.fb)}}}var hb=[],ib=[],jb=[],kb=[];function lb(){var a=e.preRun.shift();hb.unshift(a)}var Oa=Math.abs,Ra=Math.ceil,Qa=Math.floor,Pa=Math.min,mb=0,nb=null,ob=null;e.preloadedImages={};e.preloadedAudios={};
|
||||
function D(a){if(e.onAbort)e.onAbort(a);Ha(a);E(a);Va=!0;throw new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");}function pb(a){var b=qb;return String.prototype.startsWith?b.startsWith(a):0===b.indexOf(a)}function rb(){return pb("data:application/octet-stream;base64,")}var qb="sql-wasm.wasm";if(!rb()){var sb=qb;qb=e.locateFile?e.locateFile(sb,z):z+sb}
|
||||
function tb(){try{if(Ma)return new Uint8Array(Ma);if(Ea)return Ea(qb);throw"both async and sync fetching of the wasm failed";}catch(a){D(a)}}function ub(){return Ma||!ya&&!za||"function"!==typeof fetch||pb("file://")?new Promise(function(a){a(tb())}):fetch(qb,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+qb+"'";return a.arrayBuffer()}).catch(function(){return tb()})}var K,J;ib.push({yb:function(){vb()}});
|
||||
function zb(a){return a.replace(/\b_Z[\w\d_]+/g,function(b){return b===b?b:b+" ["+b+"]"})}function Ab(a,b){for(var c=0,d=a.length-1;0<=d;d--){var f=a[d];"."===f?a.splice(d,1):".."===f?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c;c--)a.unshift("..");return a}function k(a){var b="/"===a.charAt(0),c="/"===a.substr(-1);(a=Ab(a.split("/").filter(function(d){return!!d}),!b).join("/"))||b||(a=".");a&&c&&(a+="/");return(b?"/":"")+a}
|
||||
function Bb(a){var b=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);a=b[0];b=b[1];if(!a&&!b)return".";b&&(b=b.substr(0,b.length-1));return a+b}function Cb(a){if("/"===a)return"/";var b=a.lastIndexOf("/");return-1===b?a:a.substr(b+1)}function Eb(a){G[Fb()>>2]=a}
|
||||
function Gb(){for(var a="",b=!1,c=arguments.length-1;-1<=c&&!b;c--){b=0<=c?arguments[c]:"/";if("string"!==typeof b)throw new TypeError("Arguments to path.resolve must be strings");if(!b)return"";a=b+"/"+a;b="/"===b.charAt(0)}a=Ab(a.split("/").filter(function(d){return!!d}),!b).join("/");return(b?"/":"")+a||"."}var Hb=[];function Ib(a,b){Hb[a]={input:[],output:[],Ya:b};Jb(a,Kb)}
|
||||
var Kb={open:function(a){var b=Hb[a.node.rdev];if(!b)throw new O(43);a.tty=b;a.seekable=!1},close:function(a){a.tty.Ya.flush(a.tty)},flush:function(a){a.tty.Ya.flush(a.tty)},read:function(a,b,c,d){if(!a.tty||!a.tty.Ya.ob)throw new O(60);for(var f=0,g=0;g<d;g++){try{var n=a.tty.Ya.ob(a.tty)}catch(r){throw new O(29);}if(void 0===n&&0===f)throw new O(6);if(null===n||void 0===n)break;f++;b[c+g]=n}f&&(a.node.timestamp=Date.now());return f},write:function(a,b,c,d){if(!a.tty||!a.tty.Ya.hb)throw new O(60);
|
||||
try{for(var f=0;f<d;f++)a.tty.Ya.hb(a.tty,b[c+f])}catch(g){throw new O(29);}d&&(a.node.timestamp=Date.now());return f}},Lb={ob:function(a){if(!a.input.length){var b=null;if(Aa){var c=Buffer.qb?Buffer.qb(256):new Buffer(256),d=0;try{d=Fa.readSync(process.stdin.fd,c,0,256,null)}catch(f){if(-1!=f.toString().indexOf("EOF"))d=0;else throw f;}0<d?b=c.slice(0,d).toString("utf-8"):b=null}else"undefined"!=typeof window&&"function"==typeof window.prompt?(b=window.prompt("Input: "),null!==b&&(b+="\n")):"function"==
|
||||
typeof readline&&(b=readline(),null!==b&&(b+="\n"));if(!b)return null;a.input=fa(b,!0)}return a.input.shift()},hb:function(a,b){null===b||10===b?(Ha(bb(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(Ha(bb(a.output,0)),a.output=[])}},Mb={hb:function(a,b){null===b||10===b?(E(bb(a.output,0)),a.output=[]):0!=b&&a.output.push(b)},flush:function(a){a.output&&0<a.output.length&&(E(bb(a.output,0)),a.output=[])}},P={Ra:null,Sa:function(){return P.createNode(null,
|
||||
"/",16895,0)},createNode:function(a,b,c,d){if(24576===(c&61440)||4096===(c&61440))throw new O(63);P.Ra||(P.Ra={dir:{node:{Qa:P.Ja.Qa,Pa:P.Ja.Pa,lookup:P.Ja.lookup,Za:P.Ja.Za,rename:P.Ja.rename,unlink:P.Ja.unlink,rmdir:P.Ja.rmdir,readdir:P.Ja.readdir,symlink:P.Ja.symlink},stream:{Va:P.Ka.Va}},file:{node:{Qa:P.Ja.Qa,Pa:P.Ja.Pa},stream:{Va:P.Ka.Va,read:P.Ka.read,write:P.Ka.write,jb:P.Ka.jb,$a:P.Ka.$a,ab:P.Ka.ab}},link:{node:{Qa:P.Ja.Qa,Pa:P.Ja.Pa,readlink:P.Ja.readlink},stream:{}},lb:{node:{Qa:P.Ja.Qa,
|
||||
Pa:P.Ja.Pa},stream:Nb}});c=Ob(a,b,c,d);R(c.mode)?(c.Ja=P.Ra.dir.node,c.Ka=P.Ra.dir.stream,c.Ia={}):32768===(c.mode&61440)?(c.Ja=P.Ra.file.node,c.Ka=P.Ra.file.stream,c.Oa=0,c.Ia=null):40960===(c.mode&61440)?(c.Ja=P.Ra.link.node,c.Ka=P.Ra.link.stream):8192===(c.mode&61440)&&(c.Ja=P.Ra.lb.node,c.Ka=P.Ra.lb.stream);c.timestamp=Date.now();a&&(a.Ia[b]=c);return c},Jb:function(a){if(a.Ia&&a.Ia.subarray){for(var b=[],c=0;c<a.Oa;++c)b.push(a.Ia[c]);return b}return a.Ia},Kb:function(a){return a.Ia?a.Ia.subarray?
|
||||
a.Ia.subarray(0,a.Oa):new Uint8Array(a.Ia):new Uint8Array(0)},mb:function(a,b){var c=a.Ia?a.Ia.length:0;c>=b||(b=Math.max(b,c*(1048576>c?2:1.125)>>>0),0!=c&&(b=Math.max(b,256)),c=a.Ia,a.Ia=new Uint8Array(b),0<a.Oa&&a.Ia.set(c.subarray(0,a.Oa),0))},Gb:function(a,b){if(a.Oa!=b)if(0==b)a.Ia=null,a.Oa=0;else{if(!a.Ia||a.Ia.subarray){var c=a.Ia;a.Ia=new Uint8Array(b);c&&a.Ia.set(c.subarray(0,Math.min(b,a.Oa)))}else if(a.Ia||(a.Ia=[]),a.Ia.length>b)a.Ia.length=b;else for(;a.Ia.length<b;)a.Ia.push(0);a.Oa=
|
||||
b}},Ja:{Qa:function(a){var b={};b.dev=8192===(a.mode&61440)?a.id:1;b.ino=a.id;b.mode=a.mode;b.nlink=1;b.uid=0;b.gid=0;b.rdev=a.rdev;R(a.mode)?b.size=4096:32768===(a.mode&61440)?b.size=a.Oa:40960===(a.mode&61440)?b.size=a.link.length:b.size=0;b.atime=new Date(a.timestamp);b.mtime=new Date(a.timestamp);b.ctime=new Date(a.timestamp);b.xb=4096;b.blocks=Math.ceil(b.size/b.xb);return b},Pa:function(a,b){void 0!==b.mode&&(a.mode=b.mode);void 0!==b.timestamp&&(a.timestamp=b.timestamp);void 0!==b.size&&P.Gb(a,
|
||||
b.size)},lookup:function(){throw Pb[44];},Za:function(a,b,c,d){return P.createNode(a,b,c,d)},rename:function(a,b,c){if(R(a.mode)){try{var d=Qb(b,c)}catch(g){}if(d)for(var f in d.Ia)throw new O(55);}delete a.parent.Ia[a.name];a.name=c;b.Ia[c]=a;a.parent=b},unlink:function(a,b){delete a.Ia[b]},rmdir:function(a,b){var c=Qb(a,b),d;for(d in c.Ia)throw new O(55);delete a.Ia[b]},readdir:function(a){var b=[".",".."],c;for(c in a.Ia)a.Ia.hasOwnProperty(c)&&b.push(c);return b},symlink:function(a,b,c){a=P.createNode(a,
|
||||
b,41471,0);a.link=c;return a},readlink:function(a){if(40960!==(a.mode&61440))throw new O(28);return a.link}},Ka:{read:function(a,b,c,d,f){var g=a.node.Ia;if(f>=a.node.Oa)return 0;a=Math.min(a.node.Oa-f,d);if(8<a&&g.subarray)b.set(g.subarray(f,f+a),c);else for(d=0;d<a;d++)b[c+d]=g[f+d];return a},write:function(a,b,c,d,f,g){b.buffer===x.buffer&&(g=!1);if(!d)return 0;a=a.node;a.timestamp=Date.now();if(b.subarray&&(!a.Ia||a.Ia.subarray)){if(g)return a.Ia=b.subarray(c,c+d),a.Oa=d;if(0===a.Oa&&0===f)return a.Ia=
|
||||
b.slice(c,c+d),a.Oa=d;if(f+d<=a.Oa)return a.Ia.set(b.subarray(c,c+d),f),d}P.mb(a,f+d);if(a.Ia.subarray&&b.subarray)a.Ia.set(b.subarray(c,c+d),f);else for(g=0;g<d;g++)a.Ia[f+g]=b[c+g];a.Oa=Math.max(a.Oa,f+d);return d},Va:function(a,b,c){1===c?b+=a.position:2===c&&32768===(a.node.mode&61440)&&(b+=a.node.Oa);if(0>b)throw new O(28);return b},jb:function(a,b,c){P.mb(a.node,b+c);a.node.Oa=Math.max(a.node.Oa,b+c)},$a:function(a,b,c,d,f,g,n){if(32768!==(a.node.mode&61440))throw new O(43);a=a.node.Ia;if(n&
|
||||
2||a.buffer!==b.buffer){if(0<f||f+d<a.length)a.subarray?a=a.subarray(f,f+d):a=Array.prototype.slice.call(a,f,f+d);f=!0;n=b.buffer==x.buffer;d=$a(d);if(!d)throw new O(48);(n?x:b).set(a,d)}else f=!1,d=a.byteOffset;return{Fb:d,cb:f}},ab:function(a,b,c,d,f){if(32768!==(a.node.mode&61440))throw new O(43);if(f&2)return 0;P.Ka.write(a,b,0,d,c,!1);return 0}}},Rb=null,Sb={},T=[],Tb=1,U=null,Ub=!0,V={},O=null,Pb={};
|
||||
function W(a,b){a=Gb("/",a);b=b||{};if(!a)return{path:"",node:null};var c={nb:!0,ib:0},d;for(d in c)void 0===b[d]&&(b[d]=c[d]);if(8<b.ib)throw new O(32);a=Ab(a.split("/").filter(function(n){return!!n}),!1);var f=Rb;c="/";for(d=0;d<a.length;d++){var g=d===a.length-1;if(g&&b.parent)break;f=Qb(f,a[d]);c=k(c+"/"+a[d]);f.Wa&&(!g||g&&b.nb)&&(f=f.Wa.root);if(!g||b.Ua)for(g=0;40960===(f.mode&61440);)if(f=Vb(c),c=Gb(Bb(c),f),f=W(c,{ib:b.ib}).node,40<g++)throw new O(32);}return{path:c,node:f}}
|
||||
function Wb(a){for(var b;;){if(a===a.parent)return a=a.Sa.pb,b?"/"!==a[a.length-1]?a+"/"+b:a+b:a;b=b?a.name+"/"+b:a.name;a=a.parent}}function Xb(a,b){for(var c=0,d=0;d<b.length;d++)c=(c<<5)-c+b.charCodeAt(d)|0;return(a+c>>>0)%U.length}function Yb(a){var b=Xb(a.parent.id,a.name);if(U[b]===a)U[b]=a.Xa;else for(b=U[b];b;){if(b.Xa===a){b.Xa=a.Xa;break}b=b.Xa}}
|
||||
function Qb(a,b){var c;if(c=(c=Zb(a,"x"))?c:a.Ja.lookup?0:2)throw new O(c,a);for(c=U[Xb(a.id,b)];c;c=c.Xa){var d=c.name;if(c.parent.id===a.id&&d===b)return c}return a.Ja.lookup(a,b)}function Ob(a,b,c,d){a=new $b(a,b,c,d);b=Xb(a.parent.id,a.name);a.Xa=U[b];return U[b]=a}function R(a){return 16384===(a&61440)}var ac={r:0,rs:1052672,"r+":2,w:577,wx:705,xw:705,"w+":578,"wx+":706,"xw+":706,a:1089,ax:1217,xa:1217,"a+":1090,"ax+":1218,"xa+":1218};
|
||||
function bc(a){var b=["r","w","rw"][a&3];a&512&&(b+="w");return b}function Zb(a,b){if(Ub)return 0;if(-1===b.indexOf("r")||a.mode&292){if(-1!==b.indexOf("w")&&!(a.mode&146)||-1!==b.indexOf("x")&&!(a.mode&73))return 2}else return 2;return 0}function cc(a,b){try{return Qb(a,b),20}catch(c){}return Zb(a,"wx")}function dc(a,b,c){try{var d=Qb(a,b)}catch(f){return f.La}if(a=Zb(a,"wx"))return a;if(c){if(!R(d.mode))return 54;if(d===d.parent||"/"===Wb(d))return 10}else if(R(d.mode))return 31;return 0}
|
||||
function ec(a){var b=4096;for(a=a||0;a<=b;a++)if(!T[a])return a;throw new O(33);}function fc(a,b){hc||(hc=function(){},hc.prototype={});var c=new hc,d;for(d in a)c[d]=a[d];a=c;b=ec(b);a.fd=b;return T[b]=a}var Nb={open:function(a){a.Ka=Sb[a.node.rdev].Ka;a.Ka.open&&a.Ka.open(a)},Va:function(){throw new O(70);}};function Jb(a,b){Sb[a]={Ka:b}}
|
||||
function ic(a,b){var c="/"===b,d=!b;if(c&&Rb)throw new O(10);if(!c&&!d){var f=W(b,{nb:!1});b=f.path;f=f.node;if(f.Wa)throw new O(10);if(!R(f.mode))throw new O(54);}b={type:a,Lb:{},pb:b,Db:[]};a=a.Sa(b);a.Sa=b;b.root=a;c?Rb=a:f&&(f.Wa=b,f.Sa&&f.Sa.Db.push(b))}function ba(a,b,c){var d=W(a,{parent:!0}).node;a=Cb(a);if(!a||"."===a||".."===a)throw new O(28);var f=cc(d,a);if(f)throw new O(f);if(!d.Ja.Za)throw new O(63);return d.Ja.Za(d,a,b,c)}function X(a,b){ba(a,(void 0!==b?b:511)&1023|16384,0)}
|
||||
function jc(a,b,c){"undefined"===typeof c&&(c=b,b=438);ba(a,b|8192,c)}function kc(a,b){if(!Gb(a))throw new O(44);var c=W(b,{parent:!0}).node;if(!c)throw new O(44);b=Cb(b);var d=cc(c,b);if(d)throw new O(d);if(!c.Ja.symlink)throw new O(63);c.Ja.symlink(c,b,a)}
|
||||
function ta(a){var b=W(a,{parent:!0}).node,c=Cb(a),d=Qb(b,c),f=dc(b,c,!1);if(f)throw new O(f);if(!b.Ja.unlink)throw new O(63);if(d.Wa)throw new O(10);try{V.willDeletePath&&V.willDeletePath(a)}catch(g){E("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+g.message)}b.Ja.unlink(b,c);Yb(d);try{if(V.onDeletePath)V.onDeletePath(a)}catch(g){E("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+g.message)}}
|
||||
function Vb(a){a=W(a).node;if(!a)throw new O(44);if(!a.Ja.readlink)throw new O(28);return Gb(Wb(a.parent),a.Ja.readlink(a))}function lc(a,b){a=W(a,{Ua:!b}).node;if(!a)throw new O(44);if(!a.Ja.Qa)throw new O(63);return a.Ja.Qa(a)}function mc(a){return lc(a,!0)}function ca(a,b){var c;"string"===typeof a?c=W(a,{Ua:!0}).node:c=a;if(!c.Ja.Pa)throw new O(63);c.Ja.Pa(c,{mode:b&4095|c.mode&-4096,timestamp:Date.now()})}
|
||||
function nc(a){var b;"string"===typeof a?b=W(a,{Ua:!0}).node:b=a;if(!b.Ja.Pa)throw new O(63);b.Ja.Pa(b,{timestamp:Date.now()})}function oc(a,b){if(0>b)throw new O(28);var c;"string"===typeof a?c=W(a,{Ua:!0}).node:c=a;if(!c.Ja.Pa)throw new O(63);if(R(c.mode))throw new O(31);if(32768!==(c.mode&61440))throw new O(28);if(a=Zb(c,"w"))throw new O(a);c.Ja.Pa(c,{size:b,timestamp:Date.now()})}
|
||||
function l(a,b,c,d){if(""===a)throw new O(44);if("string"===typeof b){var f=ac[b];if("undefined"===typeof f)throw Error("Unknown file open mode: "+b);b=f}c=b&64?("undefined"===typeof c?438:c)&4095|32768:0;if("object"===typeof a)var g=a;else{a=k(a);try{g=W(a,{Ua:!(b&131072)}).node}catch(n){}}f=!1;if(b&64)if(g){if(b&128)throw new O(20);}else g=ba(a,c,0),f=!0;if(!g)throw new O(44);8192===(g.mode&61440)&&(b&=-513);if(b&65536&&!R(g.mode))throw new O(54);if(!f&&(c=g?40960===(g.mode&61440)?32:R(g.mode)&&
|
||||
("r"!==bc(b)||b&512)?31:Zb(g,bc(b)):44))throw new O(c);b&512&&oc(g,0);b&=-131713;d=fc({node:g,path:Wb(g),flags:b,seekable:!0,position:0,Ka:g.Ka,Ib:[],error:!1},d);d.Ka.open&&d.Ka.open(d);!e.logReadFiles||b&1||(pc||(pc={}),a in pc||(pc[a]=1,E("FS.trackingDelegate error on read file: "+a)));try{V.onOpenFile&&(g=0,1!==(b&2097155)&&(g|=1),0!==(b&2097155)&&(g|=2),V.onOpenFile(a,g))}catch(n){E("FS.trackingDelegate['onOpenFile']('"+a+"', flags) threw an exception: "+n.message)}return d}
|
||||
function ea(a){if(null===a.fd)throw new O(8);a.gb&&(a.gb=null);try{a.Ka.close&&a.Ka.close(a)}catch(b){throw b;}finally{T[a.fd]=null}a.fd=null}function qc(a,b,c){if(null===a.fd)throw new O(8);if(!a.seekable||!a.Ka.Va)throw new O(70);if(0!=c&&1!=c&&2!=c)throw new O(28);a.position=a.Ka.Va(a,b,c);a.Ib=[]}
|
||||
function rc(a,b,c,d,f){if(0>d||0>f)throw new O(28);if(null===a.fd)throw new O(8);if(1===(a.flags&2097155))throw new O(8);if(R(a.node.mode))throw new O(31);if(!a.Ka.read)throw new O(28);var g="undefined"!==typeof f;if(!g)f=a.position;else if(!a.seekable)throw new O(70);b=a.Ka.read(a,b,c,d,f);g||(a.position+=b);return b}
|
||||
function da(a,b,c,d,f,g){if(0>d||0>f)throw new O(28);if(null===a.fd)throw new O(8);if(0===(a.flags&2097155))throw new O(8);if(R(a.node.mode))throw new O(31);if(!a.Ka.write)throw new O(28);a.seekable&&a.flags&1024&&qc(a,0,2);var n="undefined"!==typeof f;if(!n)f=a.position;else if(!a.seekable)throw new O(70);b=a.Ka.write(a,b,c,d,f,g);n||(a.position+=b);try{if(a.path&&V.onWriteToFile)V.onWriteToFile(a.path)}catch(r){E("FS.trackingDelegate['onWriteToFile']('"+a.path+"') threw an exception: "+r.message)}return b}
|
||||
function sa(a){var b={encoding:"binary"};b=b||{};b.flags=b.flags||"r";b.encoding=b.encoding||"binary";if("utf8"!==b.encoding&&"binary"!==b.encoding)throw Error('Invalid encoding type "'+b.encoding+'"');var c,d=l(a,b.flags);a=lc(a).size;var f=new Uint8Array(a);rc(d,f,0,a,0);"utf8"===b.encoding?c=bb(f,0):"binary"===b.encoding&&(c=f);ea(d);return c}
|
||||
function sc(){O||(O=function(a,b){this.node=b;this.Hb=function(c){this.La=c};this.Hb(a);this.message="FS error"},O.prototype=Error(),O.prototype.constructor=O,[44].forEach(function(a){Pb[a]=new O(a);Pb[a].stack="<generic error, no stack>"}))}var tc;function aa(a,b){var c=0;a&&(c|=365);b&&(c|=146);return c}
|
||||
function Rc(a,b,c){a=k("/dev/"+a);var d=aa(!!b,!!c);Sc||(Sc=64);var f=Sc++<<8|0;Jb(f,{open:function(g){g.seekable=!1},close:function(){c&&c.buffer&&c.buffer.length&&c(10)},read:function(g,n,r,w){for(var u=0,C=0;C<w;C++){try{var H=b()}catch(ma){throw new O(29);}if(void 0===H&&0===u)throw new O(6);if(null===H||void 0===H)break;u++;n[r+C]=H}u&&(g.node.timestamp=Date.now());return u},write:function(g,n,r,w){for(var u=0;u<w;u++)try{c(n[r+u])}catch(C){throw new O(29);}w&&(g.node.timestamp=Date.now());return u}});
|
||||
jc(a,d,f)}var Sc,Y={},hc,pc,Uc={};
|
||||
function Vc(a,b,c){try{var d=a(b)}catch(f){if(f&&f.node&&k(b)!==k(Wb(f.node)))return-54;throw f;}G[c>>2]=d.dev;G[c+4>>2]=0;G[c+8>>2]=d.ino;G[c+12>>2]=d.mode;G[c+16>>2]=d.nlink;G[c+20>>2]=d.uid;G[c+24>>2]=d.gid;G[c+28>>2]=d.rdev;G[c+32>>2]=0;J=[d.size>>>0,(K=d.size,1<=+Oa(K)?0<K?(Pa(+Qa(K/4294967296),4294967295)|0)>>>0:~~+Ra((K-+(~~K>>>0))/4294967296)>>>0:0)];G[c+40>>2]=J[0];G[c+44>>2]=J[1];G[c+48>>2]=4096;G[c+52>>2]=d.blocks;G[c+56>>2]=d.atime.getTime()/1E3|0;G[c+60>>2]=0;G[c+64>>2]=d.mtime.getTime()/
|
||||
1E3|0;G[c+68>>2]=0;G[c+72>>2]=d.ctime.getTime()/1E3|0;G[c+76>>2]=0;J=[d.ino>>>0,(K=d.ino,1<=+Oa(K)?0<K?(Pa(+Qa(K/4294967296),4294967295)|0)>>>0:~~+Ra((K-+(~~K>>>0))/4294967296)>>>0:0)];G[c+80>>2]=J[0];G[c+84>>2]=J[1];return 0}var Wc=void 0;function Xc(){Wc+=4;return G[Wc-4>>2]}function Z(a){a=T[a];if(!a)throw new O(8);return a}var Yc={};
|
||||
function Zc(){if(!$c){var a={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"===typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:xa||"./this.program"},b;for(b in Yc)a[b]=Yc[b];var c=[];for(b in a)c.push(b+"="+a[b]);$c=c}return $c}var $c;la("GMT",L,63120,4);
|
||||
function ad(){function a(g){return(g=g.toTimeString().match(/\(([A-Za-z ]+)\)$/))?g[1]:"GMT"}if(!bd){bd=!0;G[cd()>>2]=60*(new Date).getTimezoneOffset();var b=(new Date).getFullYear(),c=new Date(b,0,1);b=new Date(b,6,1);G[dd()>>2]=Number(c.getTimezoneOffset()!=b.getTimezoneOffset());var d=a(c),f=a(b);d=cb(d);f=cb(f);b.getTimezoneOffset()<c.getTimezoneOffset()?(G[ed()>>2]=d,G[ed()+4>>2]=f):(G[ed()>>2]=f,G[ed()+4>>2]=d)}}var bd,fd;
|
||||
Aa?fd=function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E6}:"undefined"!==typeof dateNow?fd=dateNow:fd=function(){return performance.now()};function gd(a){for(var b=fd();fd()-b<a/1E3;);}e._usleep=gd;function $b(a,b,c,d){a||(a=this);this.parent=a;this.Sa=a.Sa;this.Wa=null;this.id=Tb++;this.name=b;this.mode=c;this.Ja={};this.Ka={};this.rdev=d}
|
||||
Object.defineProperties($b.prototype,{read:{get:function(){return 365===(this.mode&365)},set:function(a){a?this.mode|=365:this.mode&=-366}},write:{get:function(){return 146===(this.mode&146)},set:function(a){a?this.mode|=146:this.mode&=-147}}});sc();U=Array(4096);ic(P,"/");X("/tmp");X("/home");X("/home/web_user");
|
||||
(function(){X("/dev");Jb(259,{read:function(){return 0},write:function(d,f,g,n){return n}});jc("/dev/null",259);Ib(1280,Lb);Ib(1536,Mb);jc("/dev/tty",1280);jc("/dev/tty1",1536);if("object"===typeof crypto&&"function"===typeof crypto.getRandomValues){var a=new Uint8Array(1);var b=function(){crypto.getRandomValues(a);return a[0]}}else if(Aa)try{var c=require("crypto");b=function(){return c.randomBytes(1)[0]}}catch(d){}b||(b=function(){D("random_device")});Rc("random",b);Rc("urandom",b);X("/dev/shm");
|
||||
X("/dev/shm/tmp")})();X("/proc");X("/proc/self");X("/proc/self/fd");ic({Sa:function(){var a=Ob("/proc/self","fd",16895,73);a.Ja={lookup:function(b,c){var d=T[+c];if(!d)throw new O(8);b={parent:null,Sa:{pb:"fake"},Ja:{readlink:function(){return d.path}}};return b.parent=b}};return a}},"/proc/self/fd");function fa(a,b){var c=Array(ka(a)+1);a=la(a,c,0,c.length);b&&(c.length=a);return c}
|
||||
var jd={a:function(a,b,c,d){D("Assertion failed: "+N(a)+", at: "+[b?N(b):"unknown filename",c,d?N(d):"unknown function"])},j:function(a,b){try{a=N(a);if(b&-8)var c=-28;else{var d;(d=W(a,{Ua:!0}).node)?(a="",b&4&&(a+="r"),b&2&&(a+="w"),b&1&&(a+="x"),c=a&&Zb(d,a)?-2:0):c=-44}return c}catch(f){return"undefined"!==typeof Y&&f instanceof O||D(f),-f.La}},v:function(a,b){try{return a=N(a),ca(a,b),0}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),-c.La}},G:function(a){try{return a=N(a),nc(a),
|
||||
0}catch(b){return"undefined"!==typeof Y&&b instanceof O||D(b),-b.La}},w:function(a,b){try{var c=T[a];if(!c)throw new O(8);ca(c.node,b);return 0}catch(d){return"undefined"!==typeof Y&&d instanceof O||D(d),-d.La}},H:function(a){try{var b=T[a];if(!b)throw new O(8);nc(b.node);return 0}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),-c.La}},b:function(a,b,c){Wc=c;try{var d=Z(a);switch(b){case 0:var f=Xc();return 0>f?-28:l(d.path,d.flags,0,f).fd;case 1:case 2:return 0;case 3:return d.flags;
|
||||
case 4:return f=Xc(),d.flags|=f,0;case 12:return f=Xc(),Na[f+0>>1]=2,0;case 13:case 14:return 0;case 16:case 8:return-28;case 9:return Eb(28),-1;default:return-28}}catch(g){return"undefined"!==typeof Y&&g instanceof O||D(g),-g.La}},t:function(a,b){try{var c=Z(a);return Vc(lc,c.path,b)}catch(d){return"undefined"!==typeof Y&&d instanceof O||D(d),-d.La}},J:function(a,b,c){try{var d=T[a];if(!d)throw new O(8);if(0===(d.flags&2097155))throw new O(28);oc(d.node,c);return 0}catch(f){return"undefined"!==typeof Y&&
|
||||
f instanceof O||D(f),-f.La}},F:function(a,b){try{if(0===b)return-28;if(b<ka("/")+1)return-68;la("/",L,a,b);return a}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),-c.La}},C:function(){return 0},d:function(){return 42},u:function(a,b){try{return a=N(a),Vc(mc,a,b)}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),-c.La}},x:function(a,b){try{return a=N(a),a=k(a),"/"===a[a.length-1]&&(a=a.substr(0,a.length-1)),X(a,b),0}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),
|
||||
-c.La}},s:function(a,b,c,d,f,g){try{a:{g<<=12;var n=!1;if(0!==(d&16)&&0!==a%16384)var r=-28;else{if(0!==(d&32)){var w=hd(16384,b);if(!w){r=-48;break a}id(w,0,b);n=!0}else{var u=T[f];if(!u){r=-8;break a}var C=g,H=L;if(0!==(c&2)&&0===(d&2)&&2!==(u.flags&2097155))throw new O(2);if(1===(u.flags&2097155))throw new O(2);if(!u.Ka.$a)throw new O(43);var ma=u.Ka.$a(u,H,a,b,C,c,d);w=ma.Fb;n=ma.cb}Uc[w]={Cb:w,Bb:b,cb:n,fd:f,Eb:c,flags:d,offset:g};r=w}}return r}catch(na){return"undefined"!==typeof Y&&na instanceof
|
||||
O||D(na),-na.La}},q:function(a,b){try{if(-1===(a|0)||0===b)var c=-28;else{var d=Uc[a];if(d&&b===d.Bb){var f=T[d.fd];if(d.Eb&2){var g=d.flags,n=d.offset,r=L.slice(a,a+b);f&&f.Ka.ab&&f.Ka.ab(f,r,n,b,g)}Uc[a]=null;d.cb&&ia(d.Cb)}c=0}return c}catch(w){return"undefined"!==typeof Y&&w instanceof O||D(w),-w.La}},y:function(a,b,c){Wc=c;try{var d=N(a),f=Xc();return l(d,b,f).fd}catch(g){return"undefined"!==typeof Y&&g instanceof O||D(g),-g.La}},B:function(a,b,c){try{var d=Z(a);return rc(d,x,b,c)}catch(f){return"undefined"!==
|
||||
typeof Y&&f instanceof O||D(f),-f.La}},I:function(a,b,c){try{a=N(a);if(0>=c)var d=-28;else{var f=Vb(a),g=Math.min(c,ka(f)),n=x[b+g];la(f,L,b,c+1);x[b+g]=n;d=g}return d}catch(r){return"undefined"!==typeof Y&&r instanceof O||D(r),-r.La}},D:function(a){try{a=N(a);var b=W(a,{parent:!0}).node,c=Cb(a),d=Qb(b,c),f=dc(b,c,!0);if(f)throw new O(f);if(!b.Ja.rmdir)throw new O(63);if(d.Wa)throw new O(10);try{V.willDeletePath&&V.willDeletePath(a)}catch(g){E("FS.trackingDelegate['willDeletePath']('"+a+"') threw an exception: "+
|
||||
g.message)}b.Ja.rmdir(b,c);Yb(d);try{if(V.onDeletePath)V.onDeletePath(a)}catch(g){E("FS.trackingDelegate['onDeletePath']('"+a+"') threw an exception: "+g.message)}return 0}catch(g){return"undefined"!==typeof Y&&g instanceof O||D(g),-g.La}},e:function(a,b){try{return a=N(a),Vc(lc,a,b)}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),-c.La}},h:function(a){try{return a=N(a),ta(a),0}catch(b){return"undefined"!==typeof Y&&b instanceof O||D(b),-b.La}},m:function(a,b,c){L.copyWithin(a,b,b+c)},
|
||||
c:function(a){a>>>=0;var b=L.length;if(2147483648<a)return!1;for(var c=1;4>=c;c*=2){var d=b*(1+.2/c);d=Math.min(d,a+100663296);d=Math.max(16777216,a,d);0<d%65536&&(d+=65536-d%65536);a:{try{Ua.grow(Math.min(2147483648,d)-db.byteLength+65535>>>16);eb(Ua.buffer);var f=1;break a}catch(g){}f=void 0}if(f)return!0}return!1},o:function(a,b){var c=0;Zc().forEach(function(d,f){var g=b+c;f=G[a+4*f>>2]=g;for(g=0;g<d.length;++g)x[f++>>0]=d.charCodeAt(g);x[f>>0]=0;c+=d.length+1});return 0},p:function(a,b){var c=
|
||||
Zc();G[a>>2]=c.length;var d=0;c.forEach(function(f){d+=f.length+1});G[b>>2]=d;return 0},f:function(a){try{var b=Z(a);ea(b);return 0}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),c.La}},n:function(a,b){try{var c=Z(a);x[b>>0]=c.tty?2:R(c.mode)?3:40960===(c.mode&61440)?7:4;return 0}catch(d){return"undefined"!==typeof Y&&d instanceof O||D(d),d.La}},l:function(a,b,c,d,f){try{var g=Z(a);a=4294967296*c+(b>>>0);if(-9007199254740992>=a||9007199254740992<=a)return-61;qc(g,a,d);J=[g.position>>>
|
||||
0,(K=g.position,1<=+Oa(K)?0<K?(Pa(+Qa(K/4294967296),4294967295)|0)>>>0:~~+Ra((K-+(~~K>>>0))/4294967296)>>>0:0)];G[f>>2]=J[0];G[f+4>>2]=J[1];g.gb&&0===a&&0===d&&(g.gb=null);return 0}catch(n){return"undefined"!==typeof Y&&n instanceof O||D(n),n.La}},E:function(a){try{var b=Z(a);return b.Ka&&b.Ka.fsync?-b.Ka.fsync(b):0}catch(c){return"undefined"!==typeof Y&&c instanceof O||D(c),c.La}},i:function(a,b,c,d){try{a:{for(var f=Z(a),g=a=0;g<c;g++){var n=da(f,x,G[b+8*g>>2],G[b+(8*g+4)>>2],void 0);if(0>n){var r=
|
||||
-1;break a}a+=n}r=a}G[d>>2]=r;return 0}catch(w){return"undefined"!==typeof Y&&w instanceof O||D(w),w.La}},g:function(a){var b=Date.now();G[a>>2]=b/1E3|0;G[a+4>>2]=b%1E3*1E3|0;return 0},k:function(a){ad();a=new Date(1E3*G[a>>2]);G[15768]=a.getSeconds();G[15769]=a.getMinutes();G[15770]=a.getHours();G[15771]=a.getDate();G[15772]=a.getMonth();G[15773]=a.getFullYear()-1900;G[15774]=a.getDay();var b=new Date(a.getFullYear(),0,1);G[15775]=(a.getTime()-b.getTime())/864E5|0;G[15777]=-(60*a.getTimezoneOffset());
|
||||
var c=(new Date(a.getFullYear(),6,1)).getTimezoneOffset();b=b.getTimezoneOffset();a=(c!=b&&a.getTimezoneOffset()==Math.min(b,c))|0;G[15776]=a;a=G[ed()+(a?4:0)>>2];G[15778]=a;return 63072},memory:Ua,z:function(a,b){if(0===a)return Eb(28),-1;var c=G[a>>2];a=G[a+4>>2];if(0>a||999999999<a||0>c)return Eb(28),-1;0!==b&&(G[b>>2]=0,G[b+4>>2]=0);return gd(1E6*c+a/1E3)},A:function(a){switch(a){case 30:return 16384;case 85:return 131072;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:case 79:return 200809;
|
||||
case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;
|
||||
case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1E3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"===typeof navigator?navigator.hardwareConcurrency||1:1}Eb(28);return-1},
|
||||
table:I,K:function(a){var b=Date.now()/1E3|0;a&&(G[a>>2]=b);return b},r:function(a,b){if(b){var c=1E3*G[b+8>>2];c+=G[b+12>>2]/1E3}else c=Date.now();a=N(a);try{b=c;var d=W(a,{Ua:!0}).node;d.Ja.Pa(d,{timestamp:Math.max(b,c)});return 0}catch(f){a=f;if(!(a instanceof O)){a+=" : ";a:{d=Error();if(!d.stack){try{throw Error();}catch(g){d=g}if(!d.stack){d="(no stack trace available)";break a}}d=d.stack.toString()}e.extraStackTrace&&(d+="\n"+e.extraStackTrace());d=zb(d);throw a+d;}Eb(a.La);return-1}}},kd=
|
||||
function(){function a(f){e.asm=f.exports;mb--;e.monitorRunDependencies&&e.monitorRunDependencies(mb);0==mb&&(null!==nb&&(clearInterval(nb),nb=null),ob&&(f=ob,ob=null,f()))}function b(f){a(f.instance)}function c(f){return ub().then(function(g){return WebAssembly.instantiate(g,d)}).then(f,function(g){E("failed to asynchronously prepare wasm: "+g);D(g)})}var d={a:jd};mb++;e.monitorRunDependencies&&e.monitorRunDependencies(mb);if(e.instantiateWasm)try{return e.instantiateWasm(d,a)}catch(f){return E("Module.instantiateWasm callback failed with error: "+
|
||||
f),!1}(function(){if(Ma||"function"!==typeof WebAssembly.instantiateStreaming||rb()||pb("file://")||"function"!==typeof fetch)return c(b);fetch(qb,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,d).then(b,function(g){E("wasm streaming compile failed: "+g);E("falling back to ArrayBuffer instantiation");c(b)})})})();return{}}();e.asm=kd;
|
||||
var vb=e.___wasm_call_ctors=function(){return(vb=e.___wasm_call_ctors=e.asm.L).apply(null,arguments)},id=e._memset=function(){return(id=e._memset=e.asm.M).apply(null,arguments)};e._sqlite3_free=function(){return(e._sqlite3_free=e.asm.N).apply(null,arguments)};var Fb=e.___errno_location=function(){return(Fb=e.___errno_location=e.asm.O).apply(null,arguments)};e._sqlite3_finalize=function(){return(e._sqlite3_finalize=e.asm.P).apply(null,arguments)};
|
||||
e._sqlite3_reset=function(){return(e._sqlite3_reset=e.asm.Q).apply(null,arguments)};e._sqlite3_clear_bindings=function(){return(e._sqlite3_clear_bindings=e.asm.R).apply(null,arguments)};e._sqlite3_value_blob=function(){return(e._sqlite3_value_blob=e.asm.S).apply(null,arguments)};e._sqlite3_value_text=function(){return(e._sqlite3_value_text=e.asm.T).apply(null,arguments)};e._sqlite3_value_bytes=function(){return(e._sqlite3_value_bytes=e.asm.U).apply(null,arguments)};
|
||||
e._sqlite3_value_double=function(){return(e._sqlite3_value_double=e.asm.V).apply(null,arguments)};e._sqlite3_value_int=function(){return(e._sqlite3_value_int=e.asm.W).apply(null,arguments)};e._sqlite3_value_type=function(){return(e._sqlite3_value_type=e.asm.X).apply(null,arguments)};e._sqlite3_result_blob=function(){return(e._sqlite3_result_blob=e.asm.Y).apply(null,arguments)};e._sqlite3_result_double=function(){return(e._sqlite3_result_double=e.asm.Z).apply(null,arguments)};
|
||||
e._sqlite3_result_error=function(){return(e._sqlite3_result_error=e.asm._).apply(null,arguments)};e._sqlite3_result_int=function(){return(e._sqlite3_result_int=e.asm.$).apply(null,arguments)};e._sqlite3_result_int64=function(){return(e._sqlite3_result_int64=e.asm.aa).apply(null,arguments)};e._sqlite3_result_null=function(){return(e._sqlite3_result_null=e.asm.ba).apply(null,arguments)};e._sqlite3_result_text=function(){return(e._sqlite3_result_text=e.asm.ca).apply(null,arguments)};
|
||||
e._sqlite3_step=function(){return(e._sqlite3_step=e.asm.da).apply(null,arguments)};e._sqlite3_data_count=function(){return(e._sqlite3_data_count=e.asm.ea).apply(null,arguments)};e._sqlite3_column_blob=function(){return(e._sqlite3_column_blob=e.asm.fa).apply(null,arguments)};e._sqlite3_column_bytes=function(){return(e._sqlite3_column_bytes=e.asm.ga).apply(null,arguments)};e._sqlite3_column_double=function(){return(e._sqlite3_column_double=e.asm.ha).apply(null,arguments)};
|
||||
e._sqlite3_column_text=function(){return(e._sqlite3_column_text=e.asm.ia).apply(null,arguments)};e._sqlite3_column_type=function(){return(e._sqlite3_column_type=e.asm.ja).apply(null,arguments)};e._sqlite3_column_name=function(){return(e._sqlite3_column_name=e.asm.ka).apply(null,arguments)};e._sqlite3_bind_blob=function(){return(e._sqlite3_bind_blob=e.asm.la).apply(null,arguments)};e._sqlite3_bind_double=function(){return(e._sqlite3_bind_double=e.asm.ma).apply(null,arguments)};
|
||||
e._sqlite3_bind_int=function(){return(e._sqlite3_bind_int=e.asm.na).apply(null,arguments)};e._sqlite3_bind_text=function(){return(e._sqlite3_bind_text=e.asm.oa).apply(null,arguments)};e._sqlite3_bind_parameter_index=function(){return(e._sqlite3_bind_parameter_index=e.asm.pa).apply(null,arguments)};e._sqlite3_errmsg=function(){return(e._sqlite3_errmsg=e.asm.qa).apply(null,arguments)};e._sqlite3_exec=function(){return(e._sqlite3_exec=e.asm.ra).apply(null,arguments)};
|
||||
e._sqlite3_prepare_v2=function(){return(e._sqlite3_prepare_v2=e.asm.sa).apply(null,arguments)};e._sqlite3_changes=function(){return(e._sqlite3_changes=e.asm.ta).apply(null,arguments)};e._sqlite3_close_v2=function(){return(e._sqlite3_close_v2=e.asm.ua).apply(null,arguments)};e._sqlite3_create_function_v2=function(){return(e._sqlite3_create_function_v2=e.asm.va).apply(null,arguments)};e._sqlite3_open=function(){return(e._sqlite3_open=e.asm.wa).apply(null,arguments)};
|
||||
var $a=e._malloc=function(){return($a=e._malloc=e.asm.xa).apply(null,arguments)},ia=e._free=function(){return(ia=e._free=e.asm.ya).apply(null,arguments)};e._RegisterExtensionFunctions=function(){return(e._RegisterExtensionFunctions=e.asm.za).apply(null,arguments)};
|
||||
var ed=e.__get_tzname=function(){return(ed=e.__get_tzname=e.asm.Aa).apply(null,arguments)},dd=e.__get_daylight=function(){return(dd=e.__get_daylight=e.asm.Ba).apply(null,arguments)},cd=e.__get_timezone=function(){return(cd=e.__get_timezone=e.asm.Ca).apply(null,arguments)},hd=e._memalign=function(){return(hd=e._memalign=e.asm.Da).apply(null,arguments)},ja=e.stackSave=function(){return(ja=e.stackSave=e.asm.Ea).apply(null,arguments)},t=e.stackAlloc=function(){return(t=e.stackAlloc=e.asm.Fa).apply(null,
|
||||
arguments)},qa=e.stackRestore=function(){return(qa=e.stackRestore=e.asm.Ga).apply(null,arguments)};e.dynCall_vi=function(){return(e.dynCall_vi=e.asm.Ha).apply(null,arguments)};e.asm=kd;e.cwrap=function(a,b,c,d){c=c||[];var f=c.every(function(g){return"number"===g});return"string"!==b&&f&&!d?Wa(a):function(){return Xa(a,b,c,arguments)}};e.stackSave=ja;e.stackRestore=qa;e.stackAlloc=t;var ld;ob=function md(){ld||nd();ld||(ob=md)};
|
||||
function nd(){function a(){if(!ld&&(ld=!0,e.calledRun=!0,!Va)){e.noFSInit||tc||(tc=!0,sc(),e.stdin=e.stdin,e.stdout=e.stdout,e.stderr=e.stderr,e.stdin?Rc("stdin",e.stdin):kc("/dev/tty","/dev/stdin"),e.stdout?Rc("stdout",null,e.stdout):kc("/dev/tty","/dev/stdout"),e.stderr?Rc("stderr",null,e.stderr):kc("/dev/tty1","/dev/stderr"),l("/dev/stdin","r"),l("/dev/stdout","w"),l("/dev/stderr","w"));gb(ib);Ub=!1;gb(jb);if(e.onRuntimeInitialized)e.onRuntimeInitialized();if(e.postRun)for("function"==typeof e.postRun&&
|
||||
(e.postRun=[e.postRun]);e.postRun.length;){var b=e.postRun.shift();kb.unshift(b)}gb(kb)}}if(!(0<mb)){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)lb();gb(hb);0<mb||(e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1);a()},1)):a())}}e.run=nd;if(e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);0<e.preInit.length;)e.preInit.pop()();noExitRuntime=!0;nd();
|
||||
|
||||
|
||||
// The shell-pre.js and emcc-generated code goes above
|
||||
return Module;
|
||||
}); // The end of the promise being returned
|
||||
|
||||
return initSqlJsPromise;
|
||||
} // The end of our initSqlJs function
|
||||
|
||||
// This bit below is copied almost exactly from what you get when you use the MODULARIZE=1 flag with emcc
|
||||
// However, we don't want to use the emcc modularization. See shell-pre.js
|
||||
if (typeof exports === 'object' && typeof module === 'object'){
|
||||
module.exports = initSqlJs;
|
||||
// This will allow the module to be used in ES6 or CommonJS
|
||||
module.exports.default = initSqlJs;
|
||||
}
|
||||
else if (typeof define === 'function' && define['amd']) {
|
||||
define([], function() { return initSqlJs; });
|
||||
}
|
||||
else if (typeof exports === 'object'){
|
||||
exports["Module"] = initSqlJs;
|
||||
}
|
||||
/* global initSqlJs */
|
||||
/* eslint-env worker */
|
||||
/* eslint no-restricted-globals: ["error"] */
|
||||
var db;
|
||||
|
||||
function onModuleReady(SQL) {
|
||||
"use strict";
|
||||
|
||||
function createDb(data) {
|
||||
if (db != null) db.close();
|
||||
db = new SQL.Database(data);
|
||||
return db;
|
||||
}
|
||||
|
||||
var buff; var data; var result;
|
||||
data = this["data"];
|
||||
switch (data && data["action"]) {
|
||||
case "open":
|
||||
buff = data["buffer"];
|
||||
createDb(buff && new Uint8Array(buff));
|
||||
return postMessage({
|
||||
id: data["id"],
|
||||
ready: true
|
||||
});
|
||||
case "exec":
|
||||
if (db === null) {
|
||||
createDb();
|
||||
}
|
||||
if (!data["sql"]) {
|
||||
throw "exec: Missing query string";
|
||||
}
|
||||
return postMessage({
|
||||
id: data["id"],
|
||||
results: db.exec(data["sql"], data["params"])
|
||||
});
|
||||
case "each":
|
||||
if (db === null) {
|
||||
createDb();
|
||||
}
|
||||
var callback = function callback(row) {
|
||||
return postMessage({
|
||||
id: data["id"],
|
||||
row: row,
|
||||
finished: false
|
||||
});
|
||||
};
|
||||
var done = function done() {
|
||||
return postMessage({
|
||||
id: data["id"],
|
||||
finished: true
|
||||
});
|
||||
};
|
||||
return db.each(data["sql"], data["params"], callback, done);
|
||||
case "export":
|
||||
buff = db["export"]();
|
||||
result = {
|
||||
id: data["id"],
|
||||
buffer: buff
|
||||
};
|
||||
try {
|
||||
return postMessage(result, [result]);
|
||||
} catch (error) {
|
||||
return postMessage(result);
|
||||
}
|
||||
case "close":
|
||||
if (db) {
|
||||
db.close();
|
||||
}
|
||||
return postMessage({
|
||||
id: data["id"]
|
||||
});
|
||||
default:
|
||||
throw new Error("Invalid action : " + (data && data["action"]));
|
||||
}
|
||||
}
|
||||
|
||||
function onError(err) {
|
||||
"use strict";
|
||||
|
||||
return postMessage({
|
||||
id: this["data"]["id"],
|
||||
error: err["message"]
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof importScripts === "function") {
|
||||
db = null;
|
||||
var sqlModuleReady = initSqlJs();
|
||||
self.onmessage = function onmessage(event) {
|
||||
"use strict";
|
||||
|
||||
return sqlModuleReady
|
||||
.then(onModuleReady.bind(event))
|
||||
.catch(onError.bind(event));
|
||||
};
|
||||
}
|
||||
BIN
img/Screenshot_app_info.png
Normal file
|
After Width: | Height: | Size: 22 KiB |
BIN
img/Screenshot_chart.png
Normal file
|
After Width: | Height: | Size: 94 KiB |
BIN
img/Screenshot_csv.png
Normal file
|
After Width: | Height: | Size: 41 KiB |
BIN
img/Screenshot_editor.png
Normal file
|
After Width: | Height: | Size: 66 KiB |
BIN
img/Screenshot_editor_with_db.png
Normal file
|
After Width: | Height: | Size: 76 KiB |
BIN
img/Screenshot_group.png
Normal file
|
After Width: | Height: | Size: 28 KiB |
BIN
img/Screenshot_my_inquiries.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
img/Screenshot_pivot_barchart.png
Normal file
|
After Width: | Height: | Size: 57 KiB |
BIN
img/Screenshot_pivot_custom_chart.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
img/Screenshot_pivot_heatmap.png
Normal file
|
After Width: | Height: | Size: 113 KiB |
BIN
img/Screenshot_pivot_table.png
Normal file
|
After Width: | Height: | Size: 84 KiB |
BIN
img/Screenshot_predefined.png
Normal file
|
After Width: | Height: | Size: 33 KiB |
BIN
img/Screenshot_query_tools.png
Normal file
|
After Width: | Height: | Size: 23 KiB |
BIN
img/Screenshot_result.png
Normal file
|
After Width: | Height: | Size: 74 KiB |
BIN
img/Screenshot_welcome.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
10
img/add-csv.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.6573 1.5H2.59985C1.77485 1.5 1.09985 2.175 1.09985 3V13.6649C1.09985 14.4899 1.77485 15.1649 2.59985 15.1649H9.84V13.6649H8.87866V9.08244H13.6573V9.83777H15.1573V3C15.1573 2.17 14.4873 1.5 13.6573 1.5ZM13.6573 7.58244V3H8.87866V7.58244H13.6573ZM7.37866 3H2.59985V7.58244H7.37866V3ZM2.59985 9.08244V13.6649H7.37866V9.08244H2.59985ZM13.1702 10.8434H15.6702V13.1717H18.0001V15.6717H15.6702V18H13.1702V15.6717H10.8401V13.1717H13.1702V10.8434Z" fill="#A2B1C6"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="18" height="18" fill="white"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 739 B |
5
img/camera.svg
Normal file
@@ -0,0 +1,5 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M9 5.51953C6.57686 5.51953 4.60547 7.49092 4.60547 9.91406C4.60547 12.3372 6.57686 14.3086 9 14.3086C11.4231 14.3086 13.3945 12.3372 13.3945 9.91406C13.3945 7.49092 11.4231 5.51953 9 5.51953ZM9 12.9023C7.35226 12.9023 6.01172 11.5618 6.01172 9.91406C6.01172 8.26632 7.35226 6.92578 9 6.92578C10.6477 6.92578 11.9883 8.26632 11.9883 9.91406C11.9883 11.5618 10.6477 12.9023 9 12.9023Z" fill="#A2B1C6"/>
|
||||
<path d="M15.8906 3.41016H13.304C13.2221 3.41016 13.1483 3.36547 13.1104 3.29319L12.3948 1.78945C12.3928 1.78534 12.3908 1.78126 12.3887 1.77718C12.1117 1.22312 11.5548 0.878906 10.9353 0.878906H7.11478C6.49529 0.878906 5.93835 1.22312 5.66135 1.77722C5.65928 1.7813 5.65731 1.78538 5.65534 1.78949L4.9397 3.2933C4.90173 3.36547 4.82797 3.41016 4.74609 3.41016H2.10938C0.946266 3.41016 0 4.35642 0 5.51953V15.0117C0 16.1748 0.946266 17.1211 2.10938 17.1211H15.8906C17.0537 17.1211 18 16.1748 18 15.0117V5.51953C18 4.35642 17.0537 3.41016 15.8906 3.41016ZM16.5938 15.0117C16.5938 15.3994 16.2783 15.7148 15.8906 15.7148H2.10938C1.72167 15.7148 1.40625 15.3994 1.40625 15.0117V5.51953C1.40625 5.13183 1.72167 4.81641 2.10938 4.81641H4.74609C5.36555 4.81641 5.92249 4.47223 6.19952 3.91816C6.2016 3.91409 6.20357 3.90997 6.20557 3.90586L6.92121 2.40205C6.95914 2.32984 7.0329 2.28516 7.11478 2.28516H10.9353C11.0172 2.28516 11.091 2.32984 11.1289 2.40202L11.8445 3.90582C11.8465 3.90994 11.8485 3.91405 11.8506 3.91813C12.1276 4.47219 12.6846 4.81637 13.304 4.81637H15.8906C16.2783 4.81637 16.5938 5.13179 16.5938 5.5195V15.0117Z" fill="#A2B1C6"/>
|
||||
<path d="M15.1875 6.22266H13.7812V7.62891H15.1875V6.22266Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
8
img/chart.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.41943 16V10H10.4194V16H8.41943Z" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.41943 16L2.41943 10H4.41943V16H2.41943Z" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.4194 16V7H13.4194V16H11.4194Z" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4194 16V8H16.4194V16H14.4194Z" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.41943 12V16H5.41943V12H7.41943Z" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12.4332 1.80676L16.6265 6.00001L15.9194 6.70712L12.4055 3.19326L5.93169 9.1691L1.71436 5.55424L2.36515 4.79499L5.90707 7.83092L12.4332 1.80676Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 831 B |
|
Before Width: | Height: | Size: 643 B After Width: | Height: | Size: 643 B |
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 346 B After Width: | Height: | Size: 346 B |
8
img/graph.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M5 4C5 5.10457 4.10457 6 3 6C1.89543 6 1 5.10457 1 4C1 2.89543 1.89543 2 3 2C4.10457 2 5 2.89543 5 4Z" fill="#A2B1C6"/>
|
||||
<path d="M17 7.5C17 8.88071 15.8807 10 14.5 10C13.1193 10 12 8.88071 12 7.5C12 6.11929 13.1193 5 14.5 5C15.8807 5 17 6.11929 17 7.5Z" fill="#A2B1C6"/>
|
||||
<path d="M8 13.5C8 14.8807 6.88071 16 5.5 16C4.11929 16 3 14.8807 3 13.5C3 12.1193 4.11929 11 5.5 11C6.88071 11 8 12.1193 8 13.5Z" fill="#A2B1C6"/>
|
||||
<path d="M2.93128 5.31436L3.90527 5.08778L5.48693 11.8867L4.51294 12.1133L2.93128 5.31436Z" fill="#A2B1C6"/>
|
||||
<path d="M12.9447 7.79159L13.5548 8.58392L7.30516 13.3962L6.69507 12.6038L12.9447 7.79159Z" fill="#A2B1C6"/>
|
||||
<path d="M14.1316 6.51712L3.13166 3.51723L2.86844 4.48202L13.8684 7.48191L14.1316 6.51712Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 858 B |
3
img/info.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11 9H13V7H11V9ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20ZM12 2C10.6868 2 9.38642 2.25866 8.17317 2.7612C6.95991 3.26375 5.85752 4.00035 4.92893 4.92893C3.05357 6.8043 2 9.34784 2 12C2 14.6522 3.05357 17.1957 4.92893 19.0711C5.85752 19.9997 6.95991 20.7362 8.17317 21.2388C9.38642 21.7413 10.6868 22 12 22C14.6522 22 17.1957 20.9464 19.0711 19.0711C20.9464 17.1957 22 14.6522 22 12C22 10.6868 21.7413 9.38642 21.2388 8.17317C20.7362 6.95991 19.9997 5.85752 19.0711 4.92893C18.1425 4.00035 17.0401 3.26375 15.8268 2.7612C14.6136 2.25866 13.3132 2 12 2V2ZM11 17H13V11H11V17Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 754 B |
6
img/pivot.svg
Normal file
@@ -0,0 +1,6 @@
|
||||
<svg width="19" height="18" viewBox="0 0 19 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.7661 5.13901L18.3407 9.43008H16.5161V12.8467C16.5161 13.7957 16.2783 14.6451 15.6714 15.2521C15.0645 15.859 14.215 16.0967 13.2661 16.0967H9.84942V17.9214L5.55835 15.3467L9.84942 12.7721V14.5967H13.2661C13.9838 14.5967 14.3844 14.4178 14.6108 14.1914C14.8372 13.965 15.0161 13.5645 15.0161 12.8467V9.43008H13.1914L15.7661 5.13901Z" fill="#A2B1C6"/>
|
||||
<path d="M6.41943 0H18.4194V4H6.41943V0Z" fill="#A2B1C6"/>
|
||||
<path d="M0.419434 6H4.41943V18H0.419434V6Z" fill="#A2B1C6"/>
|
||||
<path d="M0.419434 0H4.41943V4H0.419434V0Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 687 B |
|
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
3
img/run.svg
Normal file
@@ -0,0 +1,3 @@
|
||||
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.1624 6.94358L0.770043 12.9436L0.770043 0.943573L11.1624 6.94358Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 199 B |
11
img/sql.svg
Normal file
@@ -0,0 +1,11 @@
|
||||
<svg width="18" height="19" viewBox="0 0 18 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M4.5 1.51343H10.5L15 6.01343V8.45284H13.5V6.76343H9.75V3.01343H4.5V8.45284H3V3.01343C3 2.18843 3.675 1.51343 4.5 1.51343Z" fill="#A2B1C6"/>
|
||||
<path d="M4.28369 14.8127C4.28369 14.5872 4.20312 14.4114 4.04199 14.2854C3.88379 14.1594 3.604 14.0291 3.20264 13.8943C2.80127 13.7595 2.47314 13.6292 2.21826 13.5032C1.38916 13.0959 0.974609 12.5364 0.974609 11.8245C0.974609 11.47 1.07715 11.158 1.28223 10.8884C1.49023 10.616 1.7832 10.405 2.16113 10.2556C2.53906 10.1033 2.96387 10.0271 3.43555 10.0271C3.89551 10.0271 4.30713 10.1091 4.67041 10.2732C5.03662 10.4373 5.3208 10.6716 5.52295 10.9763C5.7251 11.2781 5.82617 11.6238 5.82617 12.0134H4.28809C4.28809 11.7527 4.20752 11.5505 4.04639 11.407C3.88818 11.2634 3.67285 11.1917 3.40039 11.1917C3.125 11.1917 2.90674 11.2532 2.74561 11.3762C2.5874 11.4963 2.5083 11.6501 2.5083 11.8376C2.5083 12.0017 2.59619 12.1511 2.77197 12.2859C2.94775 12.4177 3.25684 12.5554 3.69922 12.699C4.1416 12.8396 4.50488 12.9919 4.78906 13.156C5.48047 13.5544 5.82617 14.1038 5.82617 14.804C5.82617 15.3635 5.61523 15.803 5.19336 16.1223C4.77148 16.4417 4.19287 16.6013 3.45752 16.6013C2.93896 16.6013 2.46875 16.509 2.04688 16.3245C1.62793 16.137 1.31152 15.8821 1.09766 15.5598C0.886719 15.2346 0.78125 14.8611 0.78125 14.4392H2.32812C2.32812 14.782 2.41602 15.0354 2.5918 15.1995C2.77051 15.3606 3.05908 15.4412 3.45752 15.4412C3.7124 15.4412 3.91309 15.387 4.05957 15.2786C4.20898 15.1672 4.28369 15.012 4.28369 14.8127ZM12.0444 13.446C12.0444 14.0378 11.9463 14.5549 11.75 14.9973C11.5537 15.4368 11.2827 15.7898 10.937 16.0564L11.9697 16.8738L11.0161 17.6824L9.64062 16.575C9.51172 16.5925 9.38281 16.6013 9.25391 16.6013C8.70898 16.6013 8.22559 16.4753 7.80371 16.2234C7.38184 15.9714 7.05225 15.6111 6.81494 15.1423C6.58057 14.6736 6.45898 14.1345 6.4502 13.5251V13.1868C6.4502 12.5569 6.56445 12.0032 6.79297 11.5256C7.02441 11.0481 7.35254 10.679 7.77734 10.4182C8.20508 10.1575 8.69434 10.0271 9.24512 10.0271C9.78711 10.0271 10.2705 10.156 10.6953 10.4138C11.1201 10.6716 11.4497 11.0393 11.6841 11.5168C11.9214 11.9915 12.0415 12.5364 12.0444 13.1516V13.446ZM10.4756 13.178C10.4756 12.5422 10.3687 12.0603 10.1548 11.7322C9.94385 11.4011 9.64062 11.2356 9.24512 11.2356C8.83789 11.2356 8.53174 11.3982 8.32666 11.7234C8.12158 12.0486 8.01758 12.5247 8.01465 13.1516V13.446C8.01465 14.0759 8.11865 14.5593 8.32666 14.8962C8.53467 15.2302 8.84375 15.3972 9.25391 15.3972C9.64648 15.3972 9.94678 15.2317 10.1548 14.9006C10.3657 14.5696 10.4727 14.0935 10.4756 13.4724V13.178ZM14.3735 15.3269H17.0586V16.5134H12.8311V10.115H14.3735V15.3269Z" fill="#A2B1C6"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="18" height="18" fill="white" transform="translate(0 0.0134277)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.8 KiB |
7
img/table.svg
Normal file
@@ -0,0 +1,7 @@
|
||||
<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.0286 2.66757H3.97119C3.14619 2.66757 2.47119 3.34257 2.47119 4.16757V14.8324C2.47119 15.6574 3.14619 16.3324 3.97119 16.3324H15.0286C15.8613 16.3324 16.5286 15.6576 16.5286 14.8324V4.16757C16.5286 3.33757 15.8586 2.66757 15.0286 2.66757ZM15.03 4.16757H3.96997V14.8276H15.03V4.16757Z" fill="#A2B1C6"/>
|
||||
<line x1="7.52295" y1="3.81403" x2="7.52295" y2="15.1996" stroke="#A2B1C6" stroke-width="1.5"/>
|
||||
<line x1="11.5137" y1="3.80042" x2="11.5137" y2="15.1859" stroke="#A2B1C6" stroke-width="1.5"/>
|
||||
<line x1="2.98926" y1="7.22595" x2="16.0105" y2="7.22595" stroke="#A2B1C6" stroke-width="1.5"/>
|
||||
<line x1="2.98926" y1="11.3483" x2="16.0105" y2="11.3483" stroke="#A2B1C6" stroke-width="1.5"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 841 B |
12
img/visualisation.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<svg width="19" height="19" viewBox="0 0 19 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0)">
|
||||
<path d="M2.03345 13.6725L5.8465 10.2694L9.25264 13.2145L14.0613 8.16519L17.2235 11.38" stroke="#A2B1C6" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="6.00049" cy="6.50339" r="1.5" fill="#A2B1C6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.536 1.71786L2.46546 1.71298C1.64046 1.71298 0.965462 2.38798 0.965462 3.21298L0.964111 15.7821C0.964111 16.6071 1.63911 17.2821 2.46411 17.2821L16.5347 17.287C17.3674 17.287 18.0347 16.6121 18.0347 15.787L18.036 3.21786C18.036 2.38786 17.366 1.71786 16.536 1.71786ZM16.5374 3.21786L2.46424 3.21298L2.46289 15.7772L16.536 15.7821L16.5374 3.21786Z" fill="#A2B1C6"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0">
|
||||
<rect width="18" height="18" fill="white" transform="translate(0.5 0.5)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 909 B |
14
index.md
Executable file
@@ -0,0 +1,14 @@
|
||||
# Introduction
|
||||
|
||||
Sqliteviz is a single-page offline-first PWA for fully client-side visualisation of SQLite databases, CSV, JSON or NDJSON files.
|
||||
|
||||
With sqliteviz you can:
|
||||
|
||||
- run SQL queries against a SQLite database and create Plotly charts, graphs and pivot tables based on the result sets
|
||||
- import a CSV, JSON or NDJSON file into a SQLite database and visualize imported data
|
||||
- export result set to CSV file
|
||||
- manage inquiries and run them against different databases
|
||||
- import/export inquiries from/to a JSON file
|
||||
- export a modified SQLite database
|
||||
- use it offline from your OS application menu like any other desktop app
|
||||
|
||||
16869
package-lock.json
generated
46
package.json
@@ -1,46 +0,0 @@
|
||||
{
|
||||
"name": "sqliteviz",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"test:unit": "vue-cli-service test:unit",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"codemirror": "^5.57.0",
|
||||
"core-js": "^3.6.5",
|
||||
"plotly.js": "^1.54.6",
|
||||
"react": "^16.13.1",
|
||||
"react-chart-editor": "^0.41.7",
|
||||
"react-dom": "^16.13.1",
|
||||
"sql.js": "^1.3.0",
|
||||
"sqlite-parser": "^1.0.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-codemirror": "^4.0.6",
|
||||
"vue-react": "^1.2.0",
|
||||
"vue-router": "^3.2.0",
|
||||
"vuejs-paginate": "^2.1.0",
|
||||
"vuex": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "^4.4.0",
|
||||
"@vue/cli-plugin-eslint": "^4.4.0",
|
||||
"@vue/cli-plugin-router": "^4.4.0",
|
||||
"@vue/cli-plugin-unit-mocha": "^4.4.0",
|
||||
"@vue/cli-plugin-vuex": "^4.4.0",
|
||||
"@vue/cli-service": "^4.4.0",
|
||||
"@vue/eslint-config-standard": "^5.1.2",
|
||||
"@vue/test-utils": "^1.0.3",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"chai": "^4.1.2",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-import": "^2.20.2",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"eslint-plugin-promise": "^4.2.1",
|
||||
"eslint-plugin-standard": "^4.0.0",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -1,17 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
33
sidebar.json
Normal file
@@ -0,0 +1,33 @@
|
||||
[{
|
||||
"sections": [{
|
||||
"title": "For users",
|
||||
"items": [
|
||||
"/docs/",
|
||||
"/docs/installation/",
|
||||
"/docs/basic-usage/",
|
||||
"/docs/multiple-csv-file-import/",
|
||||
"/docs/manage-inquiries/",
|
||||
"/docs/export-current-database/",
|
||||
"/docs/graph/",
|
||||
"/docs/pivot-table/",
|
||||
"/docs/predefined-inquiries/",
|
||||
"/docs/sharing/",
|
||||
"/docs/diagnostic-information/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "Examples and tutorials",
|
||||
"items": [
|
||||
"/docs/how-to-migrate-to-sqliteviz-dot-com/",
|
||||
"/docs/how-to-build-a-pivot-table-in-sq-lite/",
|
||||
"/docs/how-to-rename-tables-and-columns-after-csv-import/"
|
||||
]
|
||||
},
|
||||
{
|
||||
"title": "For developers",
|
||||
"items": [
|
||||
"/docs/integrate-predefined-inquiries/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}]
|
||||
16
src/App.vue
@@ -1,16 +0,0 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
#app, * {
|
||||
font-family: Open-Sans, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,3 +0,0 @@
|
||||
<svg width="8" height="12" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992 5.79997L1.99992 11.2L0.721924 9.93097Z" fill="#506784"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 243 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 232 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M3 10.5V12.75C3 14.25 5.2875 15.54 8.25 15.75V13.5825L8.3475 13.5C5.34 13.32 3 12.045 3 10.5ZM9 9.75C5.685 9.75 3 8.4075 3 6.75V9C3 10.6575 5.685 12 9 12C9.2925 12 9.5775 12 9.87 12L12.75 9.09C11.55 9.54 10.2825 9.75 9 9.75ZM9 2.25C5.685 2.25 3 3.5925 3 5.25C3 6.9075 5.685 8.25 9 8.25C12.315 8.25 15 6.9075 15 5.25C15 3.5925 12.315 2.25 9 2.25ZM15.75 8.3475C15.6375 8.3475 15.5325 8.3925 15.4575 8.475L14.7075 9.225L16.245 10.725L16.995 9.975C17.1525 9.825 17.16 9.57 16.995 9.3975L16.065 8.475C15.99 8.3925 15.885 8.3475 15.78 8.3475H15.75ZM14.28 9.66L9.75 14.205V15.75H11.295L15.84 11.1975L14.28 9.66Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 735 B |
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,54 +0,0 @@
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
button.primary {
|
||||
background: var(--color-accent);
|
||||
border: 1px solid var(--color-accent-shade);
|
||||
box-sizing: border-box;
|
||||
border-radius: var(--border-radius-big);
|
||||
height: 36px;
|
||||
padding: 0 12px;
|
||||
min-width: 83px;
|
||||
color: var(--color-text-light);
|
||||
text-shadow: var(--shadow);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.primary:hover {
|
||||
background: var(--color-accent-shade);
|
||||
border: 1px solid var(--color-accent-shade);
|
||||
color: var(--color-text-light);
|
||||
text-shadow: var(--shadow);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
button.primary:disabled {
|
||||
background: var(--color-bg-light-2);
|
||||
border: 1px solid var(--color-border);
|
||||
color: var(--color-text-light-2);
|
||||
text-shadow: none;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
button.toolbar {
|
||||
background: transparent;
|
||||
border: none;
|
||||
box-sizing: border-box;
|
||||
height: 36px;
|
||||
padding: 0 12px;
|
||||
color: var(--color-text-base);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button.toolbar:hover {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/* width */
|
||||
::-webkit-scrollbar {
|
||||
width: 5px;
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
/* Track */
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* Handle */
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: var(--color-accent);
|
||||
border-radius: 10px;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
.rounded-bg {
|
||||
padding: 40px 5px 5px;
|
||||
background-color: white;
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
border: 1px solid var(--color-border-light);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.header-container {
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
top: -1px;;
|
||||
left: -1px;
|
||||
width: calc(100% + 2px);
|
||||
padding-left: 7px;
|
||||
box-sizing: border-box;
|
||||
background-color: var(--color-bg-dark);
|
||||
border-radius: 5px 5px 0 0;
|
||||
}
|
||||
|
||||
.header-container > div {
|
||||
display: flex;
|
||||
width: fit-content;
|
||||
padding-right: 10px;
|
||||
}
|
||||
.table-container {
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
table {
|
||||
min-width: 100%;
|
||||
margin-top: -40px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
thead th, .fixed-header {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
box-sizing: border-box;
|
||||
background-color: var(--color-bg-dark);
|
||||
color: var(--color-text-light);
|
||||
border-right: 1px solid var(--color-border-light);
|
||||
}
|
||||
tbody td {
|
||||
font-size: 13px;
|
||||
background-color:white;
|
||||
color: var(--color-text-base);
|
||||
box-sizing: border-box;
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
border-right: 1px solid var(--color-border-light);
|
||||
}
|
||||
td, th, .fixed-header {
|
||||
padding: 12px 24px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tbody tr td:last-child,
|
||||
thead tr th:last-child,
|
||||
.header-container div .fixed-header:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
td > div.cell-data {
|
||||
width: -webkit-max-content;
|
||||
width: -moz-max-content;
|
||||
width: max-content;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.table-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
.table-footer-count {
|
||||
font-size: 11px;
|
||||
color: var(--color-text-base);
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
input[type="text"] {
|
||||
background: var(--color-white);
|
||||
border: 1px solid var(--color-border);
|
||||
color: var(--color-text-base);
|
||||
border-radius: var(--border-radius-medium-2);
|
||||
height: 36px;
|
||||
padding: 0 8px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
input[type="text"]::placeholder {
|
||||
color: var(--color-text-light-2);
|
||||
}
|
||||
|
||||
input[type="text"]:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
:root {
|
||||
--color-white: #ffffff;
|
||||
--color-gray-light: #F3F6FA;
|
||||
--color-gray-light-2: #DFE8F3;
|
||||
--color-gray-light-3: #C8D4E3;
|
||||
--color-gray-light-4:#EBF0F8;
|
||||
--color-gray-light-5:#f8f8f9;
|
||||
--color-gray-medium: #A2B1C6;
|
||||
--color-gray-dark: #506784;
|
||||
--color-blue-medium: #119DFF;
|
||||
--color-blue-dark: #0D76BF;
|
||||
--color-blue-dark-2: #2A3F5F;
|
||||
|
||||
|
||||
|
||||
--color-bg-light: var(--color-gray-light);
|
||||
--color-bg-light-2: var(--color-gray-light-2);
|
||||
--color-bg-light-3: var(--color-gray-light-5);
|
||||
--color-bg-dark: var(--color-gray-dark);
|
||||
--color-accent: var(--color-blue-medium);
|
||||
--color-accent-shade: var(--color-blue-dark);
|
||||
--color-border-light: var(--color-gray-light-2);
|
||||
--color-border: var(--color-gray-light-3);
|
||||
--color-text-light: var(--color-white);
|
||||
--color-text-light-2: var(--color-gray-medium);
|
||||
--color-text-base: var(--color-gray-dark);
|
||||
--color-text-active: var(--color-blue-dark-2);
|
||||
|
||||
--shadow: 0 1px 2px rgba(42, 63, 95, 0.7);
|
||||
|
||||
--border-radius-big: 5px;
|
||||
--border-radius-medium: 3px;
|
||||
--border-radius-medium-2: 4px;
|
||||
--border-radius-small: 2px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
<template>
|
||||
<nav>
|
||||
<div>
|
||||
<router-link to="/editor">Editor</router-link>
|
||||
<router-link to="/my-queries">My queries</router-link>
|
||||
</div>
|
||||
<div>
|
||||
<button
|
||||
v-if="$store.state.tabs.length > 0"
|
||||
class="primary"
|
||||
:disabled="!$store.state.currentTab.isUnsaved"
|
||||
@click="saveQuery"
|
||||
>
|
||||
Save
|
||||
</button>
|
||||
<button class="primary" @click="createNewQuery">Create</button>
|
||||
</div>
|
||||
</nav>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'MainMenu',
|
||||
methods: {
|
||||
createNewQuery () {
|
||||
const tab = {
|
||||
id: Number(new Date()),
|
||||
name: null,
|
||||
tempName: this.$store.state.untitledLastIndex
|
||||
? `Untitled ${this.$store.state.untitledLastIndex}`
|
||||
: 'Untitled',
|
||||
isUnsaved: true
|
||||
}
|
||||
this.$store.commit('addTab', tab)
|
||||
this.$store.commit('setCurrentTabId', tab.id)
|
||||
this.$store.commit('updateUntitledLastIndex')
|
||||
},
|
||||
saveQuery () {
|
||||
const currentQuery = this.$store.state.currentTab
|
||||
const isFromScratch = !this.$store.state.currentTab.initName
|
||||
const value = {
|
||||
id: currentQuery.id,
|
||||
query: currentQuery.query
|
||||
// TODO: save plotly settings
|
||||
}
|
||||
|
||||
if (isFromScratch) {
|
||||
value.name = prompt('query name')
|
||||
// TODO: create dialog
|
||||
this.$store.commit('updateTabName', { index: currentQuery.tabIndex, newName: value.name })
|
||||
value.createdAt = new Date()
|
||||
} else {
|
||||
value.name = currentQuery.initName
|
||||
}
|
||||
|
||||
let myQueries = JSON.parse(localStorage.getItem('myQueries'))
|
||||
if (!myQueries) {
|
||||
myQueries = [value]
|
||||
} else if (isFromScratch) {
|
||||
myQueries.push(value)
|
||||
} else {
|
||||
const queryIndex = myQueries.findIndex(query => query.id === currentQuery.id)
|
||||
value.createdAt = myQueries[queryIndex].createdAt
|
||||
myQueries[queryIndex] = value
|
||||
}
|
||||
localStorage.setItem('myQueries', JSON.stringify(myQueries))
|
||||
currentQuery.isUnsaved = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
nav {
|
||||
height: 68px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: var(--color-bg-light);
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
box-sizing: border-box;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100vw;
|
||||
padding: 0 52px;
|
||||
}
|
||||
a {
|
||||
font-size: 18px;
|
||||
color: var(--color-text-base);
|
||||
text-transform: none;
|
||||
text-decoration: none;
|
||||
margin-right: 28px;
|
||||
}
|
||||
a.router-link-active {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
button {
|
||||
margin-left: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,97 +0,0 @@
|
||||
<template>
|
||||
<paginate
|
||||
:page-count="pageCount"
|
||||
:page-range="5"
|
||||
:margin-pages="1"
|
||||
:prev-text="chevron"
|
||||
:next-text="chevron"
|
||||
:no-li-surround="true"
|
||||
container-class="paginator-continer"
|
||||
page-link-class="paginator-page-link"
|
||||
active-class="paginator-active-page"
|
||||
break-view-link-class="paginator-break"
|
||||
next-link-class="paginator-next"
|
||||
prev-link-class="paginator-prev"
|
||||
disabled-class="paginator-disabled"
|
||||
v-model="page"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Paginate from 'vuejs-paginate'
|
||||
|
||||
export default {
|
||||
name: 'Pager',
|
||||
components: { Paginate },
|
||||
props: ['pageCount', 'value'],
|
||||
data () {
|
||||
return {
|
||||
page: this.value,
|
||||
chevron: `
|
||||
<svg width="9" height="9" viewBox="0 0 8 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992 5.79997L1.99992 11.2L0.721924 9.93097Z" fill="#506784"/>
|
||||
</svg>
|
||||
`
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
page () {
|
||||
this.$emit('input', this.page)
|
||||
},
|
||||
value () {
|
||||
this.page = this.value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.paginator-continer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
>>> .paginator-page-link {
|
||||
padding: 2px 3px;
|
||||
margin: 0 5px;
|
||||
display: block;
|
||||
color: var(--color-text-base);
|
||||
font-size: 11px;
|
||||
}
|
||||
>>> .paginator-page-link:hover {
|
||||
color: var(--color-text-active);
|
||||
}
|
||||
>>> .paginator-page-link:active,
|
||||
>>> .paginator-page-link:visited,
|
||||
>>> .paginator-page-link:focus,
|
||||
>>> .paginator-next:active,
|
||||
>>> .paginator-next:visited,
|
||||
>>> .paginator-next:focus,
|
||||
>>> .paginator-prev:active,
|
||||
>>> .paginator-prev:visited,
|
||||
>>> .paginator-prev:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
>>> .paginator-active-page,
|
||||
>>> .paginator-active-page:hover {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
>>> .paginator-break:hover,
|
||||
>>> .paginator-disabled:hover {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
>>> .paginator-prev svg {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
>>> .paginator-next:hover path,
|
||||
>>> .paginator-prev:hover path {
|
||||
fill: var(--color-text-active);
|
||||
}
|
||||
>>> .paginator-disabled path,
|
||||
>>> .paginator-disabled:hover path {
|
||||
fill: var(--color-text-light-2);
|
||||
}
|
||||
</style>
|
||||
@@ -1,158 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<input type="text" placeholder="Search table"/>
|
||||
<div id="db">
|
||||
<div @click="schemaVisible = !schemaVisible" class="db-name">
|
||||
<svg
|
||||
:style="{transform: schemaVisible ? 'rotate(90deg)' : 'rotate(0)'}"
|
||||
class="chevron-icon"
|
||||
width="9"
|
||||
height="9"
|
||||
viewBox="0 0 8 12"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992 5.79997L1.99992 11.2L0.721924 9.93097Z"
|
||||
:fill="schemaVisible ? '#506784' : 'rgba(80, 103, 132, 0.5)'"
|
||||
/>
|
||||
</svg>
|
||||
{{ dbName }}
|
||||
</div>
|
||||
<div class="db-edit">
|
||||
<input type="file" id="actual-btn" ref="dbfile" hidden @change="changeDb"/>
|
||||
<label for="actual-btn">
|
||||
<svg
|
||||
class="db-edit-icon"
|
||||
width="18"
|
||||
height="18"
|
||||
viewBox="0 0 18 18"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path d="M3 10.5V12.75C3 14.25 5.2875 15.54 8.25 15.75V13.5825L8.3475 13.5C5.34 13.32 3 12.045 3 10.5ZM9 9.75C5.685 9.75 3 8.4075 3 6.75V9C3 10.6575 5.685 12 9 12C9.2925 12 9.5775 12 9.87 12L12.75 9.09C11.55 9.54 10.2825 9.75 9 9.75ZM9 2.25C5.685 2.25 3 3.5925 3 5.25C3 6.9075 5.685 8.25 9 8.25C12.315 8.25 15 6.9075 15 5.25C15 3.5925 12.315 2.25 9 2.25ZM15.75 8.3475C15.6375 8.3475 15.5325 8.3925 15.4575 8.475L14.7075 9.225L16.245 10.725L16.995 9.975C17.1525 9.825 17.16 9.57 16.995 9.3975L16.065 8.475C15.99 8.3925 15.885 8.3475 15.78 8.3475H15.75ZM14.28 9.66L9.75 14.205V15.75H11.295L15.84 11.1975L14.28 9.66Z"
|
||||
fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</label>
|
||||
<span class="db-edit-tooltip">Change database</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-show="schemaVisible" class="schema">
|
||||
<table-description
|
||||
v-for="(table, index) in schema"
|
||||
:key="index"
|
||||
:name="table[0]"
|
||||
:sql="table[1]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TableDescription from '@/components/TableDescription'
|
||||
|
||||
export default {
|
||||
name: 'Schema',
|
||||
components: { TableDescription },
|
||||
data () {
|
||||
return {
|
||||
schemaVisible: true,
|
||||
worker: this.$store.state.worker
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
schema () {
|
||||
return this.$store.state.schema
|
||||
},
|
||||
dbName () {
|
||||
return this.$store.state.dbName
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeDb () {
|
||||
const dbName = this.$refs.dbfile.value.substr(this.$refs.dbfile.value.lastIndexOf('\\') + 1)
|
||||
this.$store.commit('saveDbName', dbName)
|
||||
const f = this.$refs.dbfile.files[0]
|
||||
const r = new FileReader()
|
||||
r.onload = () => {
|
||||
this.worker.onmessage = () => {
|
||||
const getSchemaSql = `
|
||||
SELECT name, sql
|
||||
FROM sqlite_master
|
||||
WHERE type='table' AND name NOT LIKE 'sqlite_%';`
|
||||
this.worker.onmessage = event => {
|
||||
this.$store.commit('saveSchema', event.data.results[0].values)
|
||||
}
|
||||
this.worker.postMessage({ action: 'exec', sql: getSchemaSql })
|
||||
}
|
||||
this.$store.commit('saveDbFile', r.result)
|
||||
try {
|
||||
this.worker.postMessage({ action: 'open', buffer: r.result }, [r.result])
|
||||
} catch (exception) {
|
||||
this.worker.postMessage({ action: 'open', buffer: r.result })
|
||||
}
|
||||
}
|
||||
r.readAsArrayBuffer(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.schema {
|
||||
margin-left: 12px;
|
||||
}
|
||||
.schema, .db-name {
|
||||
color: var(--color-text-base);
|
||||
font-size: 13px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
#db {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.db-name {
|
||||
cursor: pointer;
|
||||
}
|
||||
>>> .chevron-icon {
|
||||
-webkit-transition: transform .15s ease-in-out;
|
||||
transition: transform .15s ease-in-out;
|
||||
}
|
||||
.db-name:hover .chevron-icon path,
|
||||
>>> .table-name:hover .chevron-icon path {
|
||||
fill: #506784;
|
||||
}
|
||||
|
||||
.db-edit {
|
||||
position: relative;
|
||||
}
|
||||
.db-edit-icon {
|
||||
display: block;
|
||||
}
|
||||
.db-edit-icon:hover path{
|
||||
fill: var(--color-accent);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.db-edit-tooltip {
|
||||
visibility: hidden;
|
||||
background-color: rgba(80, 103, 132, 0.75);
|
||||
color: #fff;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
padding: 0 6px;
|
||||
line-height: 19px;;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
height: 19px;
|
||||
left: 24px;
|
||||
top: -12px;
|
||||
border-radius: var(--border-radius-medium);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.db-edit:hover .db-edit-tooltip {
|
||||
visibility: visible;
|
||||
}
|
||||
</style>
|
||||
@@ -1,110 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="rounded-bg">
|
||||
<div class="header-container" ref="header-container">
|
||||
<div>
|
||||
<div
|
||||
v-for="(th, index) in header"
|
||||
class="fixed-header"
|
||||
:style="{ width: `${th.width}px` }"
|
||||
:key="index"
|
||||
>
|
||||
{{ th.name }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="table-container"
|
||||
ref="table-container"
|
||||
@scroll="onScrollTable"
|
||||
:style="{height: `${height}px`}"
|
||||
>
|
||||
<table ref="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th v-for="(th,index) in data.columns" :key="index" ref="th">
|
||||
<div class="cell-data" :style="cellStyle">{{ th }}</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row,index) in currentPageData" :key="index">
|
||||
<td v-for="(value, valIndex) in row" :key="valIndex">
|
||||
<div class="cell-data" :style="cellStyle">{{ value }}</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table-footer">
|
||||
<div class="table-footer-count">
|
||||
{{ data.values.length}} {{data.values.length === 1 ? 'row' : 'rows'}} retrieved
|
||||
</div>
|
||||
<pager v-show="pageCount > 1" :page-count="pageCount" v-model="currentPage" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pager from '@/components/Pager'
|
||||
|
||||
export default {
|
||||
name: 'SqlTable',
|
||||
components: { Pager },
|
||||
props: ['data', 'height'],
|
||||
data () {
|
||||
return {
|
||||
header: null,
|
||||
tableWidth: null,
|
||||
currentPage: 1
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
cellStyle () {
|
||||
const eq = this.tableWidth / this.data.columns.length
|
||||
|
||||
return { maxWidth: `${Math.max(eq, 100)}px` }
|
||||
},
|
||||
pageSize () {
|
||||
return Math.max(Math.floor(this.height / 40), 20)
|
||||
},
|
||||
pageCount () {
|
||||
return Math.ceil(this.data.values.length / this.pageSize)
|
||||
},
|
||||
currentPageData () {
|
||||
const start = (this.currentPage - 1) * this.pageSize
|
||||
return this.data.values.slice(start, start + this.pageSize)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calculateHeadersWidth () {
|
||||
this.tableWidth = this.$refs['table-container'].offsetWidth
|
||||
this.$nextTick(() => {
|
||||
this.header = this.$refs.th.map(th => {
|
||||
return { name: th.innerText, width: th.offsetWidth }
|
||||
})
|
||||
})
|
||||
},
|
||||
onScrollTable () {
|
||||
this.$refs['header-container'].scrollLeft = this.$refs['table-container'].scrollLeft
|
||||
},
|
||||
functionName () {
|
||||
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
new ResizeObserver(this.calculateHeadersWidth).observe(this.$refs.table)
|
||||
this.calculateHeadersWidth()
|
||||
},
|
||||
watch: {
|
||||
currentPageData: 'calculateHeadersWidth',
|
||||
data () {
|
||||
this.currentPage = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
@@ -1,247 +0,0 @@
|
||||
<template>
|
||||
<div class="tab-content-container" v-show="isActive">
|
||||
<splitpanes
|
||||
class="query-results-splitter"
|
||||
horizontal
|
||||
:before="{ size: 50, max: 50 }"
|
||||
:after="{ size: 50, max: 100 }"
|
||||
>
|
||||
<div slot="left-pane" class="query-editor">
|
||||
<div class="codemirror-container">
|
||||
<codemirror v-model="query" :options="cmOptions" @changes="onCmChange" ref="codemirror" />
|
||||
</div>
|
||||
<div class="run-btn-container">
|
||||
<button class="primary run-btn" @click="execEditorContents">Run</button>
|
||||
</div>
|
||||
</div>
|
||||
<div slot="right-pane" id="bottomPane" ref="bottomPane">
|
||||
<view-switcher :view.sync="view" />
|
||||
<div v-show="view === 'table'" class="table-view">
|
||||
<!-- <div id="error" class="error"></div>
|
||||
<pre ref="output" id="output">Results will be displayed here</pre> -->
|
||||
<sql-table v-if="result" :data="result" :height="tableViewHeight" />
|
||||
</div>
|
||||
<PlotlyEditor
|
||||
v-show="view === 'chart'"
|
||||
:data="state.data"
|
||||
:layout="state.layout"
|
||||
:frames="state.frames"
|
||||
:config="{ editable: true }"
|
||||
:dataSources="dataSources"
|
||||
:dataSourceOptions="dataSourceOptions"
|
||||
:plotly="plotly"
|
||||
@onUpdate="update"
|
||||
:useResizeHandler="true"
|
||||
:debug="true"
|
||||
:advancedTraceTypeSelector="true"
|
||||
/>
|
||||
</div>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SqlTable from '@/components/SqlTable'
|
||||
import Splitpanes from '@/components/splitpanes'
|
||||
import ViewSwitcher from '@/components/ViewSwitcher'
|
||||
|
||||
import plotly from 'plotly.js/dist/plotly'
|
||||
import 'react-chart-editor/lib/react-chart-editor.min.css'
|
||||
|
||||
import CM from 'codemirror'
|
||||
import { codemirror } from 'vue-codemirror'
|
||||
import 'codemirror/lib/codemirror.css'
|
||||
import 'codemirror/mode/sql/sql.js'
|
||||
import 'codemirror/theme/neo.css'
|
||||
import 'codemirror/addon/hint/show-hint.js'
|
||||
import 'codemirror/addon/hint/show-hint.css'
|
||||
import 'codemirror/addon/hint/sql-hint.js'
|
||||
|
||||
export default {
|
||||
name: 'TabContent',
|
||||
props: ['id', 'initName', 'initQuery', 'initPlotly', 'tabIndex'],
|
||||
components: {
|
||||
codemirror,
|
||||
SqlTable,
|
||||
Splitpanes,
|
||||
ViewSwitcher
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
plotly: plotly,
|
||||
state: {
|
||||
data: [],
|
||||
layout: {},
|
||||
frames: []
|
||||
},
|
||||
query: 'select * from albums',
|
||||
cmOptions: {
|
||||
// codemirror options
|
||||
tabSize: 4,
|
||||
mode: 'text/x-mysql',
|
||||
theme: 'neo',
|
||||
lineNumbers: true,
|
||||
line: true
|
||||
},
|
||||
result: null,
|
||||
view: 'table',
|
||||
tableViewHeight: 0,
|
||||
worker: this.$store.state.worker,
|
||||
isUnsaved: !this.name
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
isActive () {
|
||||
return this.id === this.$store.state.currentTabId
|
||||
},
|
||||
dataSources () {
|
||||
if (!this.result) {
|
||||
return {}
|
||||
}
|
||||
const dataSorces = {}
|
||||
const matrix = this.result.values
|
||||
const [row] = matrix
|
||||
const transposedMatrix = row.map((value, column) => matrix.map(row => row[column]))
|
||||
this.result.columns.forEach((column, index) => {
|
||||
dataSorces[column] = transposedMatrix[index]
|
||||
})
|
||||
return dataSorces
|
||||
},
|
||||
dataSourceOptions () {
|
||||
return Object.keys(this.dataSources).map(name => ({
|
||||
value: name,
|
||||
label: name
|
||||
}))
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.$store.commit('setCurrentTab', this)
|
||||
},
|
||||
mounted () {
|
||||
new ResizeObserver(this.calculateTableHeight).observe(this.$refs.bottomPane)
|
||||
this.calculateTableHeight()
|
||||
},
|
||||
watch: {
|
||||
isActive () {
|
||||
if (this.isActive) {
|
||||
this.$store.commit('setCurrentTab', this)
|
||||
}
|
||||
},
|
||||
query () {
|
||||
this.isUnsaved = true
|
||||
},
|
||||
isUnsaved () {
|
||||
this.$store.commit('updateTabState', { index: this.tabIndex, newValue: this.isUnsaved })
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
update (data, layout, frames) {
|
||||
this.state = { data, layout, frames }
|
||||
this.isUnsaved = true
|
||||
console.log(this.state)
|
||||
},
|
||||
onCmChange (editor) {
|
||||
// Don't show autocomplete after a space or semicolon
|
||||
const ch = editor.getTokenAt(editor.getCursor()).string.slice(-1)
|
||||
if (!ch || ch === ' ' || ch === ';') {
|
||||
return
|
||||
}
|
||||
|
||||
const hintOptions = {
|
||||
// tables: this.state.tables,
|
||||
completeSingle: false,
|
||||
completeOnSingleClick: true
|
||||
}
|
||||
|
||||
// editor.hint.sql is defined when importing codemirror/addon/hint/sql-hint
|
||||
// (this is mentioned in codemirror addon documentation)
|
||||
// Reference the hint function imported here when including other hint addons
|
||||
// or supply your own
|
||||
CM.showHint(editor, CM.hint.sql, hintOptions)
|
||||
},
|
||||
// Run a command in the database
|
||||
execute (commands) {
|
||||
this.worker.onmessage = (event) => {
|
||||
// if it was more than one select - take only the first one
|
||||
this.result = event.data.results[0]
|
||||
if (!this.result) {
|
||||
console.log(event.data.error)
|
||||
// return
|
||||
}
|
||||
|
||||
// this.$refs.output.innerHTML = ''
|
||||
}
|
||||
this.worker.postMessage({ action: 'exec', sql: commands })
|
||||
// this.$refs.output.textContent = 'Fetching results...'
|
||||
},
|
||||
execEditorContents () {
|
||||
this.execute(this.query + ';')
|
||||
},
|
||||
calculateTableHeight () {
|
||||
const bottomPane = this.$refs.bottomPane
|
||||
// 88 - view swittcher height
|
||||
// 42 - table footer width
|
||||
// 30 - desirable space after the table
|
||||
// 5 - padding-bottom of rounded table container
|
||||
// 40 - height of table header
|
||||
const freeSpace = bottomPane.offsetHeight - 88 - 42 - 30 - 5 - 40
|
||||
this.tableViewHeight = freeSpace - (freeSpace % 40)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.tab-content-container {
|
||||
padding-top: 6px;
|
||||
background-color: var(--color-bg-light);
|
||||
border-top: 1px solid var(--color-border-light);
|
||||
margin-top: -1px;
|
||||
}
|
||||
|
||||
#bottomPane {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.query-results-splitter {
|
||||
height: calc(100vh - 110px);
|
||||
background-color: var(--color-bg-light);
|
||||
}
|
||||
|
||||
.run-btn {
|
||||
margin-top: 24px;
|
||||
}
|
||||
|
||||
.query-editor {
|
||||
padding: 52px 52px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
box-sizing: border-box;
|
||||
min-height: 150px;
|
||||
}
|
||||
|
||||
.codemirror-container {
|
||||
flex-grow: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.run-btn-container {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
>>> .vue-codemirror {
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
>>> .CodeMirror {
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--border-radius-big);
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.table-view {
|
||||
margin: 0 52px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,84 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div @click="colVisible = !colVisible" class="table-name">
|
||||
<svg
|
||||
:style="{transform: colVisible ? 'rotate(90deg)' : 'rotate(0)'}"
|
||||
class="chevron-icon"
|
||||
width="9"
|
||||
height="9"
|
||||
viewBox="0 0 8 12"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M0.721924 9.93097L4.85292 5.79997L0.721924 1.66897L1.99992 0.399973L7.39992 5.79997L1.99992 11.2L0.721924 9.93097Z"
|
||||
:fill="colVisible ? '#506784' : 'rgba(80, 103, 132, 0.5)'"
|
||||
/>
|
||||
</svg>
|
||||
{{ name }}
|
||||
</div>
|
||||
<div v-show="colVisible" class="columns">
|
||||
<div v-for="(col, index) in columns" :key="index" class="column">
|
||||
{{ col.name }}
|
||||
<span class="column-type">{{ col.type }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import sqliteParser from 'sqlite-parser'
|
||||
|
||||
export default {
|
||||
name: 'TableDescription',
|
||||
props: ['name', 'sql'],
|
||||
data () {
|
||||
return {
|
||||
colVisible: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
ast () {
|
||||
return sqliteParser(this.sql)
|
||||
},
|
||||
columns () {
|
||||
const columns = []
|
||||
this.ast.statement[0].definition.forEach(item => {
|
||||
if (item.variant === 'column') {
|
||||
let type = item.datatype.variant
|
||||
if (item.datatype.args) {
|
||||
type = type + '(' + item.datatype.args.expression[0].value
|
||||
if (item.datatype.args.expression.length === 2) {
|
||||
type = type + ', ' + item.datatype.args.expression[1].value
|
||||
}
|
||||
type = type + ')'
|
||||
}
|
||||
columns.push({ name: item.name, type: type })
|
||||
}
|
||||
})
|
||||
return columns
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
.table-name, .column {
|
||||
margin-top: 11px;
|
||||
}
|
||||
|
||||
.table-name:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
.columns {
|
||||
margin-left: 24px;
|
||||
}
|
||||
.column-type {
|
||||
display: inline-block;
|
||||
background-color: var(--color-gray-light-4);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: var(--border-radius-small);
|
||||
padding: 2px 6px;
|
||||
font-size: 11px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
</style>
|
||||
@@ -1,132 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div id="tabs__header">
|
||||
<div
|
||||
v-for="(tab, index) in tabs"
|
||||
:key="tab.id"
|
||||
@click="selectTab(tab.id)"
|
||||
:class="[{'tab__selected': (tab.id === selectedIndex)}, 'tab']"
|
||||
>
|
||||
<div class="tab-name">
|
||||
<span v-show="tab.isUnsaved">*</span>
|
||||
<span v-if="tab.name">{{ tab.name }}</span>
|
||||
<span v-else class="tab-untitled">{{ tab.tempName }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<svg
|
||||
class="close-icon"
|
||||
@click.stop="closeTab(index)"
|
||||
width="10"
|
||||
height="10"
|
||||
viewBox="0 0 14 14"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"
|
||||
fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<tab-content
|
||||
v-for="(tab, index) in tabs"
|
||||
:key="tab.id"
|
||||
:id="tab.id"
|
||||
:init-name="tab.name"
|
||||
:tab-index="index"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import TabContent from '@/components/TabContent'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
TabContent
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
tabs () {
|
||||
return this.$store.state.tabs
|
||||
},
|
||||
selectedIndex () {
|
||||
return this.$store.state.currentTabId
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectTab (id) {
|
||||
this.$store.commit('setCurrentTabId', id)
|
||||
},
|
||||
closeTab (index) {
|
||||
this.$store.commit('deleteTab', index)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
#tabs__header {
|
||||
display: flex;
|
||||
margin: 0;
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
#tabs__header .tab {
|
||||
height: 36px;
|
||||
background-color: var(--color-bg-light);
|
||||
border-right: 1px solid var(--color-border-light);
|
||||
border-bottom: 1px solid var(--color-border-light);
|
||||
line-height: 36px;
|
||||
font-size: 14px;
|
||||
color: var(--color-text-base);
|
||||
padding: 0 12px;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
max-width: 200px;
|
||||
display: flex;
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
#tabs__header .tab-name {
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
#tabs__header div:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#tabs__header .tab__selected {
|
||||
color: var(--color-text-active);
|
||||
font-weight: 600;
|
||||
border-bottom: none;
|
||||
}
|
||||
#tabs__header .tab__selected:hover {
|
||||
cursor: default;
|
||||
}
|
||||
#tabs__header .tab__selected:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 5px;
|
||||
background-color: var(--color-accent);
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.close-icon {
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
.close-icon:hover path {
|
||||
fill: var(--color-text-base);
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -1,67 +0,0 @@
|
||||
<template>
|
||||
<div class="view-switcher">
|
||||
<div
|
||||
:class="['table-mode', {'active-mode': view === 'table'}]"
|
||||
@click="$emit('update:view','table')"
|
||||
>
|
||||
Table
|
||||
</div>
|
||||
<div
|
||||
:class="['chart-mode', {'active-mode': view === 'chart'}]"
|
||||
@click="$emit('update:view','chart')"
|
||||
>
|
||||
Chart
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ViewSwitcher',
|
||||
props: ['view']
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.view-switcher {
|
||||
height: 28px;
|
||||
display: flex;
|
||||
padding: 30px;
|
||||
justify-content: center;
|
||||
}
|
||||
.view-switcher div {
|
||||
height: 100%;
|
||||
width: 136px;
|
||||
box-sizing: border-box;
|
||||
line-height: 28px;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
background: var(--color-white);
|
||||
border: 1px solid var(--color-border);
|
||||
color: var(--color-text-base);
|
||||
text-align: center;
|
||||
font-weight: 400;
|
||||
}
|
||||
.view-switcher div:hover {
|
||||
background-color: var(--color-bg-light);
|
||||
color: var(--color-text-active);
|
||||
}
|
||||
.view-switcher div.active-mode {
|
||||
background: var(--color-accent);
|
||||
border: 1px solid var(--color-accent-shade);
|
||||
color: var(--color-text-light);
|
||||
text-shadow: var(--shadow);
|
||||
z-index: 1;
|
||||
font-weight: 600;
|
||||
}
|
||||
.view-switcher div.active-mode:hover {
|
||||
background: var(--color-accent-shade);
|
||||
}
|
||||
.table-mode {
|
||||
border-radius: var(--border-radius-medium) 0 0 var(--border-radius-medium);
|
||||
}
|
||||
.chart-mode {
|
||||
margin-left: -1px;
|
||||
border-radius: 0 var(--border-radius-medium) var(--border-radius-medium) 0;
|
||||
}
|
||||
</style>
|
||||
@@ -1,186 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
ref="container"
|
||||
:class="['splitpanes', `splitpanes--${horizontal ? 'horizontal' : 'vertical'}`, { 'splitpanes--dragging': touch.dragging }]"
|
||||
>
|
||||
<div
|
||||
class="splitpanes__pane"
|
||||
ref="left"
|
||||
:size="paneBefore.size"
|
||||
max-size="30"
|
||||
:style="styles[0]"
|
||||
>
|
||||
<slot name="left-pane" />
|
||||
</div>
|
||||
|
||||
<splitter
|
||||
@mousedown="onMouseDown"
|
||||
@toggle="toggleFirstPane"
|
||||
:expanded="paneBefore.size !== 0"
|
||||
/>
|
||||
|
||||
<div
|
||||
class="splitpanes__pane"
|
||||
ref="right"
|
||||
:style="styles[1]"
|
||||
>
|
||||
<slot name="right-pane" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Splitter from '@/components/splitter'
|
||||
|
||||
export default {
|
||||
name: 'splitpanes',
|
||||
components: { Splitter },
|
||||
props: {
|
||||
horizontal: { type: Boolean, default: false },
|
||||
before: { type: Object },
|
||||
after: { type: Object }
|
||||
},
|
||||
data: () => ({
|
||||
container: null,
|
||||
paneBefore: null,
|
||||
paneAfter: null,
|
||||
beforeMinimising: 20,
|
||||
touch: {
|
||||
mouseDown: false,
|
||||
dragging: false
|
||||
}
|
||||
}),
|
||||
|
||||
computed: {
|
||||
styles () {
|
||||
return [
|
||||
{ [this.horizontal ? 'height' : 'width']: `${this.paneBefore.size}%` },
|
||||
{ [this.horizontal ? 'height' : 'width']: `${this.paneAfter.size}%` }
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
bindEvents () {
|
||||
document.addEventListener('mousemove', this.onMouseMove, { passive: false })
|
||||
document.addEventListener('mouseup', this.onMouseUp)
|
||||
|
||||
// Passive: false to prevent scrolling while touch dragging.
|
||||
if ('ontouchstart' in window) {
|
||||
document.addEventListener('touchmove', this.onMouseMove, { passive: false })
|
||||
document.addEventListener('touchend', this.onMouseUp)
|
||||
}
|
||||
},
|
||||
|
||||
unbindEvents () {
|
||||
document.removeEventListener('mousemove', this.onMouseMove, { passive: false })
|
||||
document.removeEventListener('mouseup', this.onMouseUp)
|
||||
|
||||
if ('ontouchstart' in window) {
|
||||
document.removeEventListener('touchmove', this.onMouseMove, { passive: false })
|
||||
document.removeEventListener('touchend', this.onMouseUp)
|
||||
}
|
||||
},
|
||||
|
||||
onMouseDown () {
|
||||
this.bindEvents()
|
||||
this.touch.mouseDown = true
|
||||
},
|
||||
|
||||
onMouseMove (event) {
|
||||
if (this.touch.mouseDown) {
|
||||
// Prevent scrolling while touch dragging (only works with an active event, eg. passive: false).
|
||||
event.preventDefault()
|
||||
this.touch.dragging = true
|
||||
this.calculatePanesSize(this.getCurrentMouseDrag(event))
|
||||
}
|
||||
},
|
||||
|
||||
onMouseUp () {
|
||||
this.touch.mouseDown = false
|
||||
// Keep dragging flag until click event is finished (click happens immediately after mouseup)
|
||||
// in order to prevent emitting `splitter-click` event if splitter was dragged.
|
||||
setTimeout(() => {
|
||||
this.touch.dragging = false
|
||||
this.unbindEvents()
|
||||
}, 100)
|
||||
},
|
||||
|
||||
// Get the cursor position relative to the splitpane container.
|
||||
getCurrentMouseDrag (event) {
|
||||
const rect = this.container.getBoundingClientRect()
|
||||
const { clientX, clientY } = ('ontouchstart' in window && event.touches) ? event.touches[0] : event
|
||||
|
||||
return {
|
||||
x: clientX - rect.left,
|
||||
y: clientY - rect.top
|
||||
}
|
||||
},
|
||||
|
||||
// Returns the drag percentage of the splitter relative to the 2 panes it's inbetween.
|
||||
// if the sum of size of the 2 cells is 60%, the dragPercentage range will be 0 to 100% of this 60%.
|
||||
getCurrentDragPercentage (drag) {
|
||||
drag = drag[this.horizontal ? 'y' : 'x']
|
||||
// In the code bellow 'size' refers to 'width' for vertical and 'height' for horizontal layout.
|
||||
const containerSize = this.container[this.horizontal ? 'clientHeight' : 'clientWidth']
|
||||
return drag * 100 / containerSize
|
||||
},
|
||||
|
||||
calculatePanesSize (drag) {
|
||||
const dragPercentage = this.getCurrentDragPercentage(drag)
|
||||
// If not pushing other panes, panes to resize are right before and right after splitter.
|
||||
const paneBefore = this.paneBefore
|
||||
const paneAfter = this.paneAfter
|
||||
|
||||
const paneBeforeMaxReached = paneBefore.max < 100 && (dragPercentage >= paneBefore.max)
|
||||
const paneAfterMaxReached = paneAfter.max < 100 && (dragPercentage <= 100 - paneAfter.max)
|
||||
// Prevent dragging beyond pane max.
|
||||
if (paneBeforeMaxReached || paneAfterMaxReached) {
|
||||
if (paneBeforeMaxReached) {
|
||||
paneBefore.size = paneBefore.max
|
||||
paneAfter.size = Math.max(100 - paneBefore.max, 0)
|
||||
} else {
|
||||
paneBefore.size = Math.max(100 - paneAfter.max, 0)
|
||||
paneAfter.size = paneAfter.max
|
||||
}
|
||||
return
|
||||
}
|
||||
paneBefore.size = Math.min(Math.max(dragPercentage, 0), paneBefore.max)
|
||||
paneAfter.size = Math.min(Math.max(100 - dragPercentage, 0), paneAfter.max)
|
||||
},
|
||||
toggleFirstPane () {
|
||||
if (this.paneBefore.size > 0) {
|
||||
this.beforeMinimising = this.paneBefore.size
|
||||
this.paneBefore.size = 0
|
||||
} else {
|
||||
this.paneBefore.size = this.beforeMinimising
|
||||
}
|
||||
this.paneAfter.size = 100 - this.paneBefore.size
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
this.container = this.$refs.container
|
||||
},
|
||||
created () {
|
||||
this.paneBefore = this.before
|
||||
this.paneAfter = this.after
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.splitpanes {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.splitpanes--vertical {flex-direction: row;}
|
||||
.splitpanes--horizontal {flex-direction: column;}
|
||||
.splitpanes--dragging * {user-select: none;}
|
||||
|
||||
.splitpanes__pane {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -1,85 +0,0 @@
|
||||
<template>
|
||||
<div
|
||||
class="splitpanes__splitter"
|
||||
@mousedown="$emit('mousedown')"
|
||||
@touchstart="$emit('mousedown')"
|
||||
>
|
||||
<div class="toggle-btn" @click="$emit('toggle')">
|
||||
<img
|
||||
class="direction-icon"
|
||||
:src="require('@/assets/images/chevron.svg')"
|
||||
:style="directionIconStyle"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'splitter',
|
||||
props: ['expanded'],
|
||||
computed: {
|
||||
directionIconStyle () {
|
||||
const translation = 'translate(-50%, -50%)'
|
||||
if (this.$parent.horizontal) {
|
||||
return {
|
||||
transform: `${translation} ${this.expanded ? 'rotate(-90deg)' : 'rotate(90deg)'}`
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
transform: `${translation} ${this.expanded ? 'rotate(180deg)' : ''}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.splitpanes--vertical > .splitpanes__splitter {min-width: 1px;cursor: col-resize;}
|
||||
.splitpanes--horizontal > .splitpanes__splitter {min-height: 1px; cursor: row-resize;}
|
||||
.splitpanes__splitter {
|
||||
touch-action: none;
|
||||
background-color: var(--color-bg-light-2);
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
flex-shrink: 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.splitpanes--vertical > .splitpanes__splitter {
|
||||
width: 3px;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.splitpanes--horizontal > .splitpanes__splitter {
|
||||
height: 3px;
|
||||
width: 100%;
|
||||
}
|
||||
.splitpanes__splitter .toggle-btn {
|
||||
background-color: var(--color-bg-light-2);
|
||||
border-radius: var(--border-radius-small);
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
.splitpanes__splitter .toggle-btn:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.splitpanes--vertical .toggle-btn {
|
||||
height: 68px;
|
||||
width: 15px;
|
||||
}
|
||||
.splitpanes--horizontal .toggle-btn {
|
||||
width: 68px;
|
||||
height: 15px;
|
||||
}
|
||||
.splitpanes__splitter .toggle-btn .direction-icon {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
</style>
|
||||
@@ -1,21 +0,0 @@
|
||||
<template>
|
||||
<svg class="icon" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.25 15.75H6V5.25H14.25V15.75ZM14.25 3.75H6C5.60218 3.75 5.22064 3.90804 4.93934 4.18934C4.65804 4.47064 4.5 4.85218 4.5 5.25V15.75C4.5 16.1478 4.65804 16.5294 4.93934 16.8107C5.22064 17.092 5.60218 17.25 6 17.25H14.25C14.6478 17.25 15.0294 17.092 15.3107 16.8107C15.592 16.5294 15.75 16.1478 15.75 15.75V5.25C15.75 4.85218 15.592 4.47064 15.3107 4.18934C15.0294 3.90804 14.6478 3.75 14.25 3.75ZM12 0.75H3C2.60218 0.75 2.22064 0.908035 1.93934 1.18934C1.65804 1.47064 1.5 1.85218 1.5 2.25V12.75H3V2.25H12V0.75Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'CopyIcon'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon {
|
||||
vertical-align: middle;
|
||||
margin: 0 12px;
|
||||
}
|
||||
.icon:hover path {
|
||||
fill: var(--color-accent);
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +0,0 @@
|
||||
<template>
|
||||
<svg class="icon" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6.75 2.25V3H3V4.5H3.75V14.25C3.75 14.6478 3.90804 15.0294 4.18934 15.3107C4.47064 15.592 4.85218 15.75 5.25 15.75H12.75C13.1478 15.75 13.5294 15.592 13.8107 15.3107C14.092 15.0294 14.25 14.6478 14.25 14.25V4.5H15V3H11.25V2.25H6.75ZM5.25 4.5H12.75V14.25H5.25V4.5ZM6.75 6V12.75H8.25V6H6.75ZM9.75 6V12.75H11.25V6H9.75Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DeleteIcon'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon {
|
||||
vertical-align: middle;
|
||||
margin: 0 0 0 12px;
|
||||
}
|
||||
|
||||
.icon:hover path {
|
||||
fill: var(--color-accent);
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +0,0 @@
|
||||
<template>
|
||||
<svg class="icon" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.5 1.5H4.5C3.675 1.5 3 2.175 3 3V15C3 15.825 3.675 16.5 4.5 16.5H13.5C14.325 16.5 15 15.825 15 15V6L10.5 1.5ZM13.5 15H4.5V3H9.75V6.75H13.5V15ZM12 8.25V13.575L10.425 12L8.325 14.1L6.225 12L8.325 9.9L6.675 8.25H12Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'ExportIcon'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon {
|
||||
vertical-align: middle;
|
||||
margin: 0 12px;
|
||||
}
|
||||
|
||||
.icon:hover path {
|
||||
fill: var(--color-accent);
|
||||
}
|
||||
</style>
|
||||
@@ -1,22 +0,0 @@
|
||||
<template>
|
||||
<svg class="icon" width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.545 6.75L11.25 7.455L4.44 14.25H3.75V13.56L10.545 6.75ZM13.245 2.25C13.0575 2.25 12.8625 2.325 12.72 2.4675L11.3475 3.84L14.16 6.6525L15.5325 5.28C15.825 4.9875 15.825 4.5 15.5325 4.2225L13.7775 2.4675C13.6275 2.3175 13.44 2.25 13.245 2.25ZM10.545 4.6425L2.25 12.9375V15.75H5.0625L13.3575 7.455L10.545 4.6425Z" fill="#A2B1C6"/>
|
||||
</svg>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'RenameIcon'
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.icon {
|
||||
vertical-align: middle;
|
||||
margin: 0 12px 0 6px;
|
||||
}
|
||||
|
||||
.icon:hover path {
|
||||
fill: var(--color-accent);
|
||||
}
|
||||
</style>
|
||||
22
src/main.js
@@ -1,22 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
import VueReact from 'vue-react'
|
||||
import PlotlyEditor from 'react-chart-editor'
|
||||
|
||||
import '@/assets/styles/variables.css'
|
||||
import '@/assets/styles/buttons.css'
|
||||
import '@/assets/styles/textFields.css'
|
||||
import '@/assets/styles/tables.css'
|
||||
|
||||
Vue.use(VueReact)
|
||||
Vue.react('PlotlyEditor', PlotlyEditor)
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
router,
|
||||
store,
|
||||
render: h => h(App)
|
||||
}).$mount('#app')
|
||||
@@ -1,39 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import Editor from '../views/Editor'
|
||||
import MyQueries from '../views/MyQueries'
|
||||
import DbUpload from '../views/DbUpload'
|
||||
import MainView from '../views/MainView'
|
||||
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Welcome',
|
||||
component: DbUpload
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
name: 'MainView',
|
||||
component: MainView,
|
||||
children: [
|
||||
{
|
||||
path: '/editor',
|
||||
name: 'Editor',
|
||||
component: Editor
|
||||
},
|
||||
{
|
||||
path: '/my-queries',
|
||||
name: 'MyQueries',
|
||||
component: MyQueries
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -1,67 +0,0 @@
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
state: {
|
||||
schema: null,
|
||||
dbFile: null,
|
||||
dbName: null,
|
||||
worker: new Worker('/js/worker.sql-wasm.js'),
|
||||
tabs: [],
|
||||
currentTab: null,
|
||||
currentTabId: null,
|
||||
untitledLastIndex: 0
|
||||
},
|
||||
mutations: {
|
||||
saveSchema (state, schema) {
|
||||
state.schema = schema
|
||||
},
|
||||
saveDbFile (state, file) {
|
||||
state.dbFile = file
|
||||
},
|
||||
saveDbName (state, name) {
|
||||
state.dbName = name
|
||||
},
|
||||
addTab (state, tab) {
|
||||
state.tabs.push(tab)
|
||||
},
|
||||
updateTabName (state, { index, newName }) {
|
||||
const tab = state.tabs[index]
|
||||
tab.name = newName
|
||||
Vue.set(state.tabs, index, tab)
|
||||
},
|
||||
updateTabState (state, { index, newValue }) {
|
||||
console.log(index, newValue)
|
||||
const tab = state.tabs[index]
|
||||
tab.isUnsaved = newValue
|
||||
Vue.set(state.tabs, index, tab)
|
||||
},
|
||||
deleteTab (state, index) {
|
||||
if (state.tabs[index].id !== state.currentTabId) {
|
||||
} else if (index < state.tabs.length - 1) {
|
||||
state.currentTabId = state.tabs[index + 1].id
|
||||
} else if (index > 0) {
|
||||
state.currentTabId = state.tabs[index - 1].id
|
||||
} else {
|
||||
state.currentTabId = null
|
||||
state.untitledLastIndex = 0
|
||||
}
|
||||
state.tabs.splice(index, 1)
|
||||
},
|
||||
setCurrentTabId (state, id) {
|
||||
state.currentTabId = id
|
||||
},
|
||||
setCurrentTab (state, tab) {
|
||||
state.currentTab = tab
|
||||
},
|
||||
updateUntitledLastIndex (state) {
|
||||
state.untitledLastIndex += 1
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
},
|
||||
modules: {
|
||||
}
|
||||
})
|
||||
@@ -1,114 +0,0 @@
|
||||
<template>
|
||||
<div id="dbloader-container">
|
||||
<h1>Sqliteviz</h1>
|
||||
<label for="assetsFieldHandle">
|
||||
<div id="drop-area" @dragover="dragover" @dragleave="dragleave" @drop="drop">
|
||||
<input
|
||||
type="file"
|
||||
id="assetsFieldHandle"
|
||||
@change="loadDb"
|
||||
ref="file"
|
||||
accept=".db"
|
||||
/>
|
||||
<div>
|
||||
Drop the database file to upload here or click to choose a file from your computer.
|
||||
</div>
|
||||
</div>
|
||||
</label>
|
||||
<div id="error" class="error"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DbUpload',
|
||||
data () {
|
||||
return {
|
||||
worker: this.$store.state.worker
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadDb () {
|
||||
const dbName = this.$refs.file.value.substr(this.$refs.file.value.lastIndexOf('\\') + 1)
|
||||
this.$store.commit('saveDbName', dbName)
|
||||
const f = this.$refs.file.files[0]
|
||||
const r = new FileReader()
|
||||
r.onload = () => {
|
||||
this.worker.onmessage = () => {
|
||||
const getSchemaSql = `
|
||||
SELECT name, sql
|
||||
FROM sqlite_master
|
||||
WHERE type='table' AND name NOT LIKE 'sqlite_%';`
|
||||
this.worker.onmessage = event => {
|
||||
this.$store.commit('saveSchema', event.data.results[0].values)
|
||||
this.$router.push('/editor')
|
||||
}
|
||||
this.worker.postMessage({ action: 'exec', sql: getSchemaSql })
|
||||
}
|
||||
this.$store.commit('saveDbFile', r.result)
|
||||
try {
|
||||
this.worker.postMessage({ action: 'open', buffer: r.result }, [r.result])
|
||||
} catch (exception) {
|
||||
this.worker.postMessage({ action: 'open', buffer: r.result })
|
||||
}
|
||||
}
|
||||
r.readAsArrayBuffer(f)
|
||||
},
|
||||
dragover (event) {
|
||||
event.preventDefault()
|
||||
// TODO: Add some visual fluff to show the user can drop its files
|
||||
if (!event.currentTarget.classList.contains('bg-green-300')) {
|
||||
event.currentTarget.classList.remove('bg-gray-100')
|
||||
event.currentTarget.classList.add('bg-green-300')
|
||||
}
|
||||
},
|
||||
dragleave (event) {
|
||||
// Clean up
|
||||
event.currentTarget.classList.add('bg-gray-100')
|
||||
event.currentTarget.classList.remove('bg-green-300')
|
||||
},
|
||||
drop (event) {
|
||||
event.preventDefault()
|
||||
this.$refs.file.files = event.dataTransfer.files
|
||||
this.loadDb()
|
||||
// Clean up
|
||||
event.currentTarget.classList.add('bg-gray-100')
|
||||
event.currentTarget.classList.remove('bg-green-300')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#dbloader-container {
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
h1 {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
label {
|
||||
display: inline-block;
|
||||
border: 1px dashed var(--color-border);
|
||||
padding: 8px;
|
||||
border-radius: var(--border-radius-big);
|
||||
}
|
||||
#drop-area {
|
||||
width: 231px;
|
||||
height: 153px;
|
||||
background-color: var(--color-bg-light-3);
|
||||
border-radius: var(--border-radius-big);
|
||||
color: var(--color-text-base);
|
||||
font-size: 13px;
|
||||
padding: 44px 15px;
|
||||
text-align: center;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
input {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
@@ -1,38 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<splitpanes
|
||||
class="schema-tabs-splitter"
|
||||
:before="{ size: 20, max: 30 }"
|
||||
:after="{ size: 80, max: 100 }"
|
||||
>
|
||||
<div slot="left-pane">
|
||||
<schema />
|
||||
</div>
|
||||
<div slot="right-pane">
|
||||
<tabs />
|
||||
</div>
|
||||
</splitpanes>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Splitpanes from '@/components/splitpanes'
|
||||
import Schema from '@/components/Schema'
|
||||
import Tabs from '@/components/Tabs'
|
||||
|
||||
export default {
|
||||
name: 'Editor',
|
||||
components: {
|
||||
Schema,
|
||||
Splitpanes,
|
||||
Tabs
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.schema-tabs-splitter {
|
||||
height: 100%;
|
||||
margin-left: 6px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,25 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<main-menu />
|
||||
<keep-alive include="Editor">
|
||||
<router-view id="main-view" />
|
||||
</keep-alive>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MainMenu from '@/components/MainMenu'
|
||||
import '@/assets/styles/scrollbars.css'
|
||||
|
||||
export default {
|
||||
name: 'MainView',
|
||||
components: { MainMenu }
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
#main-view {
|
||||
margin-top: 68px;
|
||||
height: calc(100vh - 68px);
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -1,175 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<div id="my-queries-content">
|
||||
<div id="my-queries-toolbar">
|
||||
<div id="toolbar-buttons">
|
||||
<button class="toolbar">Import</button>
|
||||
<button class="toolbar">Export</button>
|
||||
<button class="toolbar">Delete</button>
|
||||
</div>
|
||||
<div id="toolbar-search">
|
||||
<input type="text" placeholder="Search query by name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="rounded-bg">
|
||||
<div class="header-container">
|
||||
<div>
|
||||
<div class="fixed-header" ref="name-th">
|
||||
Name
|
||||
</div>
|
||||
<div class="fixed-header">
|
||||
Created at
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="table-container"
|
||||
ref="table-container"
|
||||
>
|
||||
<table ref="table">
|
||||
<tbody>
|
||||
<tr v-for="(query, index) in queries" :key="query.id" @click="openQuery(index)">
|
||||
<td ref="name-td">
|
||||
{{ query.name }}
|
||||
</td>
|
||||
<td>
|
||||
<div class="second-column">
|
||||
<div class="date-container">{{ query.createdAt | date }}</div>
|
||||
<div class="icons-container">
|
||||
<rename-icon />
|
||||
<copy-icon />
|
||||
<export-icon />
|
||||
<delete-icon />
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import RenameIcon from '@/components/svg/rename.vue'
|
||||
import CopyIcon from '@/components/svg/copy.vue'
|
||||
import ExportIcon from '@/components/svg/export.vue'
|
||||
import DeleteIcon from '@/components/svg/delete.vue'
|
||||
|
||||
export default {
|
||||
name: 'MyQueries',
|
||||
components: {
|
||||
RenameIcon,
|
||||
CopyIcon,
|
||||
ExportIcon,
|
||||
DeleteIcon
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
queries: []
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.queries = JSON.parse(localStorage.getItem('myQueries'))
|
||||
},
|
||||
mounted () {
|
||||
new ResizeObserver(this.calcNameWidth).observe(this.$refs.table)
|
||||
this.calcNameWidth()
|
||||
},
|
||||
filters: {
|
||||
date (value) {
|
||||
if (!value) {
|
||||
return ''
|
||||
}
|
||||
const dateOptions = { year: 'numeric', month: 'long', day: 'numeric' }
|
||||
const timeOptions = {
|
||||
hour12: false,
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
}
|
||||
return new Date(value).toLocaleDateString('en-GB', dateOptions) + ' ' +
|
||||
new Date(value).toLocaleTimeString('en-GB', timeOptions)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
calcNameWidth () {
|
||||
this.$refs['name-th'].style = `width: ${this.$refs['name-td'][0].offsetWidth}px`
|
||||
},
|
||||
openQuery (index) {
|
||||
const tab = this.queries[index]
|
||||
tab.isUnsaved = false
|
||||
this.$store.commit('addTab', tab)
|
||||
this.$store.commit('setCurrentTabId', tab.id)
|
||||
this.$router.push('/editor')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
#my-queries-content {
|
||||
padding: 52px;
|
||||
}
|
||||
|
||||
#my-queries-toolbar {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.rounded-bg,
|
||||
#my-queries-toolbar {
|
||||
margin: 0 auto;
|
||||
max-width: 1500px;
|
||||
width: 100%;
|
||||
}
|
||||
table {
|
||||
margin-top: 0;
|
||||
}
|
||||
tbody tr td {
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
text-overflow: ellipsis;
|
||||
padding: 0 24px;
|
||||
line-height: 40px;
|
||||
}
|
||||
|
||||
tbody tr td:first-child {
|
||||
width: 70%;
|
||||
max-width: 0;
|
||||
}
|
||||
tbody tr td:last-child {
|
||||
width: 30%;
|
||||
max-width: 0;
|
||||
}
|
||||
|
||||
tbody tr:hover td {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
tbody tr:hover td {
|
||||
color: var(--color-text-active);
|
||||
}
|
||||
|
||||
.second-column {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.icons-container {
|
||||
display: none;
|
||||
}
|
||||
.date-container {
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
tbody tr:hover .icons-container {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
@@ -1,13 +0,0 @@
|
||||
import { expect } from 'chai'
|
||||
import { shallowMount } from '@vue/test-utils'
|
||||
import HelloWorld from '@/components/HelloWorld.vue'
|
||||
|
||||
describe('HelloWorld.vue', () => {
|
||||
it('renders props.msg when passed', () => {
|
||||
const msg = 'new message'
|
||||
const wrapper = shallowMount(HelloWorld, {
|
||||
propsData: { msg }
|
||||
})
|
||||
expect(wrapper.text()).to.include(msg)
|
||||
})
|
||||
})
|
||||
@@ -1,14 +0,0 @@
|
||||
const CopyPlugin = require('copy-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
configureWebpack: {
|
||||
plugins: [
|
||||
new CopyPlugin([
|
||||
// This wasm file will be fetched dynamically when we initialize sql.js
|
||||
// It is important that we do not change its name, and that it is in the same folder as the js
|
||||
{ from: 'node_modules/sql.js/dist/sql-wasm.wasm', to: 'js/' },
|
||||
{ from: 'node_modules/sql.js/dist/worker.sql-wasm.js', to: 'js/' }
|
||||
])
|
||||
]
|
||||
}
|
||||
}
|
||||