Skip to content

Commit 43f8837

Browse files
authored
Fixes data export feature (#2688)
* Fixes data export feature * Makes prettier happy * Makes prettier happy
1 parent 7cd50ee commit 43f8837

File tree

4 files changed

+66
-60
lines changed

4 files changed

+66
-60
lines changed

src/dispatch/static/dispatch/package-lock.json

Lines changed: 58 additions & 54 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dispatch/static/dispatch/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
"lint:fix": "eslint src --fix"
1111
},
1212
"dependencies": {
13+
"@json2csv/plainjs": "^6.1.1",
14+
"@json2csv/transforms": "^6.1.1",
1315
"@koumoul/vjsf": "^2.5.2",
1416
"@openid/appauth": "^1.3.1",
1517
"@sentry/browser": "^6.3.5",
@@ -19,7 +21,6 @@
1921
"date-fns": "^2.21.1",
2022
"date-fns-tz": "^1.1.6",
2123
"font-awesome": "^4.7.0",
22-
"json2csv": "^5.0.7",
2324
"lodash": "^4.17.21",
2425
"mjml": "^4.9.3",
2526
"monaco-editor": "^0.33.0",

src/dispatch/static/dispatch/src/incident/TableExportDialog.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ export default {
228228
this.exportLoading = false
229229
this.closeExport()
230230
})
231-
.catch(() => {
231+
.catch((error) => {
232+
console.log(error)
232233
this.exportLoading = false
233234
this.closeExport()
234235
})

src/dispatch/static/dispatch/src/util/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Parser, flatten } from "json2csv/dist/json2csv.umd"
1+
import { Parser } from "@json2csv/plainjs"
2+
import { flatten } from "@json2csv/transforms"
23

34
const toggleFullScreen = () => {
45
let doc = window.document
@@ -28,9 +29,8 @@ const toggleFullScreen = () => {
2829
}
2930

3031
const exportCSV = function (items, fileName) {
31-
const opts = { transforms: [flatten()] }
32-
const parser = new Parser(opts)
33-
const csv = parser.parse(items)
32+
const json2csvParser = new Parser({ transforms: [flatten()] })
33+
const csv = json2csvParser.parse(items)
3434
const data = "data:text/csv;charset=utf-8," + encodeURIComponent(csv)
3535
const link = document.createElement("a")
3636
link.setAttribute("href", data)

0 commit comments

Comments
 (0)