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

display event in table format #1642

Closed
sehz opened this issue Sep 16, 2021 · 3 comments
Closed

display event in table format #1642

sehz opened this issue Sep 16, 2021 · 3 comments
Assignees
Milestone

Comments

@sehz
Copy link
Contributor

sehz commented Sep 16, 2021

Given some arbitrary records such as:

/hfp/v2/journey/ongoing/vp/bus/0012/01912/1018N/1/Munkkivuori/23:43/1304201/4/60;24/28/07/67,b'{"VP":{"desi":"18N","dir":"1","oper":12,"veh":1912,"tst":"2021-08-12T21:19:01.449Z","tsi":1628803141,"spd":4.17,"hdg":269,"lat":60.206389,"long":24.877886,"acc":-0.36,"dl":-59,"odo":11853,"drst":0,"oday":"2021-08-12","jrn":21,"line":48,"start":"23:43","loc":"GPS","stop":1304201,"route":"1018N","occu":0}}'

CLI should be able to output in following format after consume

$ fluvio consume bus_events --output table --table <TBD> 

time  line     lat          long 
----  ------   ----         -----
8-12  48       60.206389    24.877886
8-12  49.      70.11111111     33.2211111

If there are more events than display then data should scroll down but not header.

@tjtelan
Copy link
Contributor

tjtelan commented Oct 12, 2021

The arbitrary record we're covering needs to be pre-filtered such that the resulting record is a json object at the moment we render to the user.

A consequence is that if data isn't json, a user will need to use a smartstream to prepare their record for table support

@tjtelan
Copy link
Contributor

tjtelan commented Oct 12, 2021

Thinking that the --table flag should support selecting fields (by key) in the json object to use as column headers (perhaps as a csv to begin with). If no columns specified, use all of the root-level keys as headers.

A weird edge to consider is selecting a header that has spaces. Documentation for how to do this might suffice.

We'll also want to support renaming the headers.

@sehz sehz added this to the 0.9.11 milestone Oct 18, 2021
@nacardin nacardin modified the milestones: 0.9.11, 0.9.12 Oct 21, 2021
@tjtelan
Copy link
Contributor

tjtelan commented Oct 21, 2021

This needs to be split into 2 different issues. The actual display of the json data to the user in a table (which is covered in this issue), and the pre-filtering/transformation of the json prior to printing (#1793).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants