debugging stuff, make repl reasier, bulk linking

neo4j-4
Josha von Gizycki 4 years ago
parent bf890aaed5
commit 5165be07ac

@ -14,13 +14,18 @@
#(re-matches #(re-matches
#"[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+" %)) #"[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+-[0-9a-f]+" %))
(def standard-port "7687")
(def standard-host "localhost")
(def standard-user "neo4j")
(def standard-pass "b")
(defn create-conn! (defn create-conn!
([] ([]
(let [env #(or (System/getenv %1) %2) (let [env #(or (System/getenv %1) %2)
port (env "NEO4J_PORT" "7687") port (env "NEO4J_PORT" standard-port)
host (env "NEO4J_HOST" "localhost") host (env "NEO4J_HOST" standard-host)
user (env "NEO4J_USER" "neo4j") user (env "NEO4J_USER" standard-user)
pass (env "NEO4J_PASS" "b")] pass (env "NEO4J_PASS" standard-pass)]
(create-conn! port host user pass))) (create-conn! port host user pass)))
([port host user pass] ([port host user pass]
(db/connect (db/connect

@ -112,4 +112,11 @@
(defn dev-server! [] (defn dev-server! []
(main/stop-server!) (main/stop-server!)
(main/start-server-dev!) (main/start-server-dev!)
(println "Startet server at http://localhost:8080")) (println "Started server at http://localhost:8080"))
(comment
(dev-server!)
(neo4j/reset-conn! "7688"
"mokoscha"
neo4j/standard-user
neo4j/standard-pass))

@ -137,7 +137,17 @@
req))) req)))
(defn route-create-bulk-link! [uuid req] (defn route-create-bulk-link! [uuid req]
(clojure.pprint/pprint req) (let [names (-> req :params :name)
instances (-> req :params :instances)
source-uuid (-> req :params :source-uuid)]
(clojure.pprint/pprint names)
(clojure.pprint/pprint instances)
(clojure.pprint/pprint source-uuid)
(clojure.pprint/pprint
(map (fn [[target-schema target-instances]]
{:link-name (get names target-schema)
:instances target-instances})
instances)))
(resp/redirect (path :instance-show {:uuid uuid}))) (resp/redirect (path :instance-show {:uuid uuid})))
(defroutes routes (defroutes routes

@ -23,6 +23,7 @@
{:class "no-grid"} {:class "no-grid"}
[:post (path :instance-bulk-link-create instance)] [:post (path :instance-bulk-link-create instance)]
(anti-forgery-field) (anti-forgery-field)
(hform/hidden-field "source-uuid" (:uuid instance))
(for [{:keys [schema instances]} forms] (for [{:keys [schema instances]} forms]
(list (list
[:h2 "Schema " (h (:name schema))] [:h2 "Schema " (h (:name schema))]
@ -51,4 +52,5 @@
(req-attrs-cells schema inst) (req-attrs-cells schema inst)
[:td (-> inst :updated_at prettify-dt)] [:td (-> inst :updated_at prettify-dt)]
[:td (-> inst :created_at prettify-dt)]])]])) [:td (-> inst :created_at prettify-dt)]])]]))
(hform/submit-button "Link!"))])) [:h2 "Actions"]
(hform/submit-button "Create links!"))]))

Loading…
Cancel
Save