|
|
@@ -7,7 +7,6 @@
|
|
|
[frontend.handler.user :as user]
|
|
|
[frontend.state :as state]
|
|
|
[frontend.ui :as ui]
|
|
|
- [frontend.util :as util]
|
|
|
[lambdaisland.glogi :as log]
|
|
|
[logseq.db.frontend.schema :as db-schema]
|
|
|
[logseq.shui.ui :as shui]
|
|
|
@@ -138,104 +137,6 @@
|
|
|
(shui/tabler-icon "player-stop") "stop")]])
|
|
|
|
|
|
[:hr.my-2]
|
|
|
-
|
|
|
- [:div.flex.flex-row.items-center.gap-2
|
|
|
- (ui/button (str "download graph to")
|
|
|
- {:icon "download"
|
|
|
- :class "mr-2"
|
|
|
- :on-click (fn []
|
|
|
- (when-let [graph-name (:download-graph-to-repo debug-state*)]
|
|
|
- (when-let [{:keys [graph-uuid graph-schema-version]}
|
|
|
- (:graph-uuid-to-download debug-state*)]
|
|
|
- (prn :download-graph graph-uuid graph-schema-version :to graph-name)
|
|
|
- (p/let [token (state/get-auth-id-token)
|
|
|
- download-info-uuid (state/<invoke-db-worker
|
|
|
- :thread-api/rtc-request-download-graph
|
|
|
- token graph-uuid graph-schema-version)
|
|
|
- {:keys [_download-info-uuid
|
|
|
- download-info-s3-url
|
|
|
- _download-info-tx-instant
|
|
|
- _download-info-t
|
|
|
- _download-info-created-at]
|
|
|
- :as result}
|
|
|
- (state/<invoke-db-worker :thread-api/rtc-wait-download-graph-info-ready
|
|
|
- token download-info-uuid graph-uuid graph-schema-version 60000)]
|
|
|
- (when (not= result :timeout)
|
|
|
- (assert (some? download-info-s3-url) result)
|
|
|
- (state/<invoke-db-worker :thread-api/rtc-download-graph-from-s3
|
|
|
- graph-uuid graph-name download-info-s3-url))))))})
|
|
|
-
|
|
|
- [:b "➡"]
|
|
|
- [:div.flex.flex-row.items-center.gap-2
|
|
|
- (shui/select
|
|
|
- {:on-value-change (fn [[graph-uuid graph-schema-version]]
|
|
|
- (when (and (parse-uuid graph-uuid) graph-schema-version)
|
|
|
- (swap! debug-state assoc
|
|
|
- :graph-uuid-to-download
|
|
|
- {:graph-uuid graph-uuid
|
|
|
- :graph-schema-version graph-schema-version})))}
|
|
|
- (shui/select-trigger
|
|
|
- {:class "!px-2 !py-0 !h-8 border-gray-04"}
|
|
|
- (shui/select-value
|
|
|
- {:placeholder "Select a graph-uuid"}))
|
|
|
- (shui/select-content
|
|
|
- (shui/select-group
|
|
|
- (for [{:keys [graph-uuid graph-schema-version graph-status]} (sort-by :graph-uuid (:remote-graphs debug-state*))]
|
|
|
- (shui/select-item {:value [graph-uuid graph-schema-version] :disabled (some? graph-status)} graph-uuid)))))
|
|
|
-
|
|
|
- [:b "+"]
|
|
|
- [:input.form-input.my-2.py-1
|
|
|
- {:on-change (fn [e] (swap! debug-state assoc :download-graph-to-repo (util/evalue e)))
|
|
|
- :on-focus (fn [e] (let [v (.-value (.-target e))]
|
|
|
- (when (= v "repo name here")
|
|
|
- (set! (.-value (.-target e)) ""))))
|
|
|
- :placeholder "repo name here"}]]]
|
|
|
-
|
|
|
- [:div.flex.my-2.items-center.gap-2
|
|
|
- (ui/button "upload current repo"
|
|
|
- {:icon "upload"
|
|
|
- :on-click (fn []
|
|
|
- (let [repo (state/get-current-repo)
|
|
|
- token (state/get-auth-id-token)
|
|
|
- remote-graph-name (:upload-as-graph-name debug-state*)]
|
|
|
- (state/<invoke-db-worker :thread-api/rtc-async-upload-graph
|
|
|
- repo token remote-graph-name)))})
|
|
|
- [:b "➡️"]
|
|
|
- [:input.form-input.my-2.py-1.w-32
|
|
|
- {:on-change (fn [e] (swap! debug-state assoc :upload-as-graph-name (util/evalue e)))
|
|
|
- :on-focus (fn [e] (let [v (.-value (.-target e))]
|
|
|
- (when (= v "remote graph name here")
|
|
|
- (set! (.-value (.-target e)) ""))))
|
|
|
- :placeholder "remote graph name here"}]]
|
|
|
-
|
|
|
- [:div.pb-2.flex.flex-row.items-center.gap-2
|
|
|
- (ui/button (str "delete graph")
|
|
|
- {:icon "trash"
|
|
|
- :on-click (fn []
|
|
|
- (when-let [{:keys [graph-uuid graph-schema-version]} (:graph-uuid-to-delete debug-state*)]
|
|
|
- (let [token (state/get-auth-id-token)]
|
|
|
- (prn ::delete-graph graph-uuid graph-schema-version)
|
|
|
- (state/<invoke-db-worker :thread-api/rtc-delete-graph
|
|
|
- token graph-uuid graph-schema-version))))})
|
|
|
-
|
|
|
- (shui/select
|
|
|
- {:on-value-change (fn [[graph-uuid graph-schema-version]]
|
|
|
- (when (and (parse-uuid graph-uuid) graph-schema-version)
|
|
|
- (swap! debug-state assoc
|
|
|
- :graph-uuid-to-delete
|
|
|
- {:graph-uuid graph-uuid
|
|
|
- :graph-schema-version graph-schema-version})))}
|
|
|
- (shui/select-trigger
|
|
|
- {:class "!px-2 !py-0 !h-8"}
|
|
|
- (shui/select-value
|
|
|
- {:placeholder "Select a graph-uuid"}))
|
|
|
- (shui/select-content
|
|
|
- (shui/select-group
|
|
|
- (for [{:keys [graph-uuid graph-schema-version graph-status]} (:remote-graphs debug-state*)]
|
|
|
- (shui/select-item {:value [graph-uuid graph-schema-version] :disabled (some? graph-status)} graph-uuid)))))]
|
|
|
-
|
|
|
- [:hr.my-2]
|
|
|
-
|
|
|
(let [*keys-state (get state ::keys-state)
|
|
|
keys-state @*keys-state]
|
|
|
[:div
|