Browse Source

fix: display property names not idents for query

table and settings
Gabriel Horner 1 year ago
parent
commit
5e5a8ee1df

+ 1 - 1
deps/db/src/logseq/db/frontend/property.cljs

@@ -59,7 +59,7 @@
                                                     :hide? true}}
    :logseq.property/query-table {:schema {:type :checkbox
                                           :hide? true}}
-   ;; query-properties is a coll of property uuids and keywords where keywords are special frontend keywords
+   ;; query-properties is a coll of property db-idents and keywords where keywords are special frontend keywords
    :logseq.property/query-properties {:schema {:type :coll
                                                :hide? true}}
    :logseq.property/query-sort-by {:schema {:type :keyword

+ 6 - 4
src/main/frontend/components/query_table.cljs

@@ -235,10 +235,12 @@
       [:thead
        [:tr.cursor
         (for [column columns]
-          (let [title (if (and (= column :clock-time) (integer? clock-time-total))
-                        (util/format "clock-time(total: %s)" (clock/seconds->days:hours:minutes:seconds
-                                                              clock-time-total))
-                        (name column))]
+          (let [title (if db-graph?
+                        (if (qualified-keyword? column) (db-pu/get-property-name column) (name column))
+                        (if (and (= column :clock-time) (integer? clock-time-total))
+                          (util/format "clock-time(total: %s)" (clock/seconds->days:hours:minutes:seconds
+                                                                clock-time-total))
+                          (name column)))]
             (sortable-title title column sort-state (:block/uuid current-block) {:db-graph? db-graph?})))]]
       [:tbody
        (for [row sort-result]

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

@@ -299,7 +299,8 @@
                    (reset! *query-properties {})
                    state)}
   [block shown-properties all-properties]
-  (let [query-properties (rum/react *query-properties)]
+  (let [query-properties (rum/react *query-properties)
+        db-graph? (config/db-based-graph? (state/get-current-repo))]
     [:div
      [:h1.font-semibold.-mt-2.mb-2.text-lg (t :query/config-property-settings)]
      [:a.flex
@@ -316,7 +317,9 @@
                       (contains? shown-properties property)
                       property-value)]
          [:div.flex.flex-row.my-2.justify-between.align-items
-          [:div (if (uuid? property) (db-pu/get-property-name property) (name property))]
+          [:div (if (and db-graph? (qualified-keyword? property))
+                  (db-pu/get-property-name property)
+                  (name property))]
           [:div.mt-1 (ui/toggle shown?
                                 (fn []
                                   (let [value (not shown?)]