CMR-5787: Build without version check.

CMR-5787: Build without version check.

--- cmr-exchange/service-bridge/project.clj
+++ cmr-exchange/service-bridge/project.clj
@@ -192,6 +192,13 @@
                      ["junit" ":unit"]
                      ["ubercompile"]
                      ["build-uberjar"]]
+            "build-no-check" ["do"
+                              ["clean"]
+                              ["lint"]
+                              ["ltest" ":unit"]
+                              ["junit" ":unit"]
+                              ["ubercompile"]
+                              ["build-uberjar"]]
             "build-full" ["do"
                           ["build"]
                           ["docs"]]


Bump up the timeout for CI.

Bump up the timeout for CI.

--- integration-tests/src/test/clojure/immutant/integs/nrepl.clj
+++ integration-tests/src/test/clojure/immutant/integs/nrepl.clj
@@ -29,7 +29,7 @@

 (deftest simple "it should work"
   (with-open [conn (repl/connect :port 4321)]
-    (let [response (repl/message (repl/client conn 10000)
+    (let [response (repl/message (repl/client conn 120000)
                                  {:op :eval :code "(str \"it works!\")"})]
       (println "RESPONSE" response)
       (is (= "it works!" (first (repl/response-values response)))))))


Removes superflous lets.

Removes superflous lets.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -659,8 +659,7 @@

 (defn key-exists-without-binding-clause->rhs-match
   [message clause]
-  (let [key     (key-exists-without-binding-clause-key clause)]
-    `[]))
+  `[])

 (defn path-exists-with-binding-clause->rhs-match
   [message clause]
@@ -670,8 +669,7 @@

 (defn path-exists-without-binding-clause->rhs-match
   [message clause]
-  (let [key         (path-exists-without-binding-clause-path clause)]
-    `[]))
+  `[])

 (defn key-matches-with-binding-clause->rhs-match
   [message clause]
@@ -682,9 +680,7 @@

 (defn key-matches-without-binding-clause->rhs-match
   [message clause]
-  (let [key         (key-matches-without-binding-clause-key clause)
-        match-value (matcher-default-value (key-matches-without-binding-clause-matcher clause))]
-    `[]))
+  `[])

 (defn path-matches-with-binding-clause->rhs-match
   [message clause]
@@ -695,9 +691,7 @@

 (defn path-matches-without-binding-clause->rhs-match
   [message clause]
-  (let [path        (path-matches-without-binding-clause-path clause)
-        match-value (matcher-default-value (path-matches-without-binding-clause-matcher clause))]
-    `[]))
+  `[])

 (defn matcher->value
   "Takes a `matcher` and returns the value/s it matches on.


Removes unused imports.

Removes unused imports.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -1,8 +1,6 @@
 (ns active.clojure.match
   "Syntactic sugar for map matching around `core.match`."
   (:require [active.clojure.condition :as c]
-            [active.clojure.functions :as f]
-            [active.clojure.lens :as lens]
             [active.clojure.record :refer [define-record-type]]

             [clojure.spec.alpha :as s]


Add warning for people that upgrade to newer versions

If someone used something like lein-ancient to upgrade their libraries,
they might not realise that re-frame-trace has been renamed to
re-frame-10x. This commit will log a warning every time it is loaded, to
tell people that they should use the new 10x version.

--- src/day8/re_frame/trace/preload.cljs
+++ src/day8/re_frame/trace/preload.cljs
@@ -5,6 +5,7 @@

 ;; Use this namespace with the :preloads compiler option to perform the necessary setup for enabling tracing:
 ;; {:compiler {:preloads [day8.re-frame.trace.preload] ...}}
+(js/console.warn "re-frame-trace has been renamed to re-frame-10x: (https://clojars.org/day8.re-frame/re-frame-10x). Update to newer versions of this library by using the `day8.re-frame/re-frame-10x` artifact ID. Thanks!")
 (rf/clear-subscription-cache!)
 (trace/init-db!)
 (defonce _ (trace/init-tracing!))


fix typo

fix typo

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -420,7 +420,7 @@
          ]}]))
 (defonce replace-patterns-present-subjunctive
   (expand-replace-patterns
-   {:synsem {:infl :present}}
+   {:synsem {:infl :subjunctive}}
    [{:agr {:synsem {:subcat {:1 {:agr {:number :sing
                                        :person :1st}}}}}
      :p [


cleanup

cleanup

--- src/babel/italiano/morphology/verbs.cljc
+++ src/babel/italiano/morphology/verbs.cljc
@@ -564,40 +564,6 @@
       (do (log/warn (str "get-string-1 could not match: " word))
           word))))

-;; future: 2) future-stem specified
-(defn regular-future-with-future-stem? [word]
-  (and false (= (get-in word '(:infl)) :future)
-       (get-in word '(:future-stem))))
-
-(defn regular-future-with-future-stem [word]
-  (let [stem (get-in word '(:future-stem))
-        number (get-in word [:agr :number])
-        person (get-in word [:agr :person])
-        patterns patterns-future]
-    (-> patterns
-        (map (fn [pattern]
-               (let [[from to] (nth (:g pattern))]
-                 from)))
-        (remove nil?))
-    (cond
-      (and (= person :1st) (= number :sing))
-      (str stem "ò")
-
-      (and (= person :2nd) (= number :sing))
-      (str stem "ai")
-
-      (and (= person :3rd) (= number :sing))
-      (str stem "à")
-
-      (and (= person :1st) (= number :plur))
-      (str stem "emo")
-
-      (and (= person :2nd) (= number :plur))
-      (str stem "ete")
-
-      (and (= person :3rd) (= number :plur))
-      (str stem "anno"))))
-
 (defn irregular-imperfect-1sing? [word]
   (and
    (= (get-in word '(:infl)) :imperfect)
@@ -821,9 +787,6 @@
     (irregular-future? word)
     (irregular-future word)

-    (regular-future-with-future-stem? word)
-    (regular-future-with-future-stem word)
-
     (regular-future? word)
     (regular-future word)


Fix dump-color bug found by property test

--- src/asciinema/player/vt.cljc
+++ src/asciinema/player/vt.cljc
@@ -953,8 +953,9 @@
 (defn dump-color [base c]
   (match c
          [r g b] (str (+ base 8) ";2;" r ";" g ";" b)
-         (_ :guard #(<= 16 %)) (str (+ base 8) ";5;" c)
-         :else (str (+ base c))))
+         (_ :guard #(< % 8)) (str (+ base c))
+         (_ :guard #(< % 16)) (str (+ base 52 c))
+         :else (str (+ base 8) ";5;" c)))

 (def dump-fg (partial dump-color 30))
 (def dump-bg (partial dump-color 40))


isolate from scratch reassignment to one function

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -124,7 +124,7 @@
                                               :do-rebalance))
                  :kill (kill-transition nimbus storm-id)
                  :do-rebalance (fn []
-                                 ;; TODO: reassign from scratch
+                                 (mk-assignments nimbus storm-id :scratch? true)
                                  (:old-status status))
                  }})

@@ -419,10 +419,15 @@
 ;; TODO: slots that have dead task should be reused as long as supervisor is active

 ;; public so it can be mocked out
-(defn compute-new-task->node+port [conf storm-id existing-assignment storm-cluster-state callback task-heartbeats-cache]
+(defn compute-new-task->node+port [conf storm-id existing-assignment storm-cluster-state callback task-heartbeats-cache scratch?]
+  ;; TODO: implement scratch?
   (let [available-slots (available-slots conf storm-cluster-state callback)
         existing-assigned (reverse-map (:task->node+port existing-assignment))
         storm-conf (read-storm-conf conf storm-id)
+
+        ;; if scratch?, slots = existing slots + available-slots
+        ;; otherwise, do timeout stuff
+
         all-task-ids (set (.task-ids storm-cluster-state storm-id))
         alive-ids (set (alive-tasks conf storm-id storm-cluster-state
                                     all-task-ids (:task->start-time-secs existing-assignment) task-heartbeats-cache))
@@ -462,7 +467,7 @@
 ;; figure out available slots on cluster. add to that the used valid slots to get total slots. figure out how many tasks should be in each slot (e.g., 4, 4, 4, 5)
 ;; only keep existing slots that satisfy one of those slots. for rest, reassign them across remaining slots
 ;; edge case for slots with no task timeout but with supervisor timeout... just treat these as valid slots that can be reassigned to. worst comes to worse the task will timeout and won't assign here next time around
-(defn- mk-assignments [nimbus storm-id]
+(defnk mk-assignments [nimbus storm-id :scratch? false]
   (log-debug "Determining assignment for " storm-id)
   (let [conf (:conf nimbus)
         storm-cluster-state (:storm-cluster-state nimbus)
@@ -472,7 +477,8 @@
         existing-assignment (.assignment-info storm-cluster-state storm-id nil)
         task->node+port (compute-new-task->node+port conf storm-id existing-assignment
                                                      storm-cluster-state callback
-                                                     (:task-heartbeats-cache nimbus))
+                                                     (:task-heartbeats-cache nimbus)
+                                                     scratch?)

         all-node->host (merge (:node->host existing-assignment) node->host)
         reassign-ids (changed-ids (:task->node+port existing-assignment) task->node+port)


PLEASE PROCEED IN ORDERLY FASHION

PLEASE PROCEED IN ORDERLY FASHION

--- src/clj/mokkameister/resources/slack.clj
+++ src/clj/mokkameister/resources/slack.clj
@@ -51,7 +51,8 @@
     ":steam_locomotive::coffee::coffee::running::running::running::dash:"
     "All aboard the coffee train\n:steam_locomotive::coffee::coffee::running::running::running::dash:"
     "Det er kaffi å få på kjøken!"
-    "KEEP CALM THE COFFEE IS READY!"]))
+    "KEEP CALM THE COFFEE IS READY!"
+    "PLEASE PROCEED IN ORDERLY FASHION TO RECEIVE COFFEE :syringe:"]))

 (defn- coffee-message-instant [{:keys [slack-user]}]
   (format "Den sleipe robusta-knaskaren %s har lagt seg ein snar-kaffi :/" slack-user))


starting to test websocket, onOpen and onMessage is working but after few second onClose is execute automatic by the server

--- src/clojure/my/company/superapp/main.clj
+++ src/clojure/my/company/superapp/main.clj
@@ -78,7 +78,10 @@
                                     (log/i "onException")))]
                   web-socket)
                 )
-              )]))
+              )]
+    wsd
+    )
+)

 ;;Define httpd and wsg instances as a global variables
 (def httpd (init-httpd "0.0.0.0" 5557))


Changed handling of missing parents and empty genomes in screens.

--- src/clojush/pushgp/genetic_operators.clj
+++ src/clojush/pushgp/genetic_operators.clj
@@ -94,36 +94,31 @@
                        {:genome [] :dummy true :age -1}
                        argmap))
   ([genome parent1 parent2 {:keys [random-screen] :as argmap}]
-   (if (not random-screen)
+   (if (or (not random-screen)
+           (empty? genome))
      1
-     (case (:criterion random-screen)
-       ;
-       :genetic-similarity-to-parent
-       (if (some empty? [genome (:genome parent1) (:genome parent2)])
-         1
+     (if (some :dummy [parent1 parent2])
+       0
+       (case (:criterion random-screen)
+         ;
+         :genetic-similarity-to-parent
          (max (sequence-similarity genome (:genome parent1))
-              (sequence-similarity genome (:genome parent2))))
-       ;
-       :genetic-difference-from-parent
-       (if (some empty? [genome (:genome parent1) (:genome parent2)])
-         1
+              (sequence-similarity genome (:genome parent2)))
+         ;
+         :genetic-difference-from-parent
          (- 1 (max (sequence-similarity genome (:genome parent1))
-                   (sequence-similarity genome (:genome parent2)))))
-       ;
-       :reproductive-similarity-to-parent
-       (if (:dummy parent1)
-         1
+                   (sequence-similarity genome (:genome parent2))))
+         ;
+         :reproductive-similarity-to-parent
          (sequence-similarity
            genome
            (produce-child-genome-by-autoconstruction
              genome
              (:genome parent1)
              (:genome parent2)
-             argmap)))
-       ;
-       :reproductive-difference-from-parent
-       (if (:dummy parent1)
-         1
+             argmap))
+         ;
+         :reproductive-difference-from-parent
          (- 1 (sequence-similarity
                 genome
                 (produce-child-genome-by-autoconstruction


removed unnecessary print

removed unnecessary print

--- src/frontend/socketio-interface.cljs
+++ src/frontend/socketio-interface.cljs
@@ -4,8 +4,6 @@

 (.on g/socket "sign-in-success"
   (fn [user-id users]
-    (println (.-username ((js->clj users) user-id)))
     (let [users (js->clj users)
           users (update-in users (keys users) #(js->clj %1))]
-      (println users)
       (client/sign-in-success! g/app-state user-id users))))


Fix performance of mean.

Fix performance of mean.

--- src/cavm/query/functions.clj
+++ src/cavm/query/functions.clj
@@ -19,9 +19,20 @@

 ; XXX this handling of dim is wrong for dim > 1
 ; XXX do we need to fill nan values, like we do in python?
-(defn- meannan [m dim]
+(defn meannan-impl [m dim]
     (let [new-shape (assoc (vec (shape m)) (long dim) 1)]
       (reshape (matrix (map meannan1d (slices m (- 1 dim)))) new-shape)))
+
+; Methods that coerce params to core.matrix. Should be extended
+; to all the math functions in 'functions', below.
+(defprotocol Matrix
+  (meannan [m dim]))
+
+(extend-protocol Matrix
+  mikera.matrixx.Matrix
+  (meannan [m dim] (meannan-impl m dim))
+  clojure.lang.Seqable
+  (meannan [m dim] (meannan-impl (matrix (map double-array m)) dim)))

 (def functions
   {'+ +


Use transaction when delete a page

Use transaction when delete a page

--- src/clj/salava/page/main.clj
+++ src/clj/salava/page/main.clj
@@ -1,11 +1,12 @@
 (ns salava.page.main
   (:require [clojure.string :refer [split blank? trim]]
             [yesql.core :refer [defqueries]]
+            [clojure.java.jdbc :as jdbc]
             [slingshot.slingshot :refer :all]
             [salava.core.time :refer [unix-time]]
             [salava.core.i18n :refer [t]]
             [salava.core.helper :refer [dump]]
-            [salava.core.util :refer [get-db]]
+            [salava.core.util :refer [get-db get-datasource]]
             [salava.badge.main :as b]
             [salava.page.themes :refer [valid-theme-id valid-border-id border-attributes]]
             [salava.file.db :as f]))
@@ -220,24 +221,29 @@
     (catch Object _
       {:status "error" :message (t :page/Errorwhilesavingpage)})))

-(defn remove-files-blocks-and-content! [ctx page-id]
-  (let [file-blocks (select-pages-files-blocks {:page_id page-id} (get-db ctx))]
+(defn remove-files-blocks-and-content! [db page-id]
+  (let [file-blocks (select-pages-files-blocks {:page_id page-id} db)]
     (doseq [file-block file-blocks]
-      (delete-files-block-files! {:block_id (:id file-block)} (get-db ctx)))
-    (delete-files-blocks! {:page_id page-id} (get-db ctx))))
-
-(defn delete-blocks! [ctx page-id]
-  (delete-heading-blocks! {:page_id page-id} (get-db ctx))
-  (delete-badge-blocks! {:page_id page-id} (get-db ctx))
-  (delete-html-blocks! {:page_id page-id} (get-db ctx))
-  (remove-files-blocks-and-content! ctx page-id)
-  (delete-tag-blocks! {:page_id page-id} (get-db ctx)))
+      (delete-files-block-files! {:block_id (:id file-block)} db))
+    (delete-files-blocks! {:page_id page-id} db)))
+
+(defn delete-blocks! [db page-id]
+  (delete-heading-blocks! {:page_id page-id} db)
+  (delete-badge-blocks! {:page_id page-id} db)
+  (delete-html-blocks! {:page_id page-id} db)
+  (remove-files-blocks-and-content! db page-id)
+  (delete-tag-blocks! {:page_id page-id} db))
+
+(defn delete-page-with-db! [db page-id]
+  (delete-blocks! db page-id)
+  (delete-page-tags! {:page_id page-id} db)
+  (delete-page! {:id page-id} db))

 (defn delete-page-by-id! [ctx page-id user-id]
   (when (page-owner? ctx page-id user-id)
-    (delete-blocks! ctx page-id)
-    (delete-page-tags! {:page_id page-id} (get-db ctx))
-    (delete-page! {:id page-id} (get-db ctx))))
+    (jdbc/with-db-transaction
+      [tr-cn (get-datasource ctx)]
+      (delete-page-with-db! {:connection tr-cn} page-id))))

 (defn toggle-visibility! [ctx page-id visibility user-id]
   (if (page-owner? ctx page-id user-id)


use first item in :navs of server.edn as _init page

--- src/clj/searchbot/server.clj
+++ src/clj/searchbot/server.clj
@@ -58,14 +58,15 @@

 (defn load-view-edn [view]
   (let [navs (:nav (load-server-edn))
-        navs (activate-nav navs view)
-        view-edn (read-edn view :default default-app-state)]
+        the-view (or view (:view (first navs)) "app-state")
+        navs (activate-nav navs the-view)
+        view-edn (read-edn the-view :default default-app-state)]
     (assoc view-edn :nav navs)))

 (defroutes routes
   (resources "/react" {:root "react"})
   (GET "/" req (apply str (init-page)))
-  (GET "/_init" req (response (load-view-edn "app-state")))
+  (GET "/_init" req (response (load-view-edn nil)))
   (GET "/_init/:view" [view] (response (load-view-edn view)))
   (GET "/es/:idx/_count" [idx]
        (response (es/es-count (get-es-host) idx)))


apply auth changes to handler

apply auth changes to handler

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -53,11 +53,9 @@
 ;; Password handler

 (defmethod dispatch :password [_]
-  (fn [{:keys [headers params]}]
-    (let [token (get headers "authorization")
-          username (token/user token)
-          payload (keywordize-keys params)]
-      (-> (api/user-by-username username)
+  (fn [{:keys [params logged-user]}]
+    (let [payload (keywordize-keys params)]
+      (-> (api/user-by-username logged-user)
           (api/change-password (:password payload))))
     (resp-ok)))

@@ -74,19 +72,16 @@
          (resp-ok))))

 (defmethod dispatch :user-delete [_]
-  (fn [{:keys [headers route-params]}]
-    (let [token (get headers "authorization")
-          username (token/user token)
-          user (api/user-by-username username)]
-      (if (= (:_id user)
-             (:id route-params))
-        (resp-error 400 "Operation not allowed")
-        (do (api/delete-user (:id route-params))
-            (resp-ok))))))
+  (fn [{:keys [route-params logged-user]}]
+    (if (= (:_id (api/user-by-username logged-user))
+           (:id route-params))
+      (resp-error 400 "Operation not allowed")
+      (do (api/delete-user (:id route-params))
+          (resp-ok)))))

 (defmethod dispatch :user-create [_]
   (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)
+    (let [payload (assoc (keywordize-keys params) :type "user")
           response (api/create-user payload)]
       (if (some? response)
         (resp-created (select-keys response [:id]))
@@ -98,31 +93,180 @@
       (api/update-user (:id route-params) payload)
       (resp-ok))))

+;; Service handler
+
+(defmethod dispatch :services [_]
+  (fn [_]
+    (->> (api/services)
+         (resp-ok))))
+
+(defmethod dispatch :service [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/service (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :service-networks [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/service-networks (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :service-tasks [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/service-tasks (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :service-create [_]
+  (fn [{:keys [params]}]
+    (let [payload (keywordize-keys params)]
+      (->> (api/create-service payload)
+           (resp-created)))))
+
+(defmethod dispatch :service-update [_]
+  (fn [{:keys [route-params params]}]
+    (let [payload (keywordize-keys params)]
+      (api/update-service (:id route-params) payload false)
+      (resp-ok))))
+
+(defmethod dispatch :service-delete [_]
+  (fn [{:keys [route-params]}]
+    (api/delete-service (:id route-params))
+    (resp-ok)))
+
+;; Network handler
+
+(defmethod dispatch :networks [_]
+  (fn [_]
+    (->> (api/networks)
+         (resp-ok))))
+
+(defmethod dispatch :network [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/network (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :network-create [_]
+  (fn [{:keys [params]}]
+    (let [payload (keywordize-keys params)]
+      (->> (api/create-network payload)
+           (resp-created)))))
+
+(defmethod dispatch :network-delete [_]
+  (fn [{:keys [route-params]}]
+    (api/delete-network (:id route-params))
+    (resp-ok)))
+
+;; Volume handler
+
+(defmethod dispatch :volumes [_]
+  (fn [_]
+    (->> (api/volumes)
+         (resp-ok))))
+
+(defmethod dispatch :volume [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/volume (:name route-params))
+         (resp-ok))))
+
+(defmethod dispatch :volume-create [_]
+  (fn [{:keys [params]}]
+    (let [payload (keywordize-keys params)]
+      (->> (api/create-volume payload)
+           (resp-created)))))
+
+(defmethod dispatch :volume-delete [_]
+  (fn [{:keys [route-params]}]
+    (api/delete-volume (:name route-params))
+    (resp-ok)))
+
+;; Secret handler
+
+(defmethod dispatch :secrets [_]
+  (fn [_]
+    (->> (api/secrets)
+         (resp-ok))))
+
+(defmethod dispatch :secret [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/secret (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :secret-create [_]
+  (fn [{:keys [params]}]
+    (let [payload (keywordize-keys params)]
+      (->> (api/create-secret payload)
+           (resp-created)))))
+
+(defmethod dispatch :secret-delete [_]
+  (fn [{:keys [route-params]}]
+    (api/delete-secret (:id route-params))
+    (resp-ok)))
+
+(defmethod dispatch :secret-update [_]
+  (fn [{:keys [route-params params]}]
+    (let [payload (keywordize-keys params)]
+      (api/update-secret (:id route-params) payload)
+      (resp-ok))))
+
+;; Node handler
+
+(defmethod dispatch :nodes [_]
+  (fn [_]
+    (->> (api/nodes)
+         (resp-ok))))
+
+(defmethod dispatch :node [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/node (:id route-params))
+         (resp-ok))))
+
+;; Placement handler
+
+(defmethod dispatch :placement [_]
+  (fn [_]
+    (->> (api/placement)
+         (resp-ok))))
+
+;; Task handler
+
+(defmethod dispatch :tasks [_]
+  (fn [_]
+    (->> (api/tasks)
+         (resp-ok))))
+
+(defmethod dispatch :task [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/task (:id route-params))
+         (resp-ok))))
+
 ;; Registry handler

 (defmethod dispatch :registries [_]
-  (fn [_]
-    (->> (api/registries)
-         (resp-ok))))
+  (fn [{:keys [identity]}]
+    (let [owner (get-in identity [:usr :username])]
+      (->> (api/registries owner)
+           (resp-ok)))))
+
+(defmethod dispatch :registries-list [_]
+  (fn [{:keys [identity]}]
+    (let [owner (get-in identity [:usr :username])]
+      (->> (api/registries-list owner)
+           (resp-ok)))))

 (defmethod dispatch :registry [_]
   (fn [{:keys [route-params]}]
     (->> (api/registry (:id route-params))
          (resp-ok))))

-(defmethod dispatch :registries-list [_]
-  (fn [_]
-    (->> (api/registries-list)
-         (resp-ok))))
-
 (defmethod dispatch :registry-delete [_]
   (fn [{:keys [route-params]}]
     (api/delete-registry (:id route-params))
     (resp-ok)))

 (defmethod dispatch :registry-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)]
+  (fn [{:keys [params identity]}]
+    (let [owner (get-in identity [:usr :username])
+          payload (assoc (keywordize-keys params) :owner owner
+                                                  :type "registry")]
       (if (api/registry-valid? payload)
         (let [response (api/create-registry payload)]
           (if (some? response)
@@ -130,229 +274,87 @@
             (resp-error 400 "Registry already exist")))
         (resp-error 400 "Registry credentials does not match any known registry")))))

-;; Service handler
-
-(defmethod dispatch :services [_]
-  (fn [_]
-    (->> (api/services)
-         (resp-ok))))
-
-(defmethod dispatch :service [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/service (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :service-networks [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/service-networks (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :service-tasks [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/service-tasks (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :service-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)]
-      (->> (api/create-service payload)
-           (resp-created)))))
-
-(defmethod dispatch :service-update [_]
-  (fn [{:keys [route-params params]}]
-    (let [payload (keywordize-keys params)]
-      (api/update-service (:id route-params) payload false)
-      (resp-ok))))
-
-(defmethod dispatch :service-delete [_]
-  (fn [{:keys [route-params]}]
-    (api/delete-service (:id route-params))
-    (resp-ok)))
-
-;; Network handler
-
-(defmethod dispatch :networks [_]
-  (fn [_]
-    (->> (api/networks)
-         (resp-ok))))
-
-(defmethod dispatch :network [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/network (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :network-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)]
-      (->> (api/create-network payload)
-           (resp-created)))))
-
-(defmethod dispatch :network-delete [_]
-  (fn [{:keys [route-params]}]
-    (api/delete-network (:id route-params))
-    (resp-ok)))
-
-;; Volume handler
-
-(defmethod dispatch :volumes [_]
-  (fn [_]
-    (->> (api/volumes)
-         (resp-ok))))
-
-(defmethod dispatch :volume [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/volume (:name route-params))
-         (resp-ok))))
-
-(defmethod dispatch :volume-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)]
-      (->> (api/create-volume payload)
-           (resp-created)))))
-
-(defmethod dispatch :volume-delete [_]
-  (fn [{:keys [route-params]}]
-    (api/delete-volume (:name route-params))
-    (resp-ok)))
-
-;; Secret handler
-
-(defmethod dispatch :secrets [_]
-  (fn [_]
-    (->> (api/secrets)
-         (resp-ok))))
-
-(defmethod dispatch :secret [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/secret (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :secret-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)]
-      (->> (api/create-secret payload)
-           (resp-created)))))
-
-(defmethod dispatch :secret-delete [_]
-  (fn [{:keys [route-params]}]
-    (api/delete-secret (:id route-params))
-    (resp-ok)))
-
-(defmethod dispatch :secret-update [_]
-  (fn [{:keys [route-params params]}]
-    (let [payload (keywordize-keys params)]
-      (api/update-secret (:id route-params) payload)
-      (resp-ok))))
-
-;; Node handler
-
-(defmethod dispatch :nodes [_]
-  (fn [_]
-    (->> (api/nodes)
-         (resp-ok))))
-
-(defmethod dispatch :node [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/node (:id route-params))
-         (resp-ok))))
-
-;; Placement handler
-
-(defmethod dispatch :placement [_]
-  (fn [_]
-    (->> (api/placement)
-         (resp-ok))))
-
-;; Task handler
-
-(defmethod dispatch :tasks [_]
-  (fn [_]
-    (->> (api/tasks)
-         (resp-ok))))
-
-(defmethod dispatch :task [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/task (:id route-params))
-         (resp-ok))))
-
-;; Registry v2 handler
-
-(defmethod dispatch :repositories [_]
-  (fn [{:keys [route-params]}]
-    (let [registry-name (:registry route-params)
-          registry (api/registry-by-name registry-name)]
-      (if (nil? registry)
-        (resp-error 400 "Unknown registry")
-        (->> (api/repositories registry)
-             (resp-ok))))))
-
-(defmethod dispatch :repository-tags [_]
+(defmethod dispatch :registry-repositories [_]
+  (fn [{:keys [route-params]}]
+    (let [registry-id (:id route-params)]
+      (->> (api/registry-repositories registry-id)
+           (resp-ok)))))
+
+(defmethod dispatch :registry-repository-tags [_]
   (fn [{:keys [route-params query-string]}]
     (let [query (keywordize-keys (query->map query-string))
           repository-name (:repository query)
-          registry-name (:registry route-params)
-          registry (api/registry-by-name registry-name)]
-      (if (nil? registry)
-        (resp-error 400 "Unknown registry")
-        (if (nil? repository-name)
-          (resp-error 400 "Parameter repository missing")
-          (->> (api/tags registry repository-name)
-               (resp-ok)))))))
+          registry-id (:id route-params)]
+      (if (nil? repository-name)
+        (resp-error 400 "Parameter repository missing")
+        (->> (api/registry-tags registry-id repository-name)
+             (resp-ok))))))

 ;; Dockerhub handler

