mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
chore: mv graph view ns to frontend ns
Graph view is fairly tied to the frontend, has styling concerns in the ns and doesn't have use cases outside the app. frontend.common is the parent ns for frontend code to reuse across UI threads. Didn't move db-view because there are use cases for generating view entities outside the app and there's no styling related code in it
This commit is contained in:
@@ -176,6 +176,7 @@
|
||||
logseq.db.common.order db-order
|
||||
logseq.db.common.property-util db-property-util
|
||||
logseq.db.common.sqlite sqlite-common-db
|
||||
logseq.db.common.view db-view
|
||||
logseq.db.file-based.rules file-rules
|
||||
logseq.db.file-based.schema file-schema
|
||||
logseq.db.file-based.entity-util file-entity-util
|
||||
|
||||
2
deps/db/.carve/ignore
vendored
2
deps/db/.carve/ignore
vendored
@@ -25,8 +25,6 @@ logseq.db.sqlite.export/build-export
|
||||
;; API
|
||||
logseq.db.sqlite.export/build-import
|
||||
;; API
|
||||
logseq.db.common.graph/build-graph
|
||||
;; API
|
||||
logseq.db.common.view/get-property-values
|
||||
;; API
|
||||
logseq.db.common.view/get-view-data
|
||||
|
||||
1
deps/db/.clj-kondo/config.edn
vendored
1
deps/db/.clj-kondo/config.edn
vendored
@@ -13,6 +13,7 @@
|
||||
logseq.db.common.order db-order
|
||||
logseq.db.common.property-util db-property-util
|
||||
logseq.db.common.sqlite sqlite-common-db
|
||||
logseq.db.common.view db-view
|
||||
logseq.db.frontend.content db-content
|
||||
logseq.db.frontend.class db-class
|
||||
logseq.db.frontend.db-ident db-ident
|
||||
|
||||
15
deps/db/src/logseq/db/file_based/builtins.cljs
vendored
15
deps/db/src/logseq/db/file_based/builtins.cljs
vendored
@@ -1,15 +0,0 @@
|
||||
(ns logseq.db.file-based.builtins
|
||||
"File graph built-ins"
|
||||
(:require [clojure.set :as set]))
|
||||
|
||||
(defonce built-in-markers
|
||||
["NOW" "LATER" "DOING" "DONE" "CANCELED" "CANCELLED" "IN-PROGRESS" "TODO" "WAIT" "WAITING"])
|
||||
|
||||
(defonce built-in-priorities
|
||||
["A" "B" "C"])
|
||||
|
||||
(defonce built-in-pages-names
|
||||
(set/union
|
||||
(set built-in-markers)
|
||||
(set built-in-priorities)
|
||||
#{"Favorites" "Contents" "card"}))
|
||||
@@ -1,16 +1,24 @@
|
||||
(ns logseq.graph-parser.db
|
||||
"File graph specific db fns"
|
||||
(:require [clojure.string :as string]
|
||||
(:require [clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
[datascript.core :as d]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.uuid :as common-uuid]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.db.file-based.builtins :as file-builtins]
|
||||
[logseq.db.file-based.schema :as file-schema]))
|
||||
|
||||
(defonce built-in-markers file-builtins/built-in-markers)
|
||||
(defonce built-in-priorities file-builtins/built-in-priorities)
|
||||
(defonce built-in-pages-names file-builtins/built-in-pages-names)
|
||||
(defonce built-in-markers
|
||||
["NOW" "LATER" "DOING" "DONE" "CANCELED" "CANCELLED" "IN-PROGRESS" "TODO" "WAIT" "WAITING"])
|
||||
|
||||
(defonce built-in-priorities
|
||||
["A" "B" "C"])
|
||||
|
||||
(defonce built-in-pages-names
|
||||
(set/union
|
||||
(set built-in-markers)
|
||||
(set built-in-priorities)
|
||||
#{"Favorites" "Contents" "card"}))
|
||||
|
||||
(defn- page-title->block
|
||||
[title]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(ns logseq.db.common.graph
|
||||
(ns frontend.common.graph-view
|
||||
"Main namespace for graph view fns."
|
||||
(:require [clojure.set :as set]
|
||||
[clojure.string :as string]
|
||||
@@ -6,9 +6,9 @@
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.db.common.property-util :as db-property-util]
|
||||
[logseq.db.file-based.builtins :as file-builtins]
|
||||
[logseq.db.frontend.entity-plus :as entity-plus]
|
||||
[logseq.db.sqlite.create-graph :as sqlite-create-graph]))
|
||||
[logseq.db.sqlite.create-graph :as sqlite-create-graph]
|
||||
[logseq.graph-parser.db :as gp-db]))
|
||||
|
||||
(defn- build-links
|
||||
[links]
|
||||
@@ -97,7 +97,7 @@
|
||||
(get p (db-property-util/get-pid-2 db :logseq.property/exclude-from-graph-view))))))
|
||||
links (concat relation tagged-pages namespaces)
|
||||
linked (set (mapcat identity links))
|
||||
build-in-pages (->> (if db-based? sqlite-create-graph/built-in-pages-names file-builtins/built-in-pages-names)
|
||||
build-in-pages (->> (if db-based? sqlite-create-graph/built-in-pages-names gp-db/built-in-pages-names)
|
||||
(map string/lower-case)
|
||||
set)
|
||||
nodes (cond->> full-pages'
|
||||
@@ -232,7 +232,7 @@
|
||||
{:nodes nodes
|
||||
:links links}))))
|
||||
|
||||
(defn ^:api build-graph
|
||||
(defn build-graph
|
||||
[db opts]
|
||||
(case (:type opts)
|
||||
:global (build-global-graph db opts)
|
||||
@@ -7,6 +7,7 @@
|
||||
[clojure.walk :as walk]
|
||||
[datascript.core :as d]
|
||||
[frontend.common.file-based.db :as common-file-db]
|
||||
[frontend.common.graph-view :as graph-view]
|
||||
[frontend.config :as config]
|
||||
[frontend.date :as date]
|
||||
[frontend.db.conn :as conn]
|
||||
@@ -17,7 +18,6 @@
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.common.util.date-time :as date-time-util]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.db.common.graph :as db-graph]
|
||||
[logseq.db.frontend.class :as db-class]
|
||||
[logseq.db.frontend.content :as db-content]
|
||||
[logseq.db.frontend.rules :as rules]
|
||||
@@ -561,7 +561,7 @@ independent of format as format specific heading characters are stripped"
|
||||
(defn get-pages-that-mentioned-page
|
||||
[repo page-id include-journals?]
|
||||
(when-let [db (conn/get-db repo)]
|
||||
(db-graph/get-pages-that-mentioned-page db page-id include-journals?)))
|
||||
(graph-view/get-pages-that-mentioned-page db page-id include-journals?)))
|
||||
|
||||
(defn get-page-referenced-blocks-full
|
||||
([page-id]
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
[datascript.core :as d]
|
||||
[datascript.storage :refer [IStorage] :as storage]
|
||||
[frontend.common.cache :as common.cache]
|
||||
[frontend.common.graph-view :as graph-view]
|
||||
[frontend.common.thread-api :as thread-api :refer [def-thread-api]]
|
||||
[frontend.worker.db-listener :as db-listener]
|
||||
[frontend.worker.db.migrate :as db-migrate]
|
||||
@@ -31,7 +32,6 @@
|
||||
[logseq.common.config :as common-config]
|
||||
[logseq.common.util :as common-util]
|
||||
[logseq.db :as ldb]
|
||||
[logseq.db.common.graph :as db-graph]
|
||||
[logseq.db.common.order :as db-order]
|
||||
[logseq.db.common.sqlite :as sqlite-common-db]
|
||||
[logseq.db.common.view :as db-view]
|
||||
@@ -773,7 +773,7 @@
|
||||
(def-thread-api :thread-api/build-graph
|
||||
[repo option]
|
||||
(let [conn (worker-state/get-datascript-conn repo)]
|
||||
(db-graph/build-graph @conn option)))
|
||||
(graph-view/build-graph @conn option)))
|
||||
|
||||
(def ^:private *get-all-page-titles-cache (volatile! (cache/lru-cache-factory {})))
|
||||
(defn- get-all-page-titles
|
||||
|
||||
Reference in New Issue
Block a user