Просмотр исходного кода

fix: disable file sync for db graphs

Gabriel Horner 2 лет назад
Родитель
Сommit
1280f4e05d

+ 6 - 5
scripts/src/logseq/tasks/dev/db_and_file_graphs.clj

@@ -20,9 +20,9 @@
 (def file-graph-ns
   "Namespaces or parent namespaces _only_ for file graphs"
   (mapv escape-shell-regex
-        ["frontend.handler.file-based" "frontend.handler.conversion"
+        ["frontend.handler.file-based" "frontend.handler.conversion" "frontend.handler.file-sync"
          "frontend.fs"
-         "frontend.components.conversion"
+         "frontend.components.conversion" "frontend.components.file-sync"
          "frontend.util.fs"
          "frontend.modules.outliner.file"]))
 
@@ -30,13 +30,14 @@
   "Paths _only_ for DB graphs"
   ["src/main/frontend/handler/db_based"
    "src/main/frontend/components/class.cljs"
-   "src/main/frontend/components/property.cljs"])
+   "src/main/frontend/components/property.cljs"
+   "src/electron/electron/db.cljs"])
 
 (def file-graph-paths
   "Paths _only_ for file graphs"
-  ["src/main/frontend/handler/file_based" "src/main/frontend/handler/conversion.cljs"
+  ["src/main/frontend/handler/file_based" "src/main/frontend/handler/conversion.cljs" "src/main/frontend/handler/file_sync.cljs"
    "src/main/frontend/fs"
-   "src/main/frontend/components/conversion.cljs"
+   "src/main/frontend/components/conversion.cljs" "src/main/frontend/components/file_sync.cljs"
    "src/main/frontend/util/fs.cljs"
    "src/main/frontend/modules/outliner/file.cljs"])
 

+ 1 - 0
src/main/frontend/components/header.cljs

@@ -237,6 +237,7 @@
      [:div.r.flex.drag-region
       (when (and current-repo
                  (not (config/demo-graph? current-repo))
+                 (not (config/db-based-graph? current-repo))
                  (user-handler/alpha-or-beta-user?))
         (fs-sync/indicator))
 

+ 16 - 10
src/main/frontend/components/settings.cljs

@@ -159,11 +159,15 @@
    ;; right column
    [:div.mt-1.sm:mt-0.sm:col-span-2.flex.items-center
     {:style {:gap "0.5rem"}}
-    [:div (if action action (ui/button
-                              button-label
-                              :class    "text-sm p-1"
-                              :href     href
-                              :on-click on-click))]
+    [:div (cond
+            action
+            action
+            button-label
+            (ui/button
+             button-label
+             :class    "text-sm p-1"
+             :href     href
+             :on-click on-click))]
     (when-not (or (util/mobile?)
                   (mobile-util/native-platform?))
       [:div.text-sm.flex desc])]])
@@ -740,10 +744,12 @@
                (file-sync-handler/set-sync-diff-merge-enabled! (not enabled?)))
              true))
 
-(defn sync-switcher-row [enabled?]
+(defn sync-switcher-row [repo enabled?]
   (row-with-button-action
-   {:left-label (t :settings-page/sync)
-    :action (sync-enabled-switcher enabled?)}))
+   (cond-> {:left-label (t :settings-page/sync)
+            :action (sync-enabled-switcher enabled?)}
+     (config/db-based-graph? repo)
+     (merge {:action nil :desc "Not available yet for database graphs"}))))
 
 (defn sync-diff-merge-switcher-row [enabled?]
   (row-with-button-action
@@ -1015,8 +1021,8 @@
           (ui/icon  (if logged-in? "lock-open" "lock") {:class "mr-1"}) (t :settings-page/beta-features)]]
         [:div.flex.flex-col.gap-4
          {:class (when-not user-handler/alpha-or-beta-user? "opacity-50 pointer-events-none cursor-not-allowed")}
-         (sync-switcher-row enable-sync?)
-         (when enable-sync?
+         (sync-switcher-row current-repo enable-sync?)
+         (when (and enable-sync? (not (config/db-based-graph? current-repo)))
            (sync-diff-merge-switcher-row enable-sync-diff-merge?))
          [:div.text-sm
           (t :settings-page/sync-desc-1)