portal

Marlon 2023-07-28T01:39:19.963519Z

Hello Folks, I hope everyone is doing good. I have a very simple question, is it possible to change the viewer for multiple selected values at the same time in the UI?

Marlon 2023-07-29T19:13:41.289659Z

Hey, just opened the PR: https://github.com/djblue/portal/pull/191 Let me know if you see any problems with it. I'm fairly new to clojure so feedback on my code is always greatly appreciated.

djblue 2023-07-29T19:36:53.333309Z

Thanks again for the PR! Looks / works really well! I added a few stylistic comments.

djblue 2023-07-29T19:38:08.445749Z

For someone fairly new to Clojure, you seem to fairly comfortable within the Portal code base 💯

Marlon 2023-07-30T04:55:46.877989Z

Thanks! It has been a lot of fun working on the change, and like I said, the project it's very well setup and the code is easy to understand.

djblue 2023-07-28T01:41:29.102869Z

No currently, but that should be relatively easy to add. Would you be interested in giving it a shot?

Marlon 2023-07-28T02:03:26.916589Z

Of course! I'm not that familiar with the project yet but I could give it a try. I think it's just a matter of keeping track of the multiple selections indexes and executing the specific viewer function to which of them, right?

djblue 2023-07-28T02:23:38.551349Z

You are correct. The selected contexts are already tracked in state, they just need to be leverage by the code that sets the viewer.

djblue 2023-07-28T02:26:03.574229Z

The first issue is that these functions are ignoring the rest of the selected contexts because they are using these selectors: https://github.com/djblue/portal/blob/master/src/portal/ui/state.cljs#L51-L53

djblue 2023-07-28T02:29:56.174029Z

I think the second issue will be finding the intersection of applicable viewer for the currently selected values

Marlon 2023-07-28T02:54:02.719239Z

Oh nice. And that's true, didn't even thought of the second issue. But you basically need to only show the viewer functions that are applicable for all the selections. So like you said, basically getting the intersection of the result of https://github.com/djblue/portal/blob/a4dd8f1abd631a00ecb56a3917caf7e7d8db4432/src/portal/ui/inspector.cljs#L117 to all the selected indexes, I presume

👍 1
djblue 2023-07-28T03:05:23.246909Z

https://cljdoc.org/d/djblue/portal/0.44.0/doc/dev-guide is some notes for setup and bb dev to get everything started. You can also do ctrl|cmd +`shift` +`o` to open a child portal window to checkout the ui state and other useful info.

Marlon 2023-07-28T13:45:29.277049Z

Started working on it last night and it was pretty easy to get results (the project setup is very easy to understand and use, congrats!). I still haven't done the commands part and it lacks a bunch of proper testing, but here it is an example of it working. There are contributing guidelines for the project or I can just create a new branch and PR after I'm done?

djblue 2023-07-28T16:19:43.280169Z

Awesome! It's looking very good 👌 You can just create a PR when you're done 👍

👍 1
Marlon 2023-07-29T02:44:18.193729Z

I was wondering, do you think it makes sense to apply the same logic to the next and prev viewer function? The current viewer will be considered the viewer for the first selection as normal, but then if you have multiple selections with different viewers it would cycle the intersection possible viewers.

djblue 2023-07-29T03:30:26.796289Z

Yeah, that would be a nice feature addition 👍

Marlon 2023-07-30T18:26:42.616089Z

Hey @djblue, I was not able to find out how to open the embedded portal for calva notebooks in dev mode so I can test my changes. Do you know how could I do that?

djblue 2023-07-30T19:23:14.975149Z

You should be able to launch the dev version of the extension by opening vscode in the extension-vscode directory, then under the Run and Debug tab you should see a Run Portal action.

👍 1
Marlon 2023-07-30T20:07:37.144299Z

Thaanks, it worked as intended, so I'll be updating the PR soon

djblue 2023-07-30T20:08:07.366449Z

Awesome, thanks!

djblue 2023-07-30T20:37:05.931069Z

Merged, thanks again for getting this handy feature implemented. I should be doing a release in the next couple of days 🙏

❤️ 1
Marlon 2023-07-30T21:03:49.531509Z

Thanks for being so helpful. It was my first contribution to an open source project and it was a lot of fun. I’ll be following the project a little bit more closely and may be contributing more in the future

djblue 2023-07-30T22:27:04.914139Z

I'm glad you enjoyed your first contribution, happy to help! Let me know if you run into any other usability issues or improvements you think of 👌

seancorfield 2023-07-28T02:28:50.713519Z

One thing that I would like for Portal is a way to configure a set of "preferred viewers" in order as the default. So you could ask for sequences of maps to use "table" by default and so on. I "workaround" that right now by having ctrl+alt+space 0 to cycle through viewers for the most recent tap>'d values for convenience but it's still "work"...

djblue 2023-07-28T02:31:29.990769Z

Are these predicates something that the user owns?

djblue 2023-07-28T02:32:26.280829Z

If the rules are relatively simple and the data supports metadata, I think you might be able to do a lot with a custom submit function.

djblue 2023-07-28T02:34:40.678959Z

I think supporting order preference would be a bit tricker so I'd rather not support it unless the existing support is insufficient

seancorfield 2023-07-28T02:34:44.574009Z

Hah! Touche... Yeah, I'm already using a custom submitter so that makes perfect sense. Dammit, you already thought of it.

😆 1
djblue 2023-07-28T02:35:11.409459Z

Yeah, the main downside being that metadata needs to be supported

seancorfield 2023-07-28T02:35:18.498889Z

After you gave me the two-Portal-window hints last time, my workflow is just so sweet!

1
djblue 2023-07-28T02:35:43.698609Z

Sad we didn't get to chat at the conj, but I'm glad it's working well for you!

seancorfield 2023-07-28T02:35:51.648629Z

I need to do some videos... I just love what Portal does for me...

❤️ 2
seancorfield 2023-07-28T02:36:02.654939Z

Well, we got to say "Hi!" so that was something...

💯 1
djblue 2023-07-28T02:36:04.797829Z

Have you seen the new expand-inc command

seancorfield 2023-07-28T02:36:18.193839Z

I don't think so...

djblue 2023-07-28T02:36:43.919349Z

With latest portal try shift+space or shift+e a couple of times on a value with a lot of children:ok_hand:

djblue 2023-07-28T02:40:39.211449Z

If the metadata approach doesn't work for you, let me know

seancorfield 2023-07-28T02:42:32.587739Z

Bear in mind, I almost never have focus on the Portal window -- I like to drive it all from the editor keybindings.

djblue 2023-07-28T02:43:33.389529Z

Since expand-inc is available as a command, you should be able to leverage it in the same way you leverage toggle-expand 👍

seancorfield 2023-07-28T02:43:39.803619Z

Link to the docs page with all the keybindings? A quick skim doesn't find it...

djblue 2023-07-28T02:44:41.803139Z

Sorry, they aren't currently available outside of the code https://github.com/djblue/portal/blob/master/src/portal/ui/commands.cljs#L271-L272

djblue 2023-07-28T02:46:03.325289Z

The expand-inc command will expand children from a parent value incrementally

seancorfield 2023-07-28T02:48:31.877219Z

Oh, interesting... I should add a keybinding to remotely invoke that I suspect...

seancorfield 2023-07-28T02:48:53.117069Z

(ok, need to go do chores -- thank you, as always!)