diff --git a/src/cljs/main/broadfcui/components/entity_details.cljs b/src/cljs/main/broadfcui/components/entity_details.cljs index 230064f3b4..c9c50dd2a6 100644 --- a/src/cljs/main/broadfcui/components/entity_details.cljs +++ b/src/cljs/main/broadfcui/components/entity_details.cljs @@ -8,6 +8,7 @@ [broadfcui.common.links :as links] [broadfcui.common.style :as style] [broadfcui.config :as config] + [broadfcui.nav :as nav] [broadfcui.utils :as utils] )) @@ -78,7 +79,12 @@ "agora" (list (make-field :namespace "Namespace") (make-field :name "Name") - (make-field :snapshotId "Snapshot ID" :dropdown? true)) + (make-field :snapshotId "Snapshot ID" :dropdown? true + :render (fn [snapshot-id] + (if redacted? + snapshot-id + (let [method-id (merge entity {:snapshot-id snapshot-id})] + (links/create-internal {:href (nav/get-link :method-loader method-id)} snapshot-id)))))) "dockstore" (list (make-field :methodPath "Path" :render (fn [path] diff --git a/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs b/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs index fb6617558c..866506ea2c 100644 --- a/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs +++ b/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs @@ -186,7 +186,24 @@ [:span {:style {:fontWeight 500}} (:methodConfigurationNamespace submission)]] [:div {} [:div {:style {:fontWeight 200 :display "inline-block" :width 90}} "Name:"] - [:span {:style {:fontWeight 500}} (:methodConfigurationName submission)]]) + ;; if we were able to retrieve the method config (see :load-details), then display + ;; the config's name as a link. Else, display it as text with an informative tooltip. + (let [config-name (:methodConfigurationName submission) + config-namespace (:methodConfigurationNamespace submission) + ws-config (:ws-config @state) + workspace-id (:workspace-id props)] + (if ws-config + (links/create-internal + {:data-test-id (str "method-config-" config-name "-link") + :style {:fontWeight "bold"} + :href (nav/get-link :workspace-method-config + workspace-id + {:namespace config-namespace + :name config-name})} + config-name) + [:span {:style {:fontWeight 500}} config-name + (dropdown/render-info-box + {:text "This config was updated or deleted since this submission ran."})]))]) (if (get-in submission [:submissionEntity :entityType]) [:div {} (style/create-section-header "Submission Entity") @@ -244,5 +261,16 @@ :on-done (fn [{:keys [success? status-text get-parsed-response]}] (swap! state assoc :server-response (if success? {:submission (get-parsed-response)} - {:error-message status-text})))})) + {:error-message status-text})) + ;; if we successfully retrieved the submission, make a call to see if the current + ;; user has access to the method config on which this submission ran. The config + ;; may have been updated/deleted, and therefore the user may not be able to see it. + (let [submission (get-parsed-response) + config-id {:namespace (:methodConfigurationNamespace submission) + :name (:methodConfigurationName submission)}] + (endpoints/call-ajax-orch + {:endpoint (endpoints/get-workspace-method-config (:workspace-id props) config-id) + :on-done (fn [{:keys [success? status-text get-parsed-response]}] + (when success? + (swap! state assoc :ws-config (get-parsed-response))))})))})) :component-did-mount (fn [{:keys [this]}] (this :load-details))}) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index 1412c6edb8..c73d08382f 100644 --- a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs +++ b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs @@ -7,6 +7,7 @@ [broadfcui.common.table.style :as table-style] [broadfcui.common.table.utils :as table-utils] [broadfcui.common.icons :as icons] + [broadfcui.nav :as nav] [broadfcui.utils :as utils] )) @@ -47,6 +48,22 @@ (defn config->id [config] (select-keys config [:namespace :name])) +(defn- referenced-method-parts [config] + (replace (:methodRepoMethod config) [:sourceRepo :methodNamespace :methodName :methodPath :methodVersion])) + +(defn- method-as-text [config] + (string/join "/" (referenced-method-parts config))) + +(defn- method-as-maybe-link [config] + (let [{:keys [redacted? methodRepoMethod]} config + repo (:sourceRepo methodRepoMethod) + coldata (referenced-method-parts config)] + (if (or redacted? (not (= repo "agora"))) + (apply style/render-entity coldata) + (let [method-id {:namespace (:methodNamespace methodRepoMethod) + :name (:methodName methodRepoMethod) + :snapshot-id (:methodVersion methodRepoMethod)}] + (links/create-internal {:href (nav/get-link :method-loader method-id)} (apply style/render-entity coldata)))))) (defn method-config-selector [{:keys [data-test-id configs render-name toolbar-items]}] (assert configs "No configs given") @@ -74,9 +91,9 @@ (if (= repo "dockstore") "Dockstore" "FireCloud")) :render (fn [repo] [:span {:style {:fontWeight 200}} repo])} {:header "Method" :initial-width 800 - :column-data (comp (juxt :sourceRepo :methodNamespace :methodName :methodPath :methodVersion) :methodRepoMethod) - :as-text (partial clojure.string/join "/") - :render (partial apply style/render-entity)}]} + :sort-by :text + :as-text method-as-text + :render method-as-maybe-link}]} :toolbar {:get-items (constantly toolbar-items)}}])