+(defmethod dispatch :dockerhub-users [_]
+  (fn [{:keys [identity]}]
+    (let [owner (get-in identity [:usr :username])]
+      (->> (api/dockerusers owner)
+           (resp-ok)))))
+
 (defmethod dispatch :dockerhub-users-list [_]
-  (fn [_]
-    (->> (api/dockerusers-list)
-         (resp-ok))))
-
-(defmethod dispatch :dockerhub-repositories [_]
+  (fn [{:keys [identity]}]
+    (let [owner (get-in identity [:usr :username])]
+      (->> (api/dockerusers-list owner)
+           (resp-ok)))))
+
+(defmethod dispatch :dockerhub-user [_]
+  (fn [{:keys [route-params]}]
+    (->> (api/dockeruser (:id route-params))
+         (resp-ok))))
+
+(defmethod dispatch :dockerhub-user-create [_]
+  (fn [{:keys [params identity]}]
+    (let [owner (get-in identity [:usr :username])
+          payload (assoc (keywordize-keys params) :owner owner
+                                                  :type "dockeruser")
+          dockeruser-info (api/dockeruser-info payload)]
+      (api/dockeruser-login payload)
+      (let [response (api/create-dockeruser payload dockeruser-info)]
+        (if (some? response)
+          (resp-created (select-keys response [:id]))
+          (resp-error 400 "Docker user already exist"))))))
+
+(defmethod dispatch :dockerhub-user-delete [_]
+  (fn [{:keys [route-params]}]
+    (api/delete-dockeruser (:id route-params))
+    (resp-ok)))
+
+(defmethod dispatch :dockerhub-user-repositories [_]
+  (fn [{:keys [route-params]}]
+    (let [dockeruser-id (:id route-params)]
+      (->> (api/dockeruser-repositories dockeruser-id)
+           (resp-ok)))))
+
+(defmethod dispatch :dockerhub-user-tags [_]
+  (fn [{:keys [route-params query-string]}]
+    (let [query (keywordize-keys (query->map query-string))
+          repository-name (:repository query)
+          dockeruser-id (:id route-params)]
+      (if (nil? repository-name)
+        (resp-error 400 "Parameter repository missing")
+        (->> (api/dockeruser-tags dockeruser-id repository-name)
+             (resp-ok))))))
+
+(defmethod dispatch :public-repositories [_]
   (fn [{:keys [query-string]}]
     (let [query (keywordize-keys (query->map query-string))
           repository-query (:query query)
           repository-page (:page query)]
-      (->> (api/dockerhub-repositories repository-query repository-page)
-           (resp-ok)))))
-
-(defmethod dispatch :dockerhub-repository-tags [_]
+      (->> (api/public-repositories repository-query repository-page)
+           (resp-ok)))))
+
+(defmethod dispatch :public-repository-tags [_]
   (fn [{:keys [query-string]}]
     (let [query (keywordize-keys (query->map query-string))
-          repository-name (:repository query)
-          dockeruser-name (:user query)]
+          repository-name (:repository query)]
       (if (nil? repository-name)
         (resp-error 400 "Parameter repository missing")
-        (->> (api/dockerhub-tags repository-name dockeruser-name)
-             (resp-ok))))))
-
-(defmethod dispatch :dockerhub-user-repositories [_]
-  (fn [{:keys [route-params]}]
-    (let [dockeruser (api/dockeruser-by-username (:user route-params))]
-      (if (nil? dockeruser)
-        (resp-error 400 "Unknown dockerhub user")
-        (->> (api/dockeruser-repositories dockeruser)
-             (resp-ok))))))
-
-(defmethod dispatch :dockerhub-users [_]
-  (fn [_]
-    (->> (api/dockerusers)
-         (resp-ok))))
-
-(defmethod dispatch :dockerhub-user [_]
-  (fn [{:keys [route-params]}]
-    (->> (api/dockeruser (:id route-params))
-         (resp-ok))))
-
-(defmethod dispatch :dockerhub-user-create [_]
-  (fn [{:keys [params]}]
-    (let [payload (keywordize-keys params)
-          user-info (api/dockeruser-info payload)]
-      (api/dockeruser-login payload)
-      (let [response (api/create-dockeruser payload user-info)]
-        (if (some? response)
-          (resp-created (select-keys response [:id]))
-          (resp-error 400 "Docker user already exist"))))))
-
-(defmethod dispatch :dockerhub-user-delete [_]
-  (fn [{:keys [route-params]}]
-    (api/delete-dockeruser (:id route-params))
-    (resp-ok)))+        (->> (api/public-tags repository-name)
+             (resp-ok))))))


