From deb14ed0090dca082c41a9484c3fa651ca656b5d Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Mon, 30 Dec 2024 14:04:26 +0800 Subject: [PATCH] feat: dev validate db --- .../frontend/handler/common/developer.cljs | 22 ++++++----- src/main/frontend/handler/worker.cljs | 8 +++- .../frontend/modules/shortcut/config.cljs | 38 +++++++++++-------- src/main/frontend/worker/db/validate.cljs | 33 ++++++++++++++++ src/main/frontend/worker/db_worker.cljs | 6 +++ src/resources/dicts/en.edn | 5 +-- 6 files changed, 81 insertions(+), 31 deletions(-) create mode 100644 src/main/frontend/worker/db/validate.cljs diff --git a/src/main/frontend/handler/common/developer.cljs b/src/main/frontend/handler/common/developer.cljs index 63fa267ea18..498373f78ef 100644 --- a/src/main/frontend/handler/common/developer.cljs +++ b/src/main/frontend/handler/common/developer.cljs @@ -1,17 +1,17 @@ (ns frontend.handler.common.developer "Common fns for developer related functionality" - (:require [frontend.db :as db] - [cljs.pprint :as pprint] - [frontend.state :as state] + (:require [cljs.pprint :as pprint] + [datascript.impl.entity :as de] + [frontend.config :as config] + [frontend.db :as db] + [frontend.format.mldoc :as mldoc] [frontend.handler.notification :as notification] + [frontend.persist-db :as persist-db] + [frontend.state :as state] [frontend.ui :as ui] [frontend.util.page :as page-util] - [frontend.format.mldoc :as mldoc] - [frontend.config :as config] - [frontend.persist-db :as persist-db] - [promesa.core :as p] - [datascript.impl.entity :as de] - [logseq.db.frontend.property :as db-property])) + [logseq.db.frontend.property :as db-property] + [promesa.core :as p])) ;; Fns used between menus and commands (defn show-entity-data @@ -88,6 +88,10 @@ (show-content-ast (get-in page-data [:block/file :file/content]) (:block/format page-data)) (notification/show! "No page found" :warning))))) +(defn ^:export validate-db [] + (when-let [^Object worker @state/*db-worker] + (.validate-db worker (state/get-current-repo)))) + (defn import-chosen-graph [repo] (p/let [_ (persist-db/