revamp more
This commit is contained in:
@@ -136,14 +136,14 @@
|
|||||||
:parse-query-params (comp
|
:parse-query-params (comp
|
||||||
(query-params/parse-key :code query-params/parse-long)
|
(query-params/parse-key :code query-params/parse-long)
|
||||||
(helper/default-parse-query-params grid-page))
|
(helper/default-parse-query-params grid-page))
|
||||||
:action-buttons (fn [request]
|
:action-buttons (fn [_]
|
||||||
[(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
[(com/button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
||||||
:admin-account-new-dialog))
|
:admin-account-new-dialog))
|
||||||
:hx-target "#modal-content"
|
:hx-target "#modal-content"
|
||||||
:hx-swap "innerHTML"
|
:hx-swap "innerHTML"
|
||||||
:color :primary}
|
:color :primary}
|
||||||
"New Account")])
|
"New Account")])
|
||||||
:row-buttons (fn [request entity]
|
:row-buttons (fn [_ entity]
|
||||||
[(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
[(com/icon-button {:hx-get (str (bidi/path-for ssr-routes/only-routes
|
||||||
:admin-account-edit-dialog
|
:admin-account-edit-dialog
|
||||||
:db/id (:db/id entity)))
|
:db/id (:db/id entity)))
|
||||||
@@ -184,16 +184,15 @@
|
|||||||
(let [entity (cond-> form-params
|
(let [entity (cond-> form-params
|
||||||
(= :post request-method) (assoc :db/id "new"))
|
(= :post request-method) (assoc :db/id "new"))
|
||||||
_ (cond (= :post request-method)
|
_ (cond (= :post request-method)
|
||||||
(when-let [extant (seq (dc/q '[:find ?x :in $ ?nc :where [?x :account/numeric-code ?nc]] (dc/db conn) (:account/numeric-code entity)))]
|
(when (seq (dc/q '[:find ?x :in $ ?nc :where [?x :account/numeric-code ?nc]] (dc/db conn) (:account/numeric-code entity)))
|
||||||
(field-validation-error (format "The code %d is already in use." (:account/numeric-code entity))
|
(field-validation-error (format "The code %d is already in use." (:account/numeric-code entity))
|
||||||
[:account/numeric-code]
|
[:account/numeric-code]
|
||||||
:form form-params))
|
:form form-params))
|
||||||
)
|
)
|
||||||
;; TODO the following would work better if the schema was hydrated automatically with needed values
|
|
||||||
_ (some->> form-params
|
_ (some->> form-params
|
||||||
:account/client-overrides
|
:account/client-overrides
|
||||||
(group-by :account-client-override/client)
|
(group-by :account-client-override/client)
|
||||||
(filter (fn [[client overrides]]
|
(filter (fn [[_ overrides]]
|
||||||
(> (count overrides) 1)))
|
(> (count overrides) 1)))
|
||||||
(map first)
|
(map first)
|
||||||
seq
|
seq
|
||||||
@@ -235,16 +234,6 @@
|
|||||||
:headers {"hx-trigger" "modalclose"
|
:headers {"hx-trigger" "modalclose"
|
||||||
"hx-retarget" (format "#account-table tr[data-id=\"%d\"]" (:db/id updated-account))})))
|
"hx-retarget" (format "#account-table tr[data-id=\"%d\"]" (:db/id updated-account))})))
|
||||||
|
|
||||||
;; TODO use cursor
|
|
||||||
;; TODO index based list not dbid
|
|
||||||
|
|
||||||
;; TODO lots of weird edge cases with indexes
|
|
||||||
;; for example, what happens when you have 0, 1, 2, but then delete 1?
|
|
||||||
;; what happens when you delete 2 but then add another one?
|
|
||||||
;; preference is that the field parsing logic does better grouping of what
|
|
||||||
;; goes with what, building index on the server side
|
|
||||||
;; not needing to pass index in
|
|
||||||
|
|
||||||
;; TODO decide when cursors are used. other cases it's not, some are
|
;; TODO decide when cursors are used. other cases it's not, some are
|
||||||
(defn client-override* [override]
|
(defn client-override* [override]
|
||||||
(com/data-grid-row (-> {:x-ref "p"
|
(com/data-grid-row (-> {:x-ref "p"
|
||||||
|
|||||||
@@ -369,8 +369,6 @@
|
|||||||
:new? true} []
|
:new? true} []
|
||||||
(client-row* fc/*current*))))
|
(client-row* fc/*current*))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(def key->handler
|
(def key->handler
|
||||||
(apply-middleware-to-all-handlers
|
(apply-middleware-to-all-handlers
|
||||||
{:users (helper/page-route grid-page)
|
{:users (helper/page-route grid-page)
|
||||||
@@ -396,4 +394,3 @@
|
|||||||
(-> h
|
(-> h
|
||||||
(wrap-admin)
|
(wrap-admin)
|
||||||
(wrap-client-redirect-unauthenticated)))))
|
(wrap-client-redirect-unauthenticated)))))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user