Tienson Qin 6 mesi fa
parent
commit
8f2f40df8e
2 ha cambiato i file con 11 aggiunte e 12 eliminazioni
  1. 7 10
      clj-e2e/src/logseq/e2e/graph.clj
  2. 4 2
      src/main/frontend/components/repo.cljs

+ 7 - 10
clj-e2e/src/logseq/e2e/graph.clj

@@ -2,9 +2,9 @@
   (:require [clojure.edn :as edn]
   (:require [clojure.edn :as edn]
             [clojure.string :as string]
             [clojure.string :as string]
             [logseq.e2e.assert :as assert]
             [logseq.e2e.assert :as assert]
+            [logseq.e2e.locator :as loc]
             [logseq.e2e.util :as util]
             [logseq.e2e.util :as util]
-            [wally.main :as w]
-            [logseq.e2e.locator :as loc]))
+            [wally.main :as w]))
 
 
 (defn- refresh-all-remote-graphs
 (defn- refresh-all-remote-graphs
   []
   []
@@ -39,14 +39,11 @@
 (defn remove-remote-graph
 (defn remove-remote-graph
   [graph-name]
   [graph-name]
   (wait-for-remote-graph graph-name)
   (wait-for-remote-graph graph-name)
-  (let [local-unlink-button-q
-        (.first (w/-query (format "div[data-testid='logseq_db_%s'] a:has-text(\"Unlink (local)\")" graph-name)))]
-    (if (.isVisible local-unlink-button-q)
-      (do (w/click local-unlink-button-q)
-          (w/click "div[role='alertdialog'] button:text('ok')")
-          (remove-remote-graph graph-name))
-      (do (w/click (format "div[data-testid='logseq_db_%s'] a:has-text(\"Remove (server)\")" graph-name))
-          (w/click "div[role='alertdialog'] button:text('ok')")))))
+  (let [action-btn
+        (.first (w/-query (format "div[data-testid='logseq_db_%s'] .graph-action-btn" graph-name)))]
+    (w/click action-btn)
+    (w/click ".delete-remote-graph-menu-item")
+    (w/click "div[role='alertdialog'] button:text('ok')")))
 
 
 (defn switch-graph
 (defn switch-graph
   [to-graph-name wait-sync?]
   [to-graph-name wait-sync?]

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

@@ -102,13 +102,14 @@
            {:asChild true}
            {:asChild true}
            (shui/button
            (shui/button
             {:variant "ghost"
             {:variant "ghost"
-             :class "!px-1"
+             :class "graph-action-btn !px-1"
              :size :sm}
              :size :sm}
             (ui/icon "dots" {:size 15})))
             (ui/icon "dots" {:size 15})))
           (shui/dropdown-menu-content
           (shui/dropdown-menu-content
            {:align "end"}
            {:align "end"}
            (shui/dropdown-menu-item
            (shui/dropdown-menu-item
             {:key "delete-locally"
             {:key "delete-locally"
+             :class "delete-local-graph-menu-item"
              :on-click (fn []
              :on-click (fn []
                          (let [prompt-str (if db-based?
                          (let [prompt-str (if db-based?
                                             (str "Are you sure to permanently delete the graph \"" graph-name "\" from Logseq?")
                                             (str "Are you sure to permanently delete the graph \"" graph-name "\" from Logseq?")
@@ -122,10 +123,11 @@
                                (p/then (fn []
                                (p/then (fn []
                                          (repo-handler/remove-repo! repo)
                                          (repo-handler/remove-repo! repo)
                                          (state/pub-event! [:graph/unlinked repo (state/get-current-repo)]))))))}
                                          (state/pub-event! [:graph/unlinked repo (state/get-current-repo)]))))))}
-            "Delete")
+            "Delete local graph")
            (when (and remote? (or (and db-based? manager?) (not db-based?)))
            (when (and remote? (or (and db-based? manager?) (not db-based?)))
              (shui/dropdown-menu-item
              (shui/dropdown-menu-item
               {:key "delete-remotely"
               {:key "delete-remotely"
+               :class "delete-remote-graph-menu-item"
                :on-click (fn []
                :on-click (fn []
                            (let [prompt-str (str "Are you sure to permanently delete the graph \"" graph-name "\" from our server?")]
                            (let [prompt-str (str "Are you sure to permanently delete the graph \"" graph-name "\" from our server?")]
                              (-> (shui/dialog-confirm!
                              (-> (shui/dialog-confirm!