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?
Hi @herbm I would really suggest going through the tutorials first
If you want to start hacking you can try: https://github.com/awkay/untangled-template-workspace
They are working on the template
thx, pretty much a newbie so this will let me get started from a point that works.
Anyone have a good example of hooking up MySql as the storage source?
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?
@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
@herbm are you talking about using MySQL underneath Datomic or on it's own?
@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
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
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
There are migration libraries and such for SQL in Java and Clojure, so that's what I'd use there.
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.
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).
Maybe I'll hack an in-memory H2 database into a fork of the template so people are less intimidated.
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.
@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.
@tony.kay finally got around to putting up a PR for adstage’s support viewer changes i mentioned a month or two ago.
i noticed there have since been some new issues addressing updating the support viewer out of “just beyond experimental”. cant wait to see those 🙂
Thanks! Merged. @kenbier Mostly we just need compression (for practical reasons, not technical), and the facelift is also inconsequential.
deployed to clojars on 0.6.0-SNAPSHOT
agreed, really excited for that one.
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
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.
The bones are pretty strong
So, you're about to have full-stack entity-centric CRUD form support from a library 🙂
where you retain full rendering freedom
and write almost nothing (extra beyond the UI layout) but the server code to read/write the underlying db
It would not take much to make helpers that automated the server-side too, now that I think of it