frigate icon indicating copy to clipboard operation
frigate copied to clipboard

Support for formatted json inside the table for helm configurations

Open raul1991 opened this issue 4 years ago • 5 comments

It would be nice to have the json formatted properly inside a table cell rather a single huge line of json.

raul1991 avatar Sep 02 '20 18:09 raul1991

I agree this would be great. It is straight forward to update json.dumps to specify add indentation and sorting. Here's an example from Stack Overflow. I would suggest an indentation of two would be appropriate here.

https://github.com/rapidsai/frigate/blob/d138d180c702165c1fd63b5a49ec90359d14282e/frigate/gen.py#L233

However this means that some will now run over multiple lines and so all the templates will need updating to support this.

https://github.com/rapidsai/frigate/blob/d138d180c702165c1fd63b5a49ec90359d14282e/frigate/templates/html.jinja2#L47 https://github.com/rapidsai/frigate/blob/d138d180c702165c1fd63b5a49ec90359d14282e/frigate/templates/markdown.jinja2#L22 https://github.com/rapidsai/frigate/blob/d138d180c702165c1fd63b5a49ec90359d14282e/frigate/templates/rst.jinja2#L30

jacobtomlinson avatar Sep 09 '20 09:09 jacobtomlinson

Just for my understanding ...

The {{default}} will be a multi line json so each block of it lying on separate line needs to back-ticked so as to form a correctly formatted json ?

Like this ?

image

raul1991 avatar Nov 07 '20 16:11 raul1991

or probably using html code to create table like this

https://stackoverflow.com/questions/28508141/code-block-inside-table-row-in-markdown/60502719#60502719

raul1991 avatar Nov 07 '20 16:11 raul1991

Changed the code a bit and it looks beautiful with 4 indents, will push the code soon.

image

raul1991 avatar Nov 07 '20 17:11 raul1991

Awesome I look forward to reviewing the PR!

jacobtomlinson avatar Nov 09 '20 10:11 jacobtomlinson