浏览代码

Fix query table settings failing on click and enhance dev commands

to display properties as named maps
Gabriel Horner 2 年之前
父节点
当前提交
2327fa3103

+ 6 - 1
src/main/frontend/handler/common/developer.cljs

@@ -6,12 +6,17 @@
             [frontend.handler.notification :as notification]
             [frontend.ui :as ui]
             [frontend.util.page :as page-util]
+            [frontend.handler.property.util :as pu]
             [logseq.graph-parser.mldoc :as gp-mldoc]))
 
 ;; Fns used between menus and commands
 (defn show-entity-data
   [& pull-args]
-  (let [pull-data (with-out-str (pprint/pprint (apply db/pull pull-args)))]
+  (let [result* (apply db/pull pull-args)
+        result (cond-> result*
+                 (seq (:block/properties result*))
+                 (assoc :block.debug/properties (update-keys (:block/properties result*) pu/get-property-name)))
+        pull-data (with-out-str (pprint/pprint result))]
     (println pull-data)
     (notification/show!
      [:div

+ 1 - 1
src/main/frontend/handler/events.cljs

@@ -308,7 +308,7 @@
                       (contains? shown-properties property)
                       property-value)]
          [:div.flex.flex-row.m-2.justify-between.align-items
-          [:div (name property)]
+          [:div (if (uuid? property) (pu/get-property-name property) (name property))]
           [:div.mt-1 (ui/toggle shown?
                                 (fn []
                                   (let [value (not shown?)]

+ 5 - 1
src/main/frontend/handler/property/util.cljs

@@ -1,7 +1,6 @@
 (ns frontend.handler.property.util
   (:require [frontend.config :as config]
             [frontend.state :as state]
-            [frontend.config :as config]
             [logseq.graph-parser.property :as gp-property]
             [logseq.graph-parser.util :as gp-util]
             [frontend.db :as db]
@@ -25,6 +24,11 @@
     (when-let [properties (:block/properties block)]
       (lookup properties key))))
 
+(defn get-property-name
+  "Get a property's name given its uuid"
+  [uuid]
+  (:block/original-name (db/entity [:block/uuid uuid])))
+
 (defn block->shape [block]
   (get-property block :logseq.tldraw.shape))