Group Livebook Smart Cells in Parent Item in Dropdown

Hi guys

I’m developing a Kino with a bunch of Smart Cells and I’d like to offer them inside a parent group in the “+ Smart” dropdown similar to the “Database connection” item in the screenshot below. Does anybody know if/how I can achieve this?

I can register the Smart Cells but they just appear in the top level of the dropdown.

Thanks, Michael

Hey, there is currently no API for this. Also note that the idea behind sub-group is to show multiple variants of the same cell, just to pick the right optional dependencies (“Database connection” is always the same cell, with database type select). Could you elaborate on your use case? Are these separate smart cells and how are they related?

Hey @jonatanklosko

Thanks for taking the time to reply. This is still work in progress. I’m working on kino_k8s, a Kino that should help people learn how to use the k8s library. The Smart Cells are mostly meant to be used for code generation. But they can also be used to interact with a Kubernetes cluster.

The concept is similar to kino_db. You first need to configure a connection (to the Kubernetes Cluster) before you can use the other cells (Get Resource, List Resources, Apply Resource).

the idea behind sub-group is to show multiple variants of the same cell, just to pick the right optional dependencies

Yes I noticed that once kino_db is installed, the cells are no longer inside the sub-group and it’s actually just 2 smart cells.

In my case, there are currently 4 smart cells. Technically they could be done in 2 but I don’t see the benefit in that. So i’d find it nice if these cells were inside a group labeled “Kubernetes” or “Kino K8s” or so. Because names like “Get Resource” has give the user much meaning among all the other cells. Now since there is no such API I might prefix the cell names or rename them to something like “Get K8s Resource”.

If you have a k8s cluster at hand and want to see the Kino in action (as I said, it’s still WIP. Mostly lacks error handling and assistance):

Mix.install([{:kino_k8s, github: "mruoss/kino_k8s"}])

Thanks, Michael

I would say the reason to have 2 instead of 4 is exactly so they can all be grouped, similar to kino_db and kino_bumblebee.

Yes, obviously that’s the benefit of having only two - hence my post in the first place. But it also makes the code more complex and difficult to maintain.

Besides that, in my kino, one cell configures the editor in init/2. As far as I understand, this cannot be activated/deactivated anymore after init/2. So I need at least 3 cells (connection, cells with editor, cells without). And I’m still not sure I wanna go merging the logic of the cells.

The editor is a good point. Maybe we should allow grouping of cells then.