fix: property completion for db graphs

Also complete page-tags filter with original case so that resulting query is
case sensitive. As much as possible the query builder should result what
users would type in the editor and users would type case sensitive page
refs. Also update scripts to reflect that property values should be
written as page refs for :date and :page properties
This commit is contained in:
Gabriel Horner
2023-11-06 12:48:12 -05:00
parent ba5fe52ec1
commit e8b26954a0
4 changed files with 54 additions and 15 deletions

View File

@@ -7,7 +7,8 @@
[frontend.state :as state]
[frontend.util :as util]
[frontend.handler.property.util :as pu]
[frontend.config :as config]))
[frontend.config :as config]
[logseq.graph-parser.util :as gp-util]))
(defn- build-links
[links]
@@ -89,8 +90,8 @@
current-page (or (:block/name (db/get-current-page)) "")]
(when-let [repo (state/get-current-repo)]
(let [relation (db/get-pages-relation repo journal?)
tagged-pages (db/get-all-tagged-pages repo)
namespaces (db/get-all-namespace-relation repo)
tagged-pages (map (fn [[x y]] [x (gp-util/page-name-sanity-lc y)]) (db/get-all-tagged-pages repo))
namespaces (map (fn [[x y]] [x (gp-util/page-name-sanity-lc y)]) (db/get-all-namespace-relation repo))
tags (set (map second tagged-pages))
full-pages (db/get-all-pages repo)
full-pages-map (into {} (map (juxt :block/name identity) full-pages))
@@ -143,7 +144,7 @@
tags (remove #(= page %) tags)
ref-pages (db/get-page-referenced-pages repo page)
mentioned-pages (db/get-pages-that-mentioned-page repo page show-journal)
namespaces (db/get-all-namespace-relation repo)
namespaces (map (fn [[x y]] [x (gp-util/page-name-sanity-lc y)]) (db/get-all-namespace-relation repo))
links (concat
namespaces
(map (fn [[p _aliases]]
@@ -195,7 +196,7 @@
(let [dark? (= "dark" theme)]
(when-let [repo (state/get-current-repo)]
(let [ref-blocks (db/get-block-referenced-blocks block)
namespaces (db/get-all-namespace-relation repo)
namespaces (map (fn [[x y]] [x (gp-util/page-name-sanity-lc y)]) (db/get-all-namespace-relation repo))
links (concat
(map (fn [[p _aliases]]
[block p]) ref-blocks)