Changed Vec2 to a record

Changed Vec2 to a record

So I can add protocols to it

--- src/cljs/cloj/math/vec2.cljs
+++ src/cljs/cloj/math/vec2.cljs
@@ -6,7 +6,9 @@
 (mk-vec-op mul * :x :y)
 (mk-vec-op div / :x :y)

-(defn v2 [x y] {:x x :y y})
+(defrecord Vec2 [x y])
+
+(defn v2 [x y] (->Vec2 x y))

 (defn vec2
   ([x y]   {:x x :y y})


Fix class on navbar

Fix class on navbar

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -60,7 +60,7 @@
    [:div [:a {:href "#/"} "go to the home page"]]])

 (defn navbar []
-  [:nav.navbar.navbar-fixed-top.navbar-inverse.text-center
+  [:nav.navbar.navbar-fixed-top.navbar-inverse
     [:a.navbar-brand {:href "#"}
       "Decktouch"]
     [:div#navbar.collapse.navbar-collapse


Routing without hashes

Routing without hashes

--- src/cljs/engaged/routes.cljs
+++ src/cljs/engaged/routes.cljs
@@ -14,18 +14,14 @@
     (secretary/dispatch! path)
     (re-frame/dispatch-sync [:login-resuming])))

-(defn routes []
-  (defroute "/" []
-    (re-frame/dispatch [:set-route :lobby]))
+(defroute lobby-route "/" []
+  (re-frame/dispatch [:set-route :lobby]))

-  (defroute "/about" []
-    (re-frame/dispatch [:set-route :about])))
+(defroute about-route "/about" []
+  (re-frame/dispatch [:set-route :about]))

-(defn setup-navigation []
-  (accountant/configure-navigation! {:nav-handler  dispatch!
-                                     :path-exists? secretary/locate-route})
-  (routes)
-  (accountant/dispatch-current!))
+(accountant/configure-navigation! {:nav-handler  dispatch!
+                                   :path-exists? secretary/locate-route})

-(defstate navigation
-  :start (setup-navigation))
+(defstate initial-dispatch
+  :start (accountant/dispatch-current!))


implemented Joel's suggested fixes

implemented Joel's suggested fixes

--- src/cljs/netrunner/help.cljs
+++ src/cljs/netrunner/help.cljs
@@ -24,7 +24,7 @@
              :title "How do I undo an action?"
              :content [:p "There is no \"general purpose undo button\". Surplus/missing credits, clicks can be manipulated with "
                        "the panel on the left. Trashed/played cards can be dragged back to hand and reinstalled if needed. If there
-                       are lingering/hard to dismiss prompts, try using " [:code "/close-prompt"] " command as last resort."]}
+                       are lingering/hard to dismiss prompts, try using " [:code "/close-prompt"] " command as a last resort."]}
             {:id "breakice"
              :title "How do I break ICE and fire ICE subroutines?"
              :content (list
@@ -156,8 +156,8 @@
             {:id "weird"
              :title "The site is behaving weird."
              :content [:p "The server code may have been freshly updated and you don't have the latest Javascript code. "
-                       "First step in every troubleshooting should be a forced refresh of your browser by pressing "
-                       [:code "Ctrl + F5"] ". Also read the announcements on the main page, something about server problems "
+                       "First step in every troubleshooting should be a forced refresh of your browser by doing a force refresh ("
+                       [:code "Ctrl + F5"] " on Windows). Also read the announcements on the main page, something about server problems "
                        "may be written there."]}
             {:id "laggy"
              :title "The site is laggy."


New main

New main

--- src/clojure_todo/handler.clj
+++ src/clojure_todo/handler.clj
@@ -137,7 +137,5 @@
 (defn start [port]
   (run-jetty #'app {:port port :join? false}))

-(defn -main []
-  (let [port (Integer/parseInt
-               (or (System/getenv "PORT") "8080"))]
-  (start port)))
+(defn -main [port]
+  (start port))