-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use xlsx instead of kotlin-csv #70
Conversation
scavenger-api/src/main/kotlin/com/navercorp/scavenger/controller/SnapshotController.kt
Outdated
Show resolved
Hide resolved
|
@@ -85,6 +85,8 @@ import SnapshotForm from "./SnapshotForm.vue"; | |||
import Momnet from "moment"; | |||
import {useStore} from "../util/store"; | |||
import {ElMessageBox, ElNotification} from "element-plus"; | |||
import * as Xlsx from 'xlsx' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, the delimiter was tab. Is this the same in xsx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In xlsx, the default field separator delimiter is ,
https://www.npmjs.com/package/xlsx#delimiter-separated-output
If we use vue-json-csv, we can use like below.
But...There was a problem in the process of receiving data asynchronously when a click event occurred. |
588c26e
to
20e912c
Compare
@@ -105,31 +97,12 @@ class SnapshotController( | |||
) | |||
} | |||
|
|||
@GetMapping("/customers/{customerId}/snapshot/{snapshotId}/export", produces = ["text/csv"]) | |||
@GetMapping("/customers/{customerId}/snapshots/{snapshotId}/export") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also rename the methods across the board?
It seems like it's now an API to get all snapshot nodes rather than export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d6d4a4e
d6d4a4e
to
de84c20
Compare
There is no body size limit for HTTP responses, but added paging because it can take a long time to parse large size JSON data in the browser. |
146dd31
to
f2b4e9f
Compare
@@ -30,7 +30,9 @@ | |||
"splitpanes": "^3.1.5", | |||
"vue": "^3.2.41", | |||
"vue-i18n": "^9.2.2", | |||
"vue-router": "^4.1.6" | |||
"vue-loading-overlay": "^6.0.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
private val sql: SnapshotNodeSql = super.sqls(::SnapshotNodeSql) | ||
|
||
fun findAllExportSnapshotNode( | ||
fun selectAllExportSnapshotNode( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use find here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 90c8f8a
} | ||
|
||
utils.book_append_sheet(workBook, workSheet); | ||
writeFile(workBook, `snapshot_${id}.csv`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could u explain why xlsx should be created in fe layer? what was your intention here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened this issue #69.
In my opinion... it has the advantage of not handling IO on the server and doesn't require direct control of FE's DOM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is really necessary.
This fix blocks the way directly download excel using curl. Moreover, it always need to use the browser.
Instead of this... what about adding excel download beside of csv?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@junoyoon
I hadn't considered downloading excel via curl. 😭
I think that's a good way to go,
@sohyun-ku please comment as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hadn't considered using curl too..haha..
what about adding excel download beside of csv?
Before I did this PR, there was already excel download feature, what does this mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@junoyoon Please check out sohyun`s comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sohyun-ku @taeyeon-Kim
Sorry for late response. I was too busy.. :-(
It was csv export feature not excel.
And csv is created in server side.
So it's callable using cli
I think we should make it server side job (not fe).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for explaining :)
I didn't think someone can use cli when using csv export feature...
We have already a csv export feature on the server side before this PR.
So I'll close this PR.
Co-authored-by: taeyeonKim <[email protected]>
efe32b6
to
90c8f8a
Compare
#69
I used
xlsx
instead ofvue-json-csv
. Becuz I want to create a csv file after fetching the snapshot data using callback.