3ofcoins/chef-browser

JSON view instead of current table view

Closed this issue · 4 comments

joerg commented

Hi,

I started working on chef-browser because the tabular view of Attributes/DataBags etc. is in my eyes pretty much unusable. While I understand that this may be a nice view/feature if you want to change an attribute within ruby code (thats when you can simply copy/paste the path), this is not what people are used to, which is simple JSON.
chef-browser-json-view

What I did so far was:

  • Updated all dependencies to their latest versions
  • Switched from pygments.rb to Rouge [1] for a pure Ruby implementation.
  • View of Attributes/DataBags/Nodes etc. as JSON instead of tables.

Now I am pretty sure there were some good reasons why you chose this tabular view, this is why I wanted to ask if you are interested in the changes I made and how we maybe could incorporate both views if the tabular view is what you think is better. What are you thoughts on this?

[1] http://rouge.jneen.net/

Hi, the flattened json representation is a conscious design decision and as far as I am aware, there are no plans to render bare json files. If you want to retrieve json data, you can do so using knife. @mpasternacki, what do you think about additionally showing raw json?

The table view with incremental search is pretty much the feature of Chef Browser. The use case is to easily see all the levels of nesting that is hard to remember off the top of your head; just typing, say, mysql (or even password) in the incremental search immediately provides information that used to take a lot of effort to get to with plain JSON. I believe that if you prefer to work with plain JSON, you might enjoy the tool named knife a lot more.

What exactly is use case, and how do you imagine usability of throwing 7605 lines (not an exaggeration, just ran knife node show -F json -l headquarters | wc -l) of raw JSON at user and telling them to find what they need in there? Find using what, Ctrl+F in the browser? Copying and pasting to Emacs/Vim? The uselessness of this amount of raw JSON was exactly the inspiration for Chef Browser UI. Especially that knife is pretty much great tool if you need or want to work with raw JSON.

Rouge might be a good idea. How does it compare feature–wise to Pygments? In particular, the amount of supported languages is interesting to me. This choice has been made some time ago, and it seems that Rouge has matured a bit since. If you could isolate that feature (it's a good practice in general to do pull requests for a single feature only), it would be nice.

joerg commented

Regarding Rouge: So far I was just playing around, hacking a bit, just to see how much effort it would be to use Rouge and render JSON. Rouge has some really nice features (e.g. search for a lexer based on the file name/extenstion) and it rendered everything I was throwing at it nicely. If there is time I will send you a pull request or at least point you to my sources so you can cherry pick them.

Regarding JSON vs. Tabular view: I think you are right. The incremental search is a really great feature and makes searching easier. This has mostly been a problem of some of my colleagues and I am afraid they really "Ctrl + F" in their browser and often even worse copy/pase into vi (no, not vim) to work with it. So for now, I think I won't be spending to much time on this, but if I do I make everything optional and come back to you when there is something to show off with. ;)

Thanks a lot...

BTW, if you are concerned about giving your colleagues read/write access to Chef server, with Chef server 12 you can use ACLs and groups to create read-only users, so that knife access is not more dangerous than Chef Browser. If your colleagues would prefer to work with raw JSON in vi (nothing wrong with that! It's just a different usage scenario from that of Chef Browser), I suppose they may feel more comfortable with command line tool than with a web UI.