diff --git a/src/wanijo/infrastructure/neo4j.clj b/src/wanijo/infrastructure/neo4j.clj index 6e63783..77103f8 100644 --- a/src/wanijo/infrastructure/neo4j.clj +++ b/src/wanijo/infrastructure/neo4j.clj @@ -14,13 +14,18 @@ #(re-matches #"[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! ([] (let [env #(or (System/getenv %1) %2) - port (env "NEO4J_PORT" "7687") - host (env "NEO4J_HOST" "localhost") - user (env "NEO4J_USER" "neo4j") - pass (env "NEO4J_PASS" "b")] + port (env "NEO4J_PORT" standard-port) + host (env "NEO4J_HOST" standard-host) + user (env "NEO4J_USER" standard-user) + pass (env "NEO4J_PASS" standard-pass)] (create-conn! port host user pass))) ([port host user pass] (db/connect diff --git a/src/wanijo/infrastructure/repl.clj b/src/wanijo/infrastructure/repl.clj index b5987ca..9888461 100644 --- a/src/wanijo/infrastructure/repl.clj +++ b/src/wanijo/infrastructure/repl.clj @@ -112,4 +112,11 @@ (defn dev-server! [] (main/stop-server!) (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)) diff --git a/src/wanijo/instance/routes.clj b/src/wanijo/instance/routes.clj index 5f7d1c6..367fb1f 100644 --- a/src/wanijo/instance/routes.clj +++ b/src/wanijo/instance/routes.clj @@ -137,7 +137,17 @@ 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}))) (defroutes routes diff --git a/src/wanijo/instance/view/bulk_link_selection.clj b/src/wanijo/instance/view/bulk_link_selection.clj index 7dbfb09..e46ec49 100644 --- a/src/wanijo/instance/view/bulk_link_selection.clj +++ b/src/wanijo/instance/view/bulk_link_selection.clj @@ -23,6 +23,7 @@ {:class "no-grid"} [:post (path :instance-bulk-link-create instance)] (anti-forgery-field) + (hform/hidden-field "source-uuid" (:uuid instance)) (for [{:keys [schema instances]} forms] (list [:h2 "Schema " (h (:name schema))] @@ -51,4 +52,5 @@ (req-attrs-cells schema inst) [:td (-> inst :updated_at prettify-dt)] [:td (-> inst :created_at prettify-dt)]])]])) - (hform/submit-button "Link!"))])) + [:h2 "Actions"] + (hform/submit-button "Create links!"))]))