portal

2024-10-21T12:43:37.699389Z

Is there a viewer that can nav and expand a nested value in place instead of showing it as a single top-level item? For example I would like to nav on the 1 under ArtistId and have it expand in place:

2024-10-22T11:24:49.162369Z

Interesting, that might work. If I override the nav command, get the nested value, assoc it into the original value, replace the original value in taplist and then send the command to expand it.

djblue 2024-10-23T03:47:18.592389Z

Another option I've been considering is having a fn viewer that could transform selected values, kinda like some of the parse viewers. This could operate off of any registered fn effectively turning any command into a viewer. nav would have to be treated a little special but that wouldn't be too difficult. Does something like that sound like a good solution to your problem?

2024-10-21T12:44:19.451509Z

The default inspector viewer will open it as a single item:

2024-10-21T12:45:11.805539Z

Here is the data structure from the example:

(do
    (tap>
     (with-meta
       {:AlbumId 1
        :Title "track name"
        :ArtistId 1}
       {'clojure.core.protocols/nav
        (fn [_ k v]
          (if (= k :ArtistId)
            {:ArtistId 1
             :Name "artist name"}
            k))}))
    (tap> (pv/markdown "Before naving:"))
    (tap>
     {:AlbumId 1
      :Title "track name"
      :ArtistId {:ArtistId 1
                 :Name "artist name"}})
    (tap> (pv/markdown "Desired after naving:")))

chromalchemy 2024-10-22T00:29:35.868309Z

Afik you can send cljs commands to the portal instance, after eval, to navigate to desired (nested) val.

2024-10-23T07:45:10.432029Z

That sounds useful. Is the reason for nav being special because it needs to make a rountrip to jvm or some other reason?

djblue 2024-10-23T11:24:05.333089Z

Nav is special because it needs three params [coll k v] that would be implicitly generated when selecting a value.

👍 1
chromalchemy 2024-10-24T15:40:46.770469Z

Im interested in maybe easier (or more direct) on the fly navigation/customization of the view