fix: fixes bug with unusuable :default property

Part of LOG-2953. Also fixes bug when a new property first displays
configure modal and incorrectly shows cardinality for :default property
This commit is contained in:
Gabriel Horner
2023-11-29 17:15:35 -05:00
parent c0ad1aeb4c
commit d218db4e6f
3 changed files with 13 additions and 3 deletions

View File

@@ -188,11 +188,16 @@
[:div.col-span-2
(ui/select schema-types
(fn [_e v]
(let [type (keyword (string/lower-case v))]
(swap! *property-schema assoc :type type)
(let [type (keyword (string/lower-case v))
update-schema-fn (comp
(if (contains? db-property-type/property-types-with-cardinality type)
identity
#(dissoc % :cardinality))
#(assoc % :type type))]
(swap! *property-schema update-schema-fn)
(components-pu/update-property! property @*property-name @*property-schema))))]))]
(when-not (contains? #{:checkbox :default :template} (:type @*property-schema))
(when (contains? db-property-type/property-types-with-cardinality (:type @*property-schema))
[:div.grid.grid-cols-4.gap-1.items-center.leading-8
[:label "Multiple values:"]
(let [many? (boolean (= :many (:cardinality @*property-schema)))]