Skip to content
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

Download all messages in a topic to a csv file #1384

Merged
merged 11 commits into from
Mar 22, 2023

Conversation

graciasrochelle
Copy link
Contributor

@graciasrochelle graciasrochelle commented Feb 22, 2023

Related open issues: #1183

Download all messages in a topic to a csv file:

Topics._.akhq.io.-.Google.Chrome.2023-03-15.23-19-57.mp4

@graciasrochelle graciasrochelle changed the title add download all feature Download all messages in a topic to a csv file Feb 23, 2023
@graciasrochelle
Copy link
Contributor Author

graciasrochelle commented Mar 1, 2023

Hi @tchiotludo, This pr is ready to be reviewed. Could I please have some feedback on it? Thanks in advance

@tchiotludo
Copy link
Owner

@graciasrochelle

  • can you move the select at the beginning of the rows please?
  • can you add the download button on the button bar and changes it to a drop down (with choice of CSV or JSON new line format), disabled by default if no checkbox is selected ?

By this way the functionality will be more visible

@graciasrochelle
Copy link
Contributor Author

Thanks for the feedback @tchiotludo! I will make the changes. Thanks

@graciasrochelle
Copy link
Contributor Author

Hi @tchiotludo, Updated PR. Could you have a look when you have sometime? Thanks in advance

@graciasrochelle
Copy link
Contributor Author

Sorry @tchiotludo I had to fix a code quality issue. Could I get an approval again? Thanks

@graciasrochelle
Copy link
Contributor Author

graciasrochelle commented Mar 6, 2023

Hi @tchiotludo Could you approve again? Sorry had to make a file change. I ran it locally, the build passes now.

@graciasrochelle
Copy link
Contributor Author

All builds have passed. Is it possible to merge these changes? thanks in advance

@tchiotludo
Copy link
Owner

hey @graciasrochelle, almost done but you need to move the button on the bottom bar please :
image

thanks 👍

@graciasrochelle
Copy link
Contributor Author

Sorry I must have missed that. I will make the change

@graciasrochelle
Copy link
Contributor Author

Hi @tchiotludo, I have updated my pr. It's ready to be reviewed again. Thanks in advance

@Shekark8
Copy link

Hi @tchiotludo thank you for the amazing tool. can you please review this PR.

@rajeshsub
Copy link

Hi @tchiotludo I am interested in this feature as well and will help if you could please approve the PR. Thank you so much for AKHQ!

@graciasrochelle
Copy link
Contributor Author

Hi @tchiotludo Sorry to bother you. But any chance you can approve this PR. We wanted to use this feature once merged.

@tchiotludo tchiotludo merged commit 9e402c6 into tchiotludo:dev Mar 22, 2023
@rajeshsub
Copy link

Thank you so much for this feature @graciasrochelle and thank you @tchiotludo for approving the PR. :-)

@AlexisSouquiere
Copy link
Collaborator

AlexisSouquiere commented Mar 24, 2023

@graciasrochelle I think there is an issue with the download feature.
Why did you add this when you build the messages to export array ?

allData.push('\n');

When I test it (CSV or JSON) it leads to wrong file format because there is extra commas for each line except the 1st one due to this \n.

image

Moreover I think the csv or json option can be confusing because exporting in CSV or JSON produces the same file. It's just the extension that changes
image

@tchiotludo FYI

@graciasrochelle
Copy link
Contributor Author

Hi @AlexisSouquiere Thanks for flagging this. Maybe I misunderstood the export to csv requirement. I will update to remove the new line. And also try and edit the csv file to be more meaningful. Will update it this weekend. Sorry for the inconvenience caused.

markush81 added a commit to markush81/akhq that referenced this pull request Mar 26, 2023
…search-avro-schema-subject

* commit '9e402c63949e868f877b5dc3940aa618ee89e901':
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
markush81 added a commit to markush81/akhq that referenced this pull request Mar 26, 2023
* commit '9e402c63949e868f877b5dc3940aa618ee89e901':
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
@graciasrochelle
Copy link
Contributor Author

@graciasrochelle I think there is an issue with the download feature. Why did you add this when you build the messages to export array ?

allData.push('\n');

When I test it (CSV or JSON) it leads to wrong file format because there is extra commas for each line except the 1st one due to this \n.

image

Moreover I think the csv or json option can be confusing because exporting in CSV or JSON produces the same file. It's just the extension that changes image

@tchiotludo FYI

