Fork me on GitHub
#fulcro
<
2020-02-17
>
pithyless16:02:43

@tony.kay - what are your thoughts on rad-report generating columns with eql joins? Obviously, the item :query can be modified to do a join, but do you think the ::report/columns syntax will support this idea? Or do you expect that this would be accomplished via a custom pathom resolver (i.e. to "flatten" a nested value into the primary entity)? Or is this currently out of scope and would require dropping down to a custom render body?

pithyless16:02:07

Possibly related: I think it would be a beneficial escape hatch, if we could pass in a column-name->custom-render-fn to defsc-report, such that we could pass in a custom render function (that includes in the arguments the existing props; but dispatches on column-name and not attribute kind). Then you can always define "computed custom columns" for rendering purposes, that don't necessarily map to actual attributes.

tony.kay16:02:46

@pithyless rad forms has yet to be formally designed. The nested stuff is completely unstable and will change on report.

tony.kay16:02:54

At present, when I use reports I do not use anything but a plain defsc with a body for the rows. Autogeneration of rows will likely require you write a component and then call perhaps a function from the control map that you install…I’m open to ideas, but it needs to support recursion for sure

tony.kay16:02:10

you don’t want that customization on the component options (except as a keyword perhaps), since you don’t want platform dependent rendering in the rendering code path

tony.kay16:02:33

I updated the book with some comments on this last night:

tony.kay16:02:30

forms is still my central task until I get them working well in our production app…I’m close 🙂

tony.kay16:02:55

I just needed enough of reports (so far) to get a master-detail CRUD system going.

tony.kay16:02:33

My goal is to have forms running in our production app by Wednesday, at which point the documented features of forms will be relatively stable (still alpha and subject to change based on experience)…at which point I can turn to reports.

tony.kay16:02:27

The main likely API change on all of this is that many of the keys will start to allow functions as well as scalars so you can dynamically change your mind at runtime.

tony.kay16:02:48

I’ve started adding support for that, but it isn’t everywhere yet, and I’m not sure what will be passed as args

pithyless16:02:13

Yeah, I noticed the ?! convention :]

tony.kay16:02:36

sbject to rename, but seemed like a decent “optionally run” notation

pithyless16:02:37

Fair enough, no need to apply the alpha* clause to every statement you make about rad, I'm aware this is alpha-api territory. 🙂 I'm just chugging along quietly with my own CRUD experiments, but I've dropped a lot of my original UI rendering stuff and have steadily moved to just tracking and adopting the approach from the fulcro-rad repo. Looking forward to the form/report updates as your ideas stabilize.

tony.kay17:02:21

yeah, I suspect you know…just want anyone reading along reminded 🙂

tony.kay17:02:58

If you’re interested in collaborating, I’d love the help.

pithyless17:02:06

> you don’t want that customization on the component options (except as a keyword perhaps), since you don’t want platform dependent rendering in the rendering code path This is an interesting point; wonder what kind of balance you can reach on the spectrum: ["re-implement everything you want custom" ... "your dispatch is customized only on attr/type" ... "by default you only get pr-str"]. Maybe a keyword-based dispatch would be good enough.

tony.kay17:02:55

well, the current installation of controls is what I mean. Anything that is platform-dependent should be installed there at startup so only your entry point is dependent on the UI platform.

tony.kay17:02:21

as an old UNIX hack, I think it’d be fun to make a UNIX Curses JVM lib so we could render RAD to text terminals 😜

😂 12
tony.kay17:02:59

then it would just run in CLJ, not even cljs…silly, but fun

pithyless17:02:56

yeah, that's cool; but currently the controls are dispatched only on attr/type. Since EQL is promoting maximal graphs, maybe it wouldn't be that crazy if the controls had a global dispatch mechanism based on the attr/qualified-key (optional)

tony.kay17:02:32

not sure I understand that stmt…dispatch for what?

tony.kay17:02:07

you can put a field style on the attribute, or at the form…but that’s what picks the rendering

tony.kay17:02:44

the former is exactly that, but not so open to explosion of dispatch

pithyless17:02:23

ah! I forgot about ::form/field-styles

tony.kay17:02:31

