Fork me on GitHub
#portal
<
2024-05-10
>
Herman Nurlygayanov13:05:49

Sometimes when I tap> large strings into Portal, they get cropped (the rest of a string is repalced with ...). After that, I can't properly use those strings from Portal. How can I get around this cropping?

Luke Johnson22:05:05

You can select the item in Portal and hit E to expand the selection. You can also change the viewer either by hitting V or on the dropdown in the lower left corner. The text viewer is good, but Portal can render markdown or html too if that’s what your text strings contain.

🙏 2
djblue22:05:10

Yeah, that can be confusing. I'll see about making toggle-expand more obvious for strings 👍

👍 2
Dieter Van Eessen16:05:30

Hello, how can I tap an atom from clojurescript repl? When I tap an atom from clj repl, the value in portal is updated when swapped. From cljs, portal shows the atom as a javascript object (cljs.core.Atom). I'm considering 2 possibilities: A: trying to write some custom viewer. Or B: sending what i want updated, back to the server and swapping a clj atom (I'm using the portal.runtime.jvm.server handler and castra middleware). The goal is to have a javelin cell getting its value updated from a small hoplon form (tapped to portal from cljs repl) and display its value nicely and readable (with portal.viewer/code). Another option (C) is to use some cljs library to add syntax coloring to the content of this javelin cell and let hoplon render it. (Any suggestions for possible library?). Want to be able to quickly inspect some transaction data before transacting them to the database. (Without having to tap again). What's the best route I should follow? kind regards, Dieter

Dieter Van Eessen08:05:50

additional: • How to set default viewer when viewing an atom tapped from clj to portal? • Example of using deref viewer? ( portal.ui.viewer/inspect-deref) Got an atom being updated at backend when a javelin formula cell is getting new value at frontend. But the viewer always switches back to inspector when value of the atom at backend is reset...

Dieter Van Eessen21:05:56

nevermind, issue solved

djblue22:05:50

I'm assuming you are using the remote client for ClojureScript which doesn't support watching atoms. The easiest thing to do would be to mirror the data in the jvm process (which it looks like you've done) or run the Portal UI directly from the browser process via portal.web. For the default viewer, you just need some metadata on the value in the atom, which it looks like you've discovered :thinking_face: Also, I didn't expect users to want to embed the runtime server directly, I would be up for making that an officially supported thing. If so, it might be useful for Portal to change some of the paths to avoid conflicts with the hosting server. Sorry it took a bit to respond.

Dieter Van Eessen09:05:45

Hi, The solution was indeed that simple... Sending data back to server through rpc was messing with metadata. Running the server directly because i needed to modify portals javascript to include a weasel websocket and hoplon code. At the clojurescript repl I'm still getting 'WARNING: use of undeclared Var portal.ui.state/state'. Though I cannot "(require 'portal.ui.state)", as it complains 'no such namespace: react in file ... referring to the .m2 repository. Yet even with this warning, I can still use portal.ui.state: I've added a watcher function to portal.ui.state/state to update a javelin cell with portal.ui.state/get-selected-value... I think the server is now using the javascript I compiled separately and copied to the './resources' directory. Hoplon has been added to this js and I'm actually using hoplon from the repl and I'm updating a [:div ...] tapped to portal using hoplon to create a dynamic UI (running javascript in the portal UI). Though its a mystery on how to fix the 'WARNING..' :) Any ideas? Thank you for responding ;p. The tool you've created is very nice and you're very involved in keeping it top notch. Never need to apologize for lack of time: it means people are willing to wait for your reply