portal

https://github.com/djblue/portal
firstclassfunc 2020-12-30T22:02:31.088700Z

This is super cool, I have a complex data structure I want to visualize thats driven by bb command line. Is there a way to use portal as a super print-table from within by bb script?

firstclassfunc 2020-12-31T14:32:40.089100Z

Hi @djblue yea the problem I think is I can’t block the thread so when bb completes it breaks the connection to the portal

firstclassfunc 2020-12-31T17:32:14.089300Z

And is there docs on adding meta data

djblue 2020-12-31T19:22:58.089500Z

It's not currently documented but an example can be found here: https://github.com/djblue/portal/blob/master/src/examples/data.cljc#L82

πŸ‘ 1
djblue 2020-12-31T19:23:35.089900Z

(with-meta <data> {:portal.viewer/default :portal.viewer/table}) should work

djblue 2020-12-31T19:24:49.090100Z

I am not sure what you mean by can't block the thread. As long as the bb script is running, you should always be able to send data to portal.

djblue 2020-12-31T19:25:10.090300Z

Data is always sent async to portal

firstclassfunc 2020-12-31T19:27:23.090600Z

yea the problem is my script calls an api, transforms some data spits out an output and exits. So I launch portal but then script exits leaving it orphaned

djblue 2020-12-31T19:28:17.090800Z

Is there a problem with keeping the bb script running?

firstclassfunc 2020-12-31T19:31:11.091Z

well thats the part I am confused about i.e. keeping the script blocked while user examines portal, then exit script when portal closes

djblue 2020-12-31T19:32:20.091200Z

Ohh, are you are asking how to keep bb from exiting? https://github.com/djblue/portal/blob/master/src/portal/main.clj#L26 is how I do it for portal.main

djblue 2020-12-31T19:32:55.091500Z

You can also add

(.addShutdownHook
     (Runtime/getRuntime)
     (Thread. #(p/close)))
To auto close portal on process exit πŸ‘Œ

firstclassfunc 2020-12-31T19:33:03.091700Z

:thinking_face:

firstclassfunc 2020-12-31T19:40:23.091900Z

That works Thanks!!!\

1
firstclassfunc 2020-12-31T19:41:03.092100Z

I did put in a feature request for context sensitive displays, been looking at the inspector code may have some patches when I figure this out

djblue 2020-12-31T19:57:36.092300Z

I responded, not sure where the better place is to have the conversation πŸ˜†

πŸ‘ 1
borkdude 2021-01-02T14:39:23.092900Z

Cool discussion. It might be worth documenting this somewhere?

πŸ’― 2