Hi @AlexisSouquiere, I was having a look at the CSV file, I am not sure if much can be done. I don't know if the headers are static or dynamic. If we know what the headers will be then the file can be made more relevant. What are your thought on this?

@AlexisSouquiere
Copy link
Collaborator

For me headers are not important. If people wants raw data (not JSON I mean) to be exported, CSV is a good option we will just create a file with one record by row. Then people can use the file as they like. The file has a CSV extension but it can be CSV or plain text inside.

JSON export can be interesting to export JSON/Avro records but the file content has to be JSON-compliant. So we should build it as a JSON array and each array item is one of the records you want to export

[
   { "field1": 1, "field2", "xxx" }, // 1st record
   { "field1": 1, "field2", "xxx" } // 2nd record
]

@jheinitz
Copy link
Contributor

jheinitz commented Mar 28, 2023

Hello!

I opened the issue regarding the download of all messages (#1183) some time ago. Thanks @graciasrochelle for implementing this!

I want to share my thoughts on the discussion regarding the messge format. I agree with @AlexisSouquiere that we should either create a simple plain CSV file without any JSON elements OR a JSON-compliant file.

What we have now is better than nothing and I don't know how difficult it is to create a JSON-compliant file, but it would be perfect to have the option to choose between the two options and create two different files.

Thanks again and kind regards

Jens

@AlexisSouquiere
Copy link
Collaborator

@graciasrochelle I have created #1442 to fix the issues I mentionned.
Now exporting in JSON will creates a JSON-compliant file (JSON array with parsed messages - warning message will be displayed is messages are not in JSON).
The CSV export can export all the format and we won't have any extra commas for each message

JSON export
image

Same topic but in CSV format
image

CSV topic
image

@tchiotludo it was the last comment that I had regarding the next version release

tchiotludo pushed a commit that referenced this pull request Apr 4, 2023
markush81 added a commit to markush81/akhq that referenced this pull request Apr 7, 2023
* dev: (56 commits)
  chore(version): update to 0.24.0
  chore(deps): update java deps
  fix(ui): fixing logo not showing on login form (tchiotludo#1449)
  fix(ui): fixing data download inconsistencies on JSON and CSV format (tchiotludo#1442)
  chore(docs): add GrtGaz as AKHQ user (tchiotludo#1439)
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
  fix(ui): clicking on Empty Topic button display blank screen (tchiotludo#1429)
  chore(landing): add baloise logo (tchiotludo#1427)
  fix(ui): don't disabled empty for compact,delete topic
  chore(deps): update all java deps
  fix(topicdata): Use the partition leader from partition info (tchiotludo#1388)
  fix(ui):  harmonize utc labels (tchiotludo#1403)
  fix(ui): fix produce multi / tombstone not working and forms layout issue (tchiotludo#1396)
  fix(auth): fix regex header string for long strim (tchiotludo#1402)
  fix(webserver): reduce default micronaut log to warn  (tchiotludo#1406)
  chore(webserver): warn if security group is wet without a jwt secret (tchiotludo#1412)
  chore(deps): update micronaut (tchiotludo#1405)
  feat(docs): list of available roles in documentation (tchiotludo#1394)
  chore(deps): update all java deps
  fix(ui): handle sche subject with special chars (tchiotludo#1354)
  ...

# Conflicts:
#	build.gradle
#	gradle.properties
#	helm/akhq/Chart.yaml
#	src/test/java/org/akhq/controllers/KsqlDbControllerTest.java
#	src/test/java/org/akhq/repositories/KsqlDbRepositoryTest.java
markush81 added a commit to markush81/akhq that referenced this pull request Apr 7, 2023
* dev: (56 commits)
  chore(version): update to 0.24.0
  chore(deps): update java deps
  fix(ui): fixing logo not showing on login form (tchiotludo#1449)
  fix(ui): fixing data download inconsistencies on JSON and CSV format (tchiotludo#1442)
  chore(docs): add GrtGaz as AKHQ user (tchiotludo#1439)
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
  fix(ui): clicking on Empty Topic button display blank screen (tchiotludo#1429)
  chore(landing): add baloise logo (tchiotludo#1427)
  fix(ui): don't disabled empty for compact,delete topic
  chore(deps): update all java deps
  fix(topicdata): Use the partition leader from partition info (tchiotludo#1388)
  fix(ui):  harmonize utc labels (tchiotludo#1403)
  fix(ui): fix produce multi / tombstone not working and forms layout issue (tchiotludo#1396)
  fix(auth): fix regex header string for long strim (tchiotludo#1402)
  fix(webserver): reduce default micronaut log to warn  (tchiotludo#1406)
  chore(webserver): warn if security group is wet without a jwt secret (tchiotludo#1412)
  chore(deps): update micronaut (tchiotludo#1405)
  feat(docs): list of available roles in documentation (tchiotludo#1394)
  chore(deps): update all java deps
  fix(ui): handle sche subject with special chars (tchiotludo#1354)
  ...

# Conflicts:
#	build.gradle
#	docker-compose-dev.yml
#	docker-compose.yml
#	gradle.properties
#	helm/akhq/Chart.yaml
#	src/test/java/org/akhq/controllers/KsqlDbControllerTest.java
#	src/test/java/org/akhq/repositories/KsqlDbRepositoryTest.java
markush81 added a commit to markush81/akhq that referenced this pull request Apr 7, 2023
* dev: (56 commits)
  chore(version): update to 0.24.0
  chore(deps): update java deps
  fix(ui): fixing logo not showing on login form (tchiotludo#1449)
  fix(ui): fixing data download inconsistencies on JSON and CSV format (tchiotludo#1442)
  chore(docs): add GrtGaz as AKHQ user (tchiotludo#1439)
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
  fix(ui): clicking on Empty Topic button display blank screen (tchiotludo#1429)
  chore(landing): add baloise logo (tchiotludo#1427)
  fix(ui): don't disabled empty for compact,delete topic
  chore(deps): update all java deps
  fix(topicdata): Use the partition leader from partition info (tchiotludo#1388)
  fix(ui):  harmonize utc labels (tchiotludo#1403)
  fix(ui): fix produce multi / tombstone not working and forms layout issue (tchiotludo#1396)
  fix(auth): fix regex header string for long strim (tchiotludo#1402)
  fix(webserver): reduce default micronaut log to warn  (tchiotludo#1406)
  chore(webserver): warn if security group is wet without a jwt secret (tchiotludo#1412)
  chore(deps): update micronaut (tchiotludo#1405)
  feat(docs): list of available roles in documentation (tchiotludo#1394)
  chore(deps): update all java deps
  fix(ui): handle sche subject with special chars (tchiotludo#1354)
  ...

# Conflicts:
#	build.gradle
#	client/src/containers/Topic/Topic/Topic.jsx
#	client/src/containers/Topic/Topic/TopicData/TopicData.jsx
#	gradle.properties
#	helm/akhq/Chart.yaml
#	src/test/java/org/akhq/controllers/KsqlDbControllerTest.java
#	src/test/java/org/akhq/repositories/KsqlDbRepositoryTest.java
markush81 added a commit to markush81/akhq that referenced this pull request May 1, 2023
* dev: (62 commits)
  chore(docker): add unless-stopped (tchiotludo#1445)
  fix(connect): sort throw exception (tchiotludo#1431)
  chore(build): add idea-ext on build.gradle (tchiotludo#1446)
  fix(topicdata): no topic data when 1 record with newest sort  (tchiotludo#1466)
  fix(topicdata): search can failed data pagination with many results (tchiotludo#1468)
  chore(schema): typos
  chore(version): update to 0.24.0
  chore(deps): update java deps
  fix(ui): fixing logo not showing on login form (tchiotludo#1449)
  fix(ui): fixing data download inconsistencies on JSON and CSV format (tchiotludo#1442)
  chore(docs): add GrtGaz as AKHQ user (tchiotludo#1439)
  feat(ui): download all messages in a topic to a csv file (tchiotludo#1384)
  fix(ui): clicking on Empty Topic button display blank screen (tchiotludo#1429)
  chore(landing): add baloise logo (tchiotludo#1427)
  fix(ui): don't disabled empty for compact,delete topic
  chore(deps): update all java deps
  fix(topicdata): Use the partition leader from partition info (tchiotludo#1388)
  fix(ui):  harmonize utc labels (tchiotludo#1403)
  fix(ui): fix produce multi / tombstone not working and forms layout issue (tchiotludo#1396)
  fix(auth): fix regex header string for long strim (tchiotludo#1402)
  ...

# Conflicts:
#	.env
#	build.gradle
#	client/src/containers/Topic/Topic/TopicData/TopicData.jsx
#	gradle.properties
#	helm/akhq/Chart.yaml
#	src/main/java/org/akhq/controllers/SchemaController.java
#	src/test/java/org/akhq/controllers/KsqlDbControllerTest.java
#	src/test/java/org/akhq/repositories/KsqlDbRepositoryTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants