Browse Source

fix: query table column selection

also fix lint in related ns
Gabriel Horner 2 years ago
parent
commit
6ad560e4cb

+ 1 - 0
deps/graph-parser/src/logseq/graph_parser/property.cljs

@@ -185,6 +185,7 @@
    :background-color {:schema {:type :default}}
    :heading {:schema {:type :any}}      ; number (1-6) or boolean for auto heading
    :query-table {:schema {:type :checkbox}}
+   ;; query-properties is a coll of property uuids and keywords where keywords are special frontend properties
    :query-properties {:schema {:type :coll}}
    :query-sort-by {:schema {:type :checkbox}}
    :query-sort-desc {:schema {:type :checkbox}}

+ 2 - 1
src/main/frontend/components/query_table.cljs

@@ -112,7 +112,8 @@
   (let [properties (:block/properties current-block)
         query-properties (pu/lookup properties :query-properties)
         query-properties (if (config/db-based-graph? (state/get-current-repo))
-                           query-properties
+                           ;; TODO: Remove this when :query-properties can be saved as a vector
+                           (vec query-properties)
                            (some-> query-properties
                                    (common-handler/safe-read-string "Parsing query properties failed")))
         query-properties (if page? (remove #{:block} query-properties) query-properties)

+ 2 - 1
src/main/frontend/handler/editor.cljs

@@ -814,7 +814,8 @@
           repo (state/get-current-repo)
           db-based? (config/db-based-graph? repo)
           query-properties (if db-based?
-                             query-properties
+                           ;; TODO: Remove this when :query-properties can be saved as a vector
+                             (vec query-properties)
                              (some-> query-properties
                                      (common-handler/safe-read-string "Parsing query properties failed")))
           query-properties (if (seq query-properties)

+ 4 - 2
src/main/frontend/handler/events.cljs

@@ -328,8 +328,10 @@
 (defmethod handle :modal/set-query-properties [[_ block all-properties]]
   (let [properties (:block/properties block)
         query-properties (pu/lookup properties :query-properties)
-        block-properties (some-> query-properties
-                                 (common-handler/safe-read-string "Parsing query properties failed"))
+        block-properties (if (config/db-based-graph? (state/get-current-repo))
+                           query-properties
+                           (some-> query-properties
+                                   (common-handler/safe-read-string "Parsing query properties failed")))
         shown-properties (if (seq block-properties)
                            (set block-properties)
                            (set all-properties))

+ 2 - 5
src/main/frontend/handler/property.cljs

@@ -4,8 +4,7 @@
             [frontend.handler.file-based.property :as file-property]
             [frontend.config :as config]
             [frontend.state :as state]
-            [frontend.db :as db]
-            [frontend.modules.outliner.core :as outliner-core]))
+            [frontend.db :as db]))
 
 (def user-face-builtin-schema-types db-property/user-face-builtin-schema-types)
 (def internal-builtin-schema-types db-property/internal-builtin-schema-types)
@@ -27,15 +26,13 @@
 (defn update-property!
   [repo property-uuid opts]
   {:pre [(uuid? property-uuid)]}
-  #_:clj-kondo/ignore
   (when (config/db-based-graph? repo)
     (db-property/update-property! repo property-uuid opts)))
 
 (defn delete-property-value!
   "Delete value if a property has multiple values"
   [repo block property-id property-value]
-  #_:clj-kondo/ignore
-  (if (config/db-based-graph? repo)
+  (when (config/db-based-graph? repo)
     (db-property/delete-property-value! repo block property-id property-value)))
 
 (defn set-editing-new-property!