untangled

NEW CHANNEL: #fulcro
herbm 2016-10-18T08:45:16.002709Z

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?

mitchelkuijpers 2016-10-18T08:50:48.002710Z

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

mitchelkuijpers 2016-10-18T08:51:08.002711Z

If you want to start hacking you can try: https://github.com/awkay/untangled-template-workspace

mitchelkuijpers 2016-10-18T08:51:22.002713Z

They are working on the template

herbm 2016-10-18T12:14:40.002716Z

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

herbm 2016-10-18T12:16:07.002717Z

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

gardnervickers 2016-10-18T16:07:50.002722Z

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?

2016-10-18T16:29:57.002723Z

@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

currentoor 2016-10-18T17:30:45.002725Z

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

tony.kay 2016-10-18T18:59:26.002726Z

@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.kay 2016-10-18T19:00:21.002727Z

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.kay 2016-10-18T19:01:22.002728Z

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.kay 2016-10-18T19:01:43.002729Z

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

tony.kay 2016-10-18T19:02:23.002730Z

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.kay 2016-10-18T19:03:12.002731Z

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.kay 2016-10-18T19:04:10.002732Z

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

herbm 2016-10-18T19:58:56.002736Z

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.

herbm 2016-10-18T20:07:15.002737Z

@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.

2016-10-18T22:42:19.002738Z

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

2016-10-18T22:42:40.002739Z

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.kay 2016-10-18T22:57:40.002740Z

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

tony.kay 2016-10-18T22:58:19.002741Z

deployed to clojars on 0.6.0-SNAPSHOT

2016-10-18T22:58:54.002742Z

agreed, really excited for that one.

tony.kay 2016-10-18T23:48:09.002743Z

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

👍 6
tony.kay 2016-10-18T23:52:56.002745Z

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.kay 2016-10-18T23:53:21.002746Z

The bones are pretty strong

tony.kay 2016-10-18T23:54:08.002747Z

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

tony.kay 2016-10-18T23:54:25.002748Z

where you retain full rendering freedom

tony.kay 2016-10-18T23:54:40.002749Z

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

tony.kay 2016-10-18T23:55:28.002750Z

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