Skip to content

Commit 1f3a63a

Browse files
authored
Add support for more download formats and copying to clipboard (#247)
* Add download formats and add clipboard option * Format * Text is text * Fix for clipboard vs downlad file data url * Add notes about sql helper functions * Upgrade deps * Document all functions * Somehow tsc is working again now * Add new functions * Just onblur for now * Working ok * Fixes for tests * Fix for ee tests * Fix for fmt * Fix graphing, downloading png
1 parent 3e725a9 commit 1f3a63a

22 files changed

+3174
-2672
lines changed

ee/package.json

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,40 @@
1212
},
1313
"devDependencies": {
1414
"@types/better-sqlite3": "^7.5.0",
15-
"@types/cookie-parser": "^1.4.2",
15+
"@types/cookie-parser": "^1.4.3",
1616
"@types/express": "^4.17.13",
1717
"@types/express-session": "^1.17.4",
1818
"@types/js-yaml": "^4.0.5",
1919
"@types/jsesc": "^3.0.1",
2020
"@types/json-stringify-safe": "^5.0.0",
21-
"@types/lodash.debounce": "^4.0.6",
21+
"@types/lodash.debounce": "^4.0.7",
2222
"@types/nanoid": "^3.0.0",
2323
"@types/papaparse": "^5.3.2",
2424
"@types/passport": "^1.0.7",
2525
"@types/react": "17",
2626
"@types/react-dom": "17",
27-
"@types/react-syntax-highlighter": "^13.5.2",
28-
"@typescript-eslint/eslint-plugin": "^5.19.0",
29-
"@typescript-eslint/parser": "^5.19.0",
27+
"@types/react-syntax-highlighter": "^15.5.1",
28+
"@typescript-eslint/eslint-plugin": "^5.25.0",
29+
"@typescript-eslint/parser": "^5.25.0",
3030
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
3131
"cross-env": "^7.0.3",
32-
"electron": "^18.0.4",
32+
"electron": "^18.2.4",
3333
"enzyme": "^3.11.0",
34-
"esbuild": "^0.14.36",
35-
"eslint": "^8.13.0",
36-
"eslint-plugin-jest": "^26.1.4",
37-
"eslint-plugin-react": "^7.29.4",
38-
"eslint-plugin-react-hooks": "^4.4.0",
39-
"jest": "^27.5.1",
34+
"esbuild": "^0.14.39",
35+
"eslint": "^8.15.0",
36+
"eslint-plugin-jest": "^26.2.2",
37+
"eslint-plugin-react": "^7.30.0",
38+
"eslint-plugin-react-hooks": "^4.5.0",
39+
"jest": "^28.1.0",
4040
"prettier": "^2.6.2",
4141
"prettier-plugin-organize-imports": "^2.3.4",
42-
"typescript": "^4.6.3"
42+
"typescript": "^4.6.4"
4343
},
4444
"dependencies": {
45-
"core-js": "^3.22.0",
45+
"core-js": "^3.22.5",
4646
"react-dom": "17"
47+
},
48+
"resolutions": {
49+
"cheerio": "1.0.0-rc.3"
4750
}
4851
}

ee/yarn.lock

