Components annotations

This commit is contained in:
Pablo Alba 2023-04-27 13:26:32 +02:00 committed by Andrés Moya
parent cd1825d97a
commit 68367b002e
19 changed files with 495 additions and 38 deletions

View file

@ -639,11 +639,13 @@
:id id
:name (:name new-component)
:path (:path new-component)
:annotation (:annotation new-component)
:objects (:objects new-component)}) ;; this won't exist in components-v2
(update :undo-changes d/preconj {:type :mod-component
:id id
:name (:name prev-component)
:path (:path prev-component)
:annotation (:annotation prev-component)
:objects (:objects prev-component)}))
changes)))

View file

@ -22,6 +22,8 @@
(s/def ::page-id uuid?)
(s/def ::component-id uuid?)
(s/def ::name string?)
(s/def ::path string?)
(s/def ::annotation string?)
(defmulti operation-spec :type)
@ -158,7 +160,7 @@
(defmethod change-spec :mod-component [_]
(s/keys :req-un [::id]
:opt-un [::name :internal.changes.add-component/shapes]))
:opt-un [::name ::path ::annotation :internal.changes.add-component/shapes]))
(s/def :internal.changes.del-component/skip-undelete? boolean?)

View file

@ -45,7 +45,7 @@
:main-instance-page main-instance-page))))
(defn mod-component
[file-data {:keys [id name path objects]}]
[file-data {:keys [id name path objects annotation]}]
(let [wrap-objects-fn feat/*wrap-with-objects-map-fn*]
(update-in file-data [:components id]
(fn [component]
@ -58,7 +58,13 @@
(assoc :path path)
(some? objects)
(assoc :objects objects)))))))
(assoc :objects objects)
(some? annotation)
(assoc :annotation annotation)
(nil? annotation)
(dissoc :annotation)))))))
(defn get-component
([file-data component-id]