enhance: dev command to update db graph with its db.sqlite

This commit is contained in:
Gabriel Horner
2023-12-20 17:02:02 -05:00
parent 0fc1fd0f15
commit f7e890b662
5 changed files with 35 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
[rum.core :as rum]
[frontend.config :as config]
[frontend.handler.repo :as repo-handler]
[frontend.handler.common.developer :as dev-common-handler]
[reitit.frontend.easy :as rfe]
[clojure.string :as string]))
@@ -203,7 +204,20 @@
:id (config/get-repo-dir url)
:graph url
:original-graph original-graph}))))
:on-chosen #(repo-handler/remove-repo! (:original-graph %))}})
:on-chosen #(repo-handler/remove-repo! (:original-graph %))}
:db-graph-replace
{:items-fn (fn []
(let [current-repo (state/get-current-repo)]
(->> (state/get-repos)
(remove (fn [{:keys [url]}]
;; Can't replace current graph as ui wouldn't reload properly
(or (= url current-repo) (not (config/db-based-graph? url)))))
(map (fn [{:keys [url] :as original-graph}]
{:value (text-util/get-graph-name-from-path url)
:id (config/get-repo-dir url)
:graph url
:original-graph original-graph})))))
:on-chosen #(dev-common-handler/import-chosen-graph (:graph %))}})
(rum/defc select-modal < rum/reactive
[]