Browse Source

fix: don't check pfs for local dbs when mkdir

Tienson Qin 5 years ago
parent
commit
e57a99ee3b

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

@@ -58,7 +58,7 @@
          {:title (t :graph)
           :options {:href (rfe/href :graph)}
           :icon svg/graph-sm})
-       (when (or logged? (nfs/supported?))
+       (when (or logged? (and (nfs/supported?) current-repo))
          {:title (t :all-graphs)
           :options {:href (rfe/href :repos)}
           :icon svg/repos-sm})

+ 4 - 3
src/main/frontend/components/repo.cljs

@@ -39,9 +39,10 @@
               (ui/button
                "Add another git repo"
                :href (rfe/href :repo-add))])
-           (ui/button
-            (t :open-a-directory)
-            :on-click nfs-handler/ls-dir-files)]
+           (when (nfs-handler/supported?)
+             (ui/button
+              (t :open-a-directory)
+              :on-click nfs-handler/ls-dir-files))]
 
           (for [{:keys [id url] :as repo} repos]
             (let [local? (config/local-db? url)]

+ 8 - 6
src/main/frontend/fs.cljs

@@ -245,12 +245,14 @@
 
 (defn mkdir-if-not-exists
   [dir]
-  (when (and dir js/window.pfs)
-    (util/p-handle
-     (stat dir nil)
-     (fn [_stat])
-     (fn [error]
-       (mkdir dir)))))
+  (when dir
+    (let [local? (config/local-db? dir)]
+      (when (or local? js/window.pfs)
+        (util/p-handle
+         (stat dir nil)
+         (fn [_stat])
+         (fn [error]
+           (mkdir dir)))))))
 
 (defn create-if-not-exists
   ([dir path]