This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-18
Channels
- # announcements (18)
- # babashka (34)
- # beginners (47)
- # biff (1)
- # calva (99)
- # cider (1)
- # clojure (99)
- # clojure-austin (13)
- # clojure-australia (1)
- # clojure-dev (53)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-spec (7)
- # clojure-uk (1)
- # clojurescript (50)
- # cursive (11)
- # datahike (20)
- # datomic (10)
- # fulcro (7)
- # graalvm (8)
- # gratitude (1)
- # introduce-yourself (7)
- # jackdaw (1)
- # joyride (1)
- # lambdaisland (7)
- # lsp (2)
- # malli (7)
- # nbb (1)
- # off-topic (1)
- # portal (24)
- # re-frame (8)
- # reagent (13)
- # reitit (7)
- # releases (2)
- # remote-jobs (8)
- # rewrite-clj (3)
- # sci (1)
- # scittle (21)
- # shadow-cljs (2)
- # testing (3)
- # tools-deps (22)
- # web-security (19)
hello, is there a guide on how to use charts with Portal?
Not yet, but here are some examples https://github.com/djblue/portal/blob/master/src/examples/data.cljc#L112-L191
I think portal has some higher level viewers that will map data to vega/vega-lite, but if you want custom stuff, you can use the vega/vega-lite viewer directly ๐
FYI for any who use portal.api/eval-str and have had issues with promises, you can do (portal.api/eval-str :all "(.resolve js/Promise 123)" {:await true})
with the latest release, https://github.com/djblue/portal/releases/tag/0.32.0
@djblue Starting a new thread about the middleware so we don't keep spamming Max T about it... ๐งต
So I have this working nicely, locally. With :portal.nrepl/eval true
in the metadata.
What are the red yellow orange dots meant to be at the top of the stdio
stuff?
Just decoration that I plan on making the expand / collapse buttons in the future. It's suppose to look like a terminal ๐
Ah, a Mac terminal.
https://djblue.github.io/portal/?content-url=https://gist.githubusercontent.com/djblue/9a2cd250e061f62ce527b20648fd8256/raw/e7bd673df60b3c503306956b950bb9589ba480eb/data.clj&content-type=application/edn is what portal's build output looks like. It's using the same prepl viewer
Wow, nice!
OK, took me a bit of messing about to get the results I wanted in the right order but...

That's the result of my "run tests" hot key which invokes parts of clojure.test
and then tap>
's the result (summary hash map). So now it is show the report card, then the standard output, then the actual value I tapped.
That means that the most recent tapped value is still the most recent item in Portal, even if there is output or test results, and I can still use my various hotkeys to drive Portal's UI to expand parts of it or cycle through viewers, as before.
What was the go to file/line hot key in Portal where you're on logging style line?
Ah, yes, and it loads it in the portal window group. Thanks.
So here's where I've ended up and this works very nicely:
(ns dev)
(defonce *v (atom nil))
(defonce was-tap (atom false))
(defn submit
[v]
(let [m (try (meta v) (catch Exception _))]
(if (:portal.nrepl/eval m)
(let [{:keys [stdio report level]} v]
(when report
((requiring-resolve 'portal.api/submit) report))
(when stdio
((requiring-resolve 'portal.api/submit) stdio))
(when (= level :error)
((requiring-resolve 'portal.api/submit) v))
(when @was-tap
(reset! was-tap false)
((requiring-resolve 'portal.api/submit) @dev/*v)))
(do
(when @was-tap
(reset! was-tap false)
((requiring-resolve 'portal.api/submit) @dev/*v))
(reset! dev/*v v)
(reset! was-tap true)))))
and the change to nrepl.clj
is just this:
(with-meta {:portal.nrepl/eval true
:portal.viewer/for
{:code :portal.viewer/code
:time :portal.viewer/relative-time}
:portal.viewer/code {:language :clojure}})
tap>)))
(add :portal.nrepl/eval true
to metadata and use tap>
instead of p/submit
Yeah, this is working really well for me... I get better feedback on "normal" evaluations via Calva and I still have my previous tap>
workflow with hotkeys to drive navigation in Portal.

The prepl and test report viewers could use some ux polish so if you think of anything, let me know. I still need to add filter failing for the test viewer
I'm the wrong person to ask about UI/UX ๐ but if I run into anything and have suggestions, I'll let you know.