Fork me on GitHub
#hoplon
<
2016-04-29
>
piotrek11:04:35

do you have any example how to use those elements?

leontalbot13:04:05

@piotrek @flyboarder: +1 examples whould be great!

leontalbot13:04:37

Folks, do we have an hoplon template with backend?

leontalbot13:04:16

I get WARNING: update already refers to: #'clojure.core/update in namespace: clj-http.client, being replaced by: #'clj-http.client/update running it

micha13:04:17

@leontalbot: that's an interaction between clojure 1.8 and clj-http

micha13:04:41

clojure 1.8 defines clojure.core/update which didn't exist when that version of clj-http was written

micha13:04:11

basically any library that defines a function named update will cause that warning

micha13:04:21

when you run it in clojure 1.8

micha13:04:04

should be harmless

dm313:04:54

@micha - have you looked at https://github.com/hoplon/hoplon/pull/129 at all? I've spent an hour debugging but didn't get to the root cause

dm313:04:30

don't look at the code in PR comments, but rather at the committed test case

micha13:04:42

@dm3: i'll investigate, thanks!

dm313:04:28

in the end it boils down to javelin making a decision not to propagate where we'd really like to propagate

dm313:04:52

+    (div
 +      :id "input-list"
 +      (let [values (cell {})
 +            values+final (cell= (into values {:new nil}))
 +            on-input! (fn [id v] (reset! values (->>
 +                                                  ; Update values.
 +                                                  (merge @values {id v})
 +                                                  ; Filter empty strings.
 +                                                  (remove #(let [[_ v] %] (= "" v)))
 +                                                  ; Ensure we have a map.
 +                                                  (into {}))))]
 +        (loop-tpl :bindings [[k v] values+final]
 +          (let [id (cell= (if (= :new k) (gensym) k))]
 +            (input
 +              :value v
 +              :id id
 +              :input #(on-input! @id @%))))))

leontalbot14:04:42

How do you guys handle env var in both Hoplon and Castra?

leontalbot14:04:04

Any examples?

leontalbot14:04:55

do you use rpc?

leontalbot14:04:27

to pass var from server to client?

micha14:04:07

env vars are compiled into the client js

micha14:04:18

via the env/def macro there

micha14:04:45

works the same in both clojure and clojurescript

leontalbot14:04:59

@micha! looks really neat!

micha14:04:33

it's the absolute minimum implementation

micha14:04:50

it doesn't try to add anything

leontalbot14:04:18

really simple

micha14:04:19

so it can be used across pods, and across clj/cljs boundaries just fine

leontalbot14:04:38

do you do (alter-var-root #'FOO (constantly "new value"))via repl?

micha14:04:10

you can, we do it sometimes in the build.boot to set dev configuration

micha14:04:22

but mostly we just use env/def

micha14:04:37

most of the time you don't need to change the settings

micha14:04:50

i usually have an env file like this

micha14:04:03

export FOO=bar
export BAZ=baf

micha14:04:16

i can sourcve that in my shell

micha14:04:40

and in production that would go into the upstart script that starts the service

micha14:04:15

the upstart script would set up the env vars before starting the service

micha14:04:34

this way the concerns of deployment and configuration are nicely decoupled

micha14:04:41

like the 12-factor way

micha14:04:33

otherwise you end up needing something like Chef to create production config files for you

micha14:04:40

which is imho terrible

leontalbot14:04:12

yes... So if I use adzerk-oss/env in my/our hoplon-stripe minimal project example, will the user manually have to boot build-jar the lib?

micha14:04:55

no, you can still make libraries that look at env vars, no problem there

micha14:04:11

because your library is distributed in maven as cljs source, not as compiled js

micha14:04:14

for example:

micha14:04:01

you can use the cljs-console library in your project via :dependencies

micha14:04:27

if you set the CLJS_LOG_LEVEL in your environment it will pick it up when you compile your frontend

micha14:04:45

is that what you mean?

leontalbot14:04:19

Well for now hoplon-stripe will be a project example, not a library

leontalbot14:04:53

But anyway, looks fairly simple

micha14:04:29

there isn't much of an "environment" for a static site of html+js+css really

micha14:04:41

other than the environment in which the html/js/css was compiled in

micha14:04:54

because you're going to deploy it to something like cloudfront

micha14:04:58

or some CDN

micha14:04:45

the true environment there is something you don't have any control over: the browser

piotrek14:04:11

@micha: would it be useful to establish some global var in browser env so you can change the log level dynamically from the browser console?

piotrek14:04:31

that would enable more detailed logging for customers when troubleshooting their problems

piotrek14:04:58

of course that would mean log calls would need to be functions checking for the value of the global level setting

piotrek14:04:25

and not just macros that would generate final version of the log level when generating site code

micha15:04:42

@piotrek: i think you'd need a different mechanism for that really

micha15:04:55

you'd need something more robust, like airbrake etc

micha15:04:15

probably be used differently than you use console logs in dev

flyboarder15:04:49

@piotrek @leontalbot at the moment you must add a link tag to your index page which pulls in semantic css (import function coming soon :P) then simply use the element functions as if they are regular hoplon elements, the namespaces map to what is on the semantic doc site (elements, views, collections, etc.) all components are provided plus a few common variations

flyboarder15:04:49

ui components are built from the concept of semantic-ui.core/extelem which normalizes the class list same way hoplon.core does after adding the semantic css class names

flyboarder15:04:17

there is probably a better more clj way of working with the class maps, so suggestions are welcome

piotrek15:04:16

@micha: I was thinking about not as sophisticated as airbrake but rather to be able to turn on and off debug logging in production cljs application

piotrek15:04:54

if a customer reports a problem I can using the same production version enable debug logging and see what happens

micha15:04:56

@piotrek: how about using a combination like this:

micha15:04:35

yeah you can't use macros then

piotrek15:04:42

but there could be a separate version of macros that would emit such log calls using functions checking for the current log level

piotrek15:04:53

there are such libraries already simple_smile

micha15:04:30

the problem i was solving is a different ont

piotrek15:04:37

so no point in duplicating functionality

micha15:04:44

i wanted to have lots of dev logs

micha15:04:52

and not have to remove them in prod

micha15:04:02

because i always forget