I have 1000 attrs, I don’t want 1000 entries in render dispatch…I prob only have about 20 real control renderings

tony.kay17:02:39

right, singular on attribute

tony.kay17:02:44

plural on the form

pithyless17:02:46

So yeah, to sum up my original question; I guess it was about a future ::report/field-styles

tony.kay17:02:50

diff attr for diff type of thing

tony.kay17:02:06

of course, I expect report to (somewhat) mirror forms.

pithyless17:02:13

Sorry for the rambling; I'll let you get back to it. :]

tony.kay17:02:47

prob a macro or function to make the row ui shorter to write is fine. For now, something like this is what a macro would generate:

(defsc Row [this props]
  {:query [:props]
   :ident :row/id}
  (report/render-row this props))
where anything you drop in the component options would be available to the row rendering code.

tony.kay17:02:07

that’s all defsc-report and defsc-form really do, other than some error checking and autogen of query/ident/routing stuff.

tony.kay17:02:43

then render-row would just look up the custom row layout, etc.

tony.kay17:02:58

and yes, a ::report/column-styles map is certainly in the mix

tony.kay17:02:15

as is a ::report/row-actions

tony.kay17:02:54

want to at least support redirecting to a form for editing, or triggering an entity delete through form/delete!, but general function support would be fine there.

tony.kay17:02:33

Mainly the trick is minimizing the input the user has to give down to the minimal novelty 🙂

pithyless17:02:44

Yeah, so my original poorly phrased question about column-name->custom-render-fn is essentially ::report/column-styles ; And the other question was whether column values can be generated dynamically (and not backed by an actual defattr).

sif17:02:06

I'm having trouble with upload-files mutation, the middlewares are placed, it ran before but now the TX gets stuck under pending state

tony.kay17:02:33

@pithyless “generated dynamically”…yes, but declared with defattr still…they just won’t be reified into a storage schema. See http://book.fulcrologic.com/RAD.html#_handling_report_queries

tony.kay17:02:37

last part of that section

tony.kay17:02:31

Also, I expect to integrate client-side processing as well. For forms that would be some kind of middleware that would be called as the form changes.

tony.kay17:02:14

for reports I’d expect that there would be something like a generated column thing…not sure how that would plug in just yet. ::report/generated-columns , but could pretty easily justify still using defattr for that, and add a ::report/value-generator that receives the whole report and the current row as (fn [report row] value)

tony.kay17:02:33

but you still want the defattr to declare things like type, style, etc.

tony.kay17:02:52

at that point report could probably just detect what is a client-generated attribute, and you’d just include it in the list of things you want on a row

tony.kay17:02:57

Ultimately I see at least 3 layers: 1. The portion of the report/form query that goes to a server. This might need to be split across multiple servers, but is directed to remotes based on a bit more config that I have not invented yet. The servers can generate derived values if that makes sense. The Pathom parser lives on the server. 2. Parts of the query that are handled by a client-side pathom (i.e. to talk to REST, GraphQL, etc. directly). This pathom parser lives on the client. 3. A computation layer at the client where you could plug in any kind of computation.

cjmurphy19:02:39

I have an component data structure where a Rule contains one RulCond (just its name!). There are two types of RulCond, container and leaf. Container's have children. So arbitrary recursion. I'm trying to add forms to this, but having some trouble. Wondering whether having {:rulcond/children '...} in :query of RulCond is not supported?

cjmurphy02:02:40

Changing:

{:rulcond/children '...}
To:
{:rulcond/children (comp/get-query RulCond2)}
, where RulCond2 is just a copy of RulCond fixes all these forms issues (it was more than just about form config not being put into the app state entity/row).

tony.kay04:02:56

Forms and don’t get along

cjmurphy21:02:56

So I got rid of ... in the real app and replaced with RulCond/RulCond1/RulCond2/RulCond3/RulCond4 . An interesting consequence of this is that queries going to the server always go the full distance.

cjmurphy21:02:41

I had the code for dirty-fields sitting there ready to attempt a fix. But I take it that would have been a frustrating and futile experience. @tony.kay

tony.kay00:02:56

well, not futile, but possibly frustrating 😜

tony.kay00:02:53

It has been a very long time since I looked at that code, but it is probably tractable to fix