fix: click remote rtc graph should download it

pull/11055/head
Tienson Qin 2024-03-19 16:53:18 +08:00
parent c6b61c11fd
commit ec3506f8ad
1 changed files with 13 additions and 4 deletions

View File

@ -50,9 +50,18 @@
:let [only-cloud? (and remote? (nil? root))
db-based? (config/db-based-graph? url)]]
[:div.flex.justify-between.mb-4.items-center {:key (or url GraphUUID)}
(normalized-graph-label repo #(if only-cloud?
(state/pub-event! [:graph/pull-down-remote-graph repo])
(state/pub-event! [:graph/switch url])))
(normalized-graph-label repo
(fn []
(when-not (state/sub :rtc/downloading-graph-uuid)
(cond
root ; exists locally
(state/pub-event! [:graph/switch url])
(and db-based? remote?)
(state/pub-event! [:rtc/download-remote-graph GraphName GraphUUID])
:else
(state/pub-event! [:graph/pull-down-remote-graph repo])))))
[:div.controls
[:div.flex.flex-row.items-center
@ -107,7 +116,7 @@
(if has-prompt?
(state/set-modal! (confirm-fn))
(unlink-or-remote-fn))))}
(if (or db-based? only-cloud?) "Remove" "Unlink")])]]]))
(if only-cloud? "Remove (server)" "Unlink (local)")])]]]))
(rum/defc repos < rum/reactive
[]