voxpupuli / puppetboard

Web frontend for PuppetDB
https://pypi.org/project/puppetboard/
Apache License 2.0
710 stars 238 forks source link

Structured Fact #445

Closed Poil closed 2 years ago

Poil commented 6 years ago

Hi,

Today structured facts are not displayed fine in Puppetboard. I've test this python library http://json2html.varunmalhotra.xyz/ , it seems to do a pretty job to convert a json tu an html element, I've tried complex structures and it give me satisfaction.

I've checked the code it seems to be easy to add this.

An opinion ?

larsnaesbye commented 6 years ago

Proper display of structured facts would be real nice alright. If you want to give it a go, I'll cheer :-)

mterzo commented 6 years ago

That looks messy, I was thinking something like that.

https://mbraak.github.io/jqTree/

octomike commented 6 years ago

I had a look at this yesterday and I believe this would also be a little messy. If I understand jqtTree correctly the structured facts need to be restructured to match the expected data format:

{
  name: fact key
  children: [{
    name: sub key
    children: [{...}]
  ]}
}

The .tree() calls would have to go into the draw handler of the DataTable, right?

But, do we have to do that with jQuery? I mean, currently the datatable is requesting the fact/table values from the fact_ajax endpoint anyway. Can't we just send properly nested html instead of the raw link?

For instance, with our inventory system we're doing something like this:

nested_list

This could look rather pretty with semantic's accordion I think: https://semantic-ui.com/modules/accordion.html#/examples

emlun007 commented 6 years ago

@octomike , it can be done with dataTables: https://github.com/voxpupuli/puppetboard/pull/452

octomike commented 6 years ago

I believe that's the superior approach. I did some testing with server-side html generation, but that was way too slow. Do you think you can emulate the nested indentation? At least 1 more level would be super useful in most cases I think.

emlun007 commented 6 years ago

@octomike, how did you initialize tree widget on json data?

I have tested on an empty page with json from mount points:

performance_jqtree

First, I can't make it show facts in a readable way. Second, it takes ages for the page to load - 8 seconds for script alone.

gdubicki commented 2 years ago

I think that this issue is outdated and the way structured facts are shown now could be improved but looks good enough:

Screenshot 2021-10-21 at 17 10 25