Lines changed: 1035 additions & 1358 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,81 +26,81 @@
2626
"e2e-test": "node --unhandled-rejections=throw ./e2e/index.js"
2727
},
2828
"dependencies": {
29-
"@tabler/icons": "^1.64.0",
30-
"ace-builds": "^1.4.14",
31-
"better-sqlite3": "^7.5.1",
29+
"@tabler/icons": "^1.68.0",
30+
"ace-builds": "^1.5.0",
31+
"better-sqlite3": "^7.5.3",
3232
"chart.js": "^3.7.1",
3333
"cookie-parser": "^1.4.6",
34-
"core-js": "^3.22.0",
34+
"core-js": "^3.22.5",
3535
"date-fns": "^2.28.0",
36-
"express": "^4.17.3",
37-
"express-session": "^1.17.2",
36+
"express": "^4.18.1",
37+
"express-session": "^1.17.3",
3838
"js-yaml": "^4.1.0",
3939
"jsdom": "^19.0.0",
4040
"jsesc": "^3.0.2",
4141
"json-stringify-safe": "^5.0.1",
4242
"lodash.debounce": "^4.0.8",
43-
"nanoid": "^3.3.2",
44-
"nodemailer": "^6.7.3",
45-
"openid-client": "^5.1.5",
43+
"nanoid": "^3.3.4",
44+
"nodemailer": "^6.7.5",
45+
"openid-client": "^5.1.6",
4646
"papaparse": "^5.3.2",
47-
"passport": "^0.5.2",
47+
"passport": "^0.5.3",
4848
"preview": "npm:@multiprocess/preview",
4949
"react": "17",
50-
"react-ace": "^10.0.0",
50+
"react-ace": "^10.1.0",
5151
"react-dom": "17",
52-
"react-hotkeys-hook": "^3.4.4",
52+
"react-hotkeys-hook": "^3.4.6",
5353
"react-syntax-highlighter": "^15.5.0",
5454
"shape": "npm:@multiprocess/shape",
5555
"source-map-support": "^0.5.21",
5656
"tmp-promise": "^3.0.3",
5757
"tweetnacl": "^1.0.3",
5858
"tweetnacl-util": "^0.15.1",
59-
"use-debounce": "^7.0.1",
59+
"use-debounce": "^8.0.1",
6060
"xlsx": "^0.18.5"
6161
},
6262
"optionalDependencies": {},
6363
"devDependencies": {
64-
"@dsnp/parquetjs": "^1.1.3",
65-
"@faker-js/faker": "^6.1.2",
64+
"@dsnp/parquetjs": "^1.2.0",
65+
"@faker-js/faker": "^6.3.1",
6666
"@types/better-sqlite3": "^7.5.0",
67-
"@types/cookie-parser": "^1.4.2",
67+
"@types/cookie-parser": "^1.4.3",
6868
"@types/express": "^4.17.13",
6969
"@types/express-session": "^1.17.4",
7070
"@types/js-yaml": "^4.0.5",
7171
"@types/jsesc": "^3.0.1",
7272
"@types/json-stringify-safe": "^5.0.0",
73-
"@types/lodash.debounce": "^4.0.6",
73+
"@types/lodash.debounce": "^4.0.7",
7474
"@types/nanoid": "^3.0.0",
7575
"@types/papaparse": "^5.3.2",
7676
"@types/passport": "^1.0.7",
7777
"@types/react": "17",
7878
"@types/react-dom": "17",
79-
"@types/react-syntax-highlighter": "^13.5.2",
80-
"@typescript-eslint/eslint-plugin": "^5.19.0",
81-
"@typescript-eslint/parser": "^5.19.0",
79+
"@types/react-syntax-highlighter": "^15.5.1",
80+
"@typescript-eslint/eslint-plugin": "^5.25.0",
81+
"@typescript-eslint/parser": "^5.25.0",
8282
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.7",
8383
"cross-env": "^7.0.3",
84-
"electron": "^18.0.4",
84+
"electron": "^18.2.4",
8585
"electron-chromedriver": "^18.0.0",
86-
"electron-packager": "^15.4.0",
86+
"electron-packager": "^15.5.1",
8787
"electron-rebuild": "^3.2.7",
8888
"enzyme": "^3.11.0",
89-
"esbuild": "^0.14.36",
90-
"eslint": "^8.13.0",
91-
"eslint-plugin-jest": "^26.1.4",
92-
"eslint-plugin-react": "^7.29.4",
93-
"eslint-plugin-react-hooks": "^4.4.0",
94-
"jest": "^27.5.1",
89+
"esbuild": "^0.14.39",
90+
"eslint": "^8.15.0",
91+
"eslint-plugin-jest": "^26.2.2",
92+
"eslint-plugin-react": "^7.30.0",
93+
"eslint-plugin-react-hooks": "^4.5.0",
94+
"jest": "^28.1.0",
9595
"license-checker": "^25.0.1",
9696
"node-fetch": "2",
9797
"node-sass": "^7.0.1",
9898
"prettier": "^2.6.2",
9999
"prettier-plugin-organize-imports": "^2.3.4",
100-
"refractor": "^4.5.0",
101-
"selenium-webdriver": "^4.1.1",
102-
"ts-jest": "^27.1.4",
103-
"typescript": "^4.6.3"
100+
"refractor": "^4.7.0",
101+
"selenium-webdriver": "^4.1.2",
102+
"ts-jest": "^28.0.2",
103+
"typescript": "^4.6.4"
104104
},
105105
"version": "0.0.0"
106106
}

runner/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/mattn/go-sqlite3 v1.14.13
2222
github.com/multiprocessio/go-json v0.0.0-20220308002443-61d497dd7b9e
2323
github.com/multiprocessio/go-openoffice v0.0.0-20220110232726-064f5dda1956
24-
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220515132214-0499e13b82b2
24+
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220520203101-c3fc58eca0a1
2525
github.com/neo4j/neo4j-go-driver/v4 v4.4.2
2626
github.com/prometheus/client_golang v1.12.2
2727
github.com/prometheus/common v0.34.0
@@ -32,7 +32,7 @@ require (
3232
github.com/xitongsys/parquet-go v1.6.2
3333
github.com/xitongsys/parquet-go-source v0.0.0-20220315005136-aec0fe3e777c
3434
github.com/xuri/excelize/v2 v2.6.0
35-
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921
35+
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898
3636
google.golang.org/api v0.74.0
3737
)
3838

