Makes feature flags admin-configurable
This commit is contained in:
@@ -66,9 +66,10 @@
|
||||
id (or (:db/id client) "new-client")
|
||||
signature-file (upload-signature-data (:signature_data edit_client))
|
||||
_ (when client
|
||||
(audit-transact (into
|
||||
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))
|
||||
(mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))
|
||||
(audit-transact (-> []
|
||||
(into (mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client)))
|
||||
(into (mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))
|
||||
(into (mapv (fn [m] [:db/retract (:db/id client) :client/feature-flags m]) (:client/feature-flags client))))
|
||||
(:id context)))
|
||||
reverts (-> []
|
||||
(into (->> (:bank_accounts edit_client)
|
||||
@@ -129,6 +130,7 @@
|
||||
:address/city (:city (:address edit_client))
|
||||
:address/state (:state (:address edit_client))
|
||||
:address/zip (:zip (:address edit_client))})
|
||||
:client/feature-flags (:feature_flags edit_client)
|
||||
:client/bank-accounts (map #(remove-nils
|
||||
(cond-> {:db/id (:id %)
|
||||
:bank-account/code (:code %)
|
||||
@@ -155,6 +157,7 @@
|
||||
(:bank_accounts edit_client))
|
||||
|
||||
})
|
||||
|
||||
[:reset id :client/emails (map #(remove-nils
|
||||
{:db/id (or (:id %)
|
||||
(str (UUID/randomUUID)))
|
||||
@@ -474,6 +477,7 @@
|
||||
:name {:type 'String}
|
||||
:locked_until {:type :iso_date}
|
||||
:code {:type 'String}
|
||||
:feature_flags {:type '(list String)}
|
||||
:square_auth_token {:type 'String}
|
||||
:signature_file {:type 'String}
|
||||
:square_integration_status {:type :integration_status}
|
||||
@@ -562,6 +566,7 @@
|
||||
:locked_until {:type :iso_date}
|
||||
:code {:type 'String}
|
||||
:square_auth_token {:type 'String}
|
||||
:feature_flags {:type '(list String)}
|
||||
:signature_data {:type 'String}
|
||||
:email {:type 'String}
|
||||
:emails {:type '(list :edit_email_contact)}
|
||||
|
||||
@@ -100,8 +100,7 @@ document.getElementById(\"company-search-value\").dispatchEvent(new Event('chang
|
||||
[:div.loader.is-loading.is-active.is-centered]])))
|
||||
|
||||
(defn active-client [{:keys [identity params] :as request}]
|
||||
(clojure.pprint/pprint params)
|
||||
(let [client-id (some-> (or (:search-client params) (get params "search-client")) Long/parseLong)]
|
||||
(let [client-id (some-> (or (:search-client params) (get params "search-client")) not-empty Long/parseLong)]
|
||||
(when client-id
|
||||
(assert-can-see-client identity client-id))
|
||||
(let [new-session (assoc (:session request) :client
|
||||
|
||||
@@ -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