Makes feature flags admin-configurable
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
(defn client-query [token]
|
||||
(cond-> [:id :name :signature-file :code :email :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits :locations :locked-until :square-auth-token
|
||||
(cond-> [:id :name :signature-file :code :email :matches :week-a-debits :week-a-credits :week-b-debits :week-b-credits :locations :locked-until :square-auth-token :feature-flags
|
||||
[:square-integration-status [:last-updated :last-attempt :message :state :id]]
|
||||
[:square-locations [:square-id :id :name :client-location]]
|
||||
[:ezcater-locations [:id [:caterer [:name :id]] :location]]
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
(def location-schema (m/schema [:map
|
||||
[:location schema/not-empty-string]]))
|
||||
|
||||
(def feature-flag-schema (m/schema [:map
|
||||
[:feature-flag schema/not-empty-string]]))
|
||||
|
||||
(def square-location-schema (m/schema [:map
|
||||
[:square-location schema/reference]
|
||||
[:client-location schema/not-empty-string]]))
|
||||
@@ -50,6 +53,7 @@
|
||||
[:name schema/not-empty-string]
|
||||
[:code schema/code-string]
|
||||
[:locations [:sequential location-schema]]
|
||||
[:feature-flags [:sequential feature-flag-schema]]
|
||||
[:emails {:optional true}
|
||||
[:maybe [:sequential email-schema]]]
|
||||
[:matches {:optional true}
|
||||
@@ -158,6 +162,7 @@
|
||||
|
||||
:locked-until (:locked-until new-client-data)
|
||||
:locations (mapv :location (:locations new-client-data))
|
||||
:feature-flags (mapv :feature-flag (:feature-flags new-client-data))
|
||||
:matches (mapv :match (:matches new-client-data))
|
||||
:location-matches (:location-matches new-client-data)
|
||||
:week-a-credits (:week-a-credits new-client-data)
|
||||
@@ -223,6 +228,9 @@
|
||||
:client-location (:client-location sl)}))))
|
||||
(update :locations #(mapv (fn [l] {:location l
|
||||
:id (random-uuid)}) %))
|
||||
|
||||
(update :feature-flags #(mapv (fn [l] {:feature-flag l
|
||||
:id (random-uuid)}) %))
|
||||
(update :matches #(mapv (fn [l] {:match l
|
||||
:id (random-uuid)}) %))
|
||||
(update :bank-accounts
|
||||
@@ -501,6 +509,9 @@
|
||||
:schema [:sequential location-schema]
|
||||
:key-fn :id}]]]]
|
||||
|
||||
|
||||
|
||||
|
||||
[form-builder/raw-field-v2 {:field :include-in-reports}
|
||||
[com/checkbox {:label "Include in reports"}]
|
||||
]
|
||||
@@ -525,6 +536,20 @@
|
||||
[:input.input {:type "code"
|
||||
:style {:width "5em"}
|
||||
:disabled (boolean (:id new-client))}]]
|
||||
[:div.field
|
||||
[:label.label "Feature Flags"]
|
||||
[:div.control
|
||||
[:p.help "These are specific new features that can be enabled or disabled on a per-client basis"]
|
||||
[form-builder/raw-field-v2 {:field :feature-flags}
|
||||
[com/multi-field-v2 {:allow-change? true
|
||||
:template [[form-builder/raw-field-v2 {:field :feature-flag}
|
||||
[com/select-field {:options [[nil nil]
|
||||
["new-square" "New Square+Ezcater"]]
|
||||
:allow-nil? false
|
||||
:style {:width "18em"}}]]]
|
||||
:key-fn :id
|
||||
:schema [:sequential feature-flag-schema]
|
||||
:next-key (random-uuid)}]]]]
|
||||
|
||||
[form-builder/field-v2 {:field :locations}
|
||||
"Locations"
|
||||
|
||||
Reference in New Issue
Block a user