Fork me on GitHub
#untangled
<
2016-10-18
>
herbm08:10:16

What is the best source for (a beginner) to start an Untangled project? Trying to work through tutorials, but would like to just start a project of my own but by getting the start working correctly. No lein template, right? Good project starter perhaps?

mitchelkuijpers08:10:48

Hi @herbm I would really suggest going through the tutorials first

mitchelkuijpers08:10:22

They are working on the template

herbm12:10:40

thx, pretty much a newbie so this will let me get started from a point that works.

herbm12:10:07

Anyone have a good example of hooking up MySql as the storage source?

gardnervickers16:10:50

I’m interested in knowing how the team behind Untangled handles initial-state in production. Presumably you’d have some sample data you don’t actually want to show the user, what’s the approach for hiding that?

ethangracer16:10:57

@gardnervickers not sure I understand — we just use an in memory database in development, and then we seed the production servers with production data before making the app available to users. the client-side initial state is the same for both builds though, because any data that we would want to hide is downloaded from the server. initial-state for us is the bare minimum necessary to render an app with all placeholder pages

currentoor17:10:45

@herbm are you talking about using MySQL underneath Datomic or on it's own?

tony.kay18:10:26

@herbm "hooking up" is trivial, in that you just have to return a map from your read/mutations on the server with the correct form for the response. It is database agnostic. See things like Korma for ways to access SQL from clojure

tony.kay19:10:21

e.g. {:value 42} is a valid response to the server query [:prop], which then results in the response to the client of {:prop 42}. Where/how you pull it from a db is up to you

tony.kay19:10:22

We use Datomic, so we've supplied helpers for seeding and connecting a db. The one thing that you'll want to do is make a database component (stuart sierra component) on the server so you can inject your database into your parser. See the Building a Server part of the dev guide

tony.kay19:10:43

There are migration libraries and such for SQL in Java and Clojure, so that's what I'd use there.

tony.kay19:10:23

Personally, I'd start by using a map in an atom in RAM on the server to get the hang of just responding to requests. Then you'll see how you can go from there to any data store.

tony.kay19:10:12

The two really are completely separate. The join point is the component/parser injection. Connection pooling for SQL is yet another thing (I'd recommend a standard JVM pooling library).

tony.kay19:10:10

Maybe I'll hack an in-memory H2 database into a fork of the template so people are less intimidated.

herbm19:10:56

thx so much @tony.kay -- never done this before in Clojure and every time I have hooked up a DB to a new language/environment I have found it more 'interesting' 🙂 than trivial 🙂 I have a real though small DB in mind and did dump it to CSV with the intent to perhaps just load it into memory for this.

herbm20:10:15

@currentoor : SQL alone was my intent, but I wish to switch completely to Datomic v2 perhaps -- this 1st app is a real app though little more than a toy in size for a 1st attempt -- the app also already exists but needs improvement (2nd version) so we know exactly where this 1st attempt will go.

kenbier22:10:19

@tony.kay finally got around to putting up a PR for adstage’s support viewer changes i mentioned a month or two ago.

kenbier22:10:40

i noticed there have since been some new issues addressing updating the support viewer out of “just beyond experimental”. cant wait to see those 🙂

tony.kay22:10:40

Thanks! Merged. @kenbier Mostly we just need compression (for practical reasons, not technical), and the facelift is also inconsequential.

tony.kay22:10:19

deployed to clojars on 0.6.0-SNAPSHOT

kenbier22:10:54

agreed, really excited for that one.

tony.kay23:10:09

OK, anyone interested in the form support: I've finished a tech spike and am pretty happy with the result. I've coded up documentation and samples on a devcard in this project and branch: https://github.com/untangled-web/untangled-components/tree/feature/forms The devcards and docs show and explain: - How we separate the UI and the Form logic/definition - Basic forms - Field validation - Nested forms - Commit/Reset (remote integration not quite done, but pretty simple to complete) - Extending supported controls and Validation

tony.kay23:10:56

I already see a ton of ways to make it better, but they all fall into the camp of helper functions and extras like more field types and validators. E.g. right now to validate a nested form you recursively validate the forms yourself. It would be trivial to walk the state looking for nested form declarations and do that automatically.

tony.kay23:10:21

The bones are pretty strong

tony.kay23:10:08

So, you're about to have full-stack entity-centric CRUD form support from a library 🙂

tony.kay23:10:25

where you retain full rendering freedom

tony.kay23:10:40

and write almost nothing (extra beyond the UI layout) but the server code to read/write the underlying db

tony.kay23:10:28

It would not take much to make helpers that automated the server-side too, now that I think of it