runner/go.sum

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ github.com/multiprocessio/go-openoffice v0.0.0-20220110232726-064f5dda1956 h1:WV
432432
github.com/multiprocessio/go-openoffice v0.0.0-20220110232726-064f5dda1956/go.mod h1:JMhCobMOTCgIL4EwBPVrRB60Iq9hknRP9mX/MYiWHAc=
433433
github.com/multiprocessio/go-sqlite3 v1.14.14-0.20220513213203-12637a65d5d7 h1:1OnwC0UiVssO2YVo/iU1eDXIha/WBXeK/CgFevo35KY=
434434
github.com/multiprocessio/go-sqlite3 v1.14.14-0.20220513213203-12637a65d5d7/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
435-
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220515132214-0499e13b82b2 h1:7M1WgRKA2wqWNrztqrMHd00j4KD9Ph7beaR+S36SvDc=
436-
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220515132214-0499e13b82b2/go.mod h1:CzeoFLGPKRgVlqqdus5LSlsxYWUktye2PJfg68oRPIM=
435+
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220520203101-c3fc58eca0a1 h1:xA7VIHNVkiWLZ1xdm/+8IlsbbH2CILlaa3NInmHIrts=
436+
github.com/multiprocessio/go-sqlite3-stdlib v0.0.0-20220520203101-c3fc58eca0a1/go.mod h1:0PRccbkw6UmCLbpUHVBuq0yyH7IFAMuug1wvd+TpF40=
437437
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
438438
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
439439
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
@@ -579,8 +579,9 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh
579579
golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
580580
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
581581
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
582-
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921 h1:iU7T1X1J6yxDr0rda54sWGkHgOp5XJrqm79gcNlC2VM=
583582
golang.org/x/crypto v0.0.0-20220408190544-5352b0902921/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
583+
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898 h1:SLP7Q4Di66FONjDJbCYrCRrh97focO6sLogHO7/g8F0=
584+
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
584585
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
585586
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
586587
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=

ui/DownloadPanel.test.jsx

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
const {
2+
htmlTableFormat,
3+
csvFormat,
4+
markdownTableFormat,
5+
} = require('./DownloadPanel');
6+
7+
describe('markdownTableFormat', () => {
8+
test('basic markdown', () => {
9+
expect(
10+
markdownTableFormat(
11+
[
12+
{ name: 'Kimmy', age: 19 },
13+
{ name: 'Alex', age: 20 },
14+
],
15+
[
16+
{ label: 'Name', field: 'name' },
17+
{ label: 'Age', field: 'age' },
18+
]
19+
).text
20+
).toBe(
21+
`
22+
| Name | Age |
23+
| ----- | --- |
24+
| Kimmy | 19 |
25+
| Alex | 20 |
26+
`.trim()
27+
);
28+
});
29+
});
30+
31+
describe('htmlTableFormat', () => {
32+
test('basic html', () => {
33+
expect(
34+
htmlTableFormat(
35+
[
36+
{ name: 'Kimmy', age: 19 },
37+
{ name: 'Alex', age: 20 },
38+
],
39+
[
40+
{ label: 'Name', field: 'name' },
41+
{ label: 'Age', field: 'age' },
42+
]
43+
).text
44+
).toBe(
45+
`
46+
<table class="table">
47+
<thead>
48+
<tr>
49+
<th>Name</th>
50+
<th>Age</th>
51+
</tr>
52+
</thead>
53+
<tbody>
54+
<tr>
55+
<td>Kimmy</td>
56+
<td>19</td>
57+
</tr>
58+
<tr>
59+
<td>Alex</td>
60+
<td>20</td>
61+
</tr>
62+
</tbody>
63+
</table>
64+
`.trim()
65+
);
66+
});
67+
});
68+
69+
describe('csvTableFormat', () => {
70+
test('basic csv', () => {
71+
expect(
72+
csvFormat(
73+
[
74+
{ name: 'Kimmy', age: 19 },
75+
{ name: 'Alex', age: 20 },
76+
],
77+
[
78+
{ label: 'Name', field: 'name' },
79+
{ label: 'Age', field: 'age' },
80+
]
81+
).text
82+
).toBe(
83+
`
84+
Name,Age
85+
Kimmy,19
86+
Alex,20
87+
`.trim()
88+
);
89+
});
90+
91+
test('csv with whitespace and commas', () => {
92+
expect(
93+
csvFormat(
94+
[
95+
{ name: 'Kimmy,', age: '19"' },
96+
{ name: 'Alex', age: ' 20' },
97+
{ name: 'Garbage', age: { x: 12 } },
98+
],
99+
[
100+
{ label: 'Name', field: 'name' },
101+
{ label: ' Age', field: 'age' },
102+
]
103+
).text
104+
).toBe(
105+
`
106+
Name," Age"
107+
"Kimmy,","19\\""
108+
Alex," 20"
109+
Garbage,"{\\"x\\":12}"
110+
`.trim()
111+
);
112+
});
113+
});

0 commit comments

Comments
 (0)