From 931ff267164defad10fe7941837d19dfa685ef70 Mon Sep 17 00:00:00 2001 From: David An Date: Fri, 2 Nov 2018 10:15:26 -0400 Subject: [PATCH 1/9] link from submission detail view to method config on which the submission ran --- .../workspace/monitor/submission_details.cljs | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) 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..0fbb2a8d01 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,20 @@ [: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. + (if (:ws-config @state) + (links/create-internal + {:data-test-id (str "method-config-" (:methodConfigurationName submission) "-link") + :style {:fontWeight "bold"} + :href (nav/get-link :workspace-method-config + (:workspace-id props) + {:namespace (:methodConfigurationNamespace submission) + :name (:methodConfigurationName submission)})} + (:methodConfigurationName submission)) + [:span {:style {:fontWeight 500}} (:methodConfigurationName submission) + (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 +257,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))}) From fc8bdd8eb0e22f957482669c9061d7f76eb01206 Mon Sep 17 00:00:00 2001 From: David An Date: Fri, 2 Nov 2018 11:36:59 -0400 Subject: [PATCH 2/9] link from method config detail to referenced method snapshot --- src/cljs/main/broadfcui/components/entity_details.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cljs/main/broadfcui/components/entity_details.cljs b/src/cljs/main/broadfcui/components/entity_details.cljs index 230064f3b4..d9aff2f8ac 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 [snapshotId] + (if redacted? + snapshotId + (let [method-id (merge entity {:snapshot-id snapshotId})] + (links/create-internal {:href (nav/get-link :method-loader method-id)} snapshotId)))))) "dockstore" (list (make-field :methodPath "Path" :render (fn [path] From 29a86a235a5d2171aec597a4c6e8b7c1174390f6 Mon Sep 17 00:00:00 2001 From: David An Date: Fri, 2 Nov 2018 13:17:09 -0400 Subject: [PATCH 3/9] link from workspace config list to referenced methods --- .../page/workspace/workspace_common.cljs | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index 1412c6edb8..b71c4b0967 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,23 @@ (defn config->id [config] (select-keys config [:namespace :name])) +(defn- referenced-method-parts [config] + ((juxt :sourceRepo :methodNamespace :methodName :methodPath :methodVersion) (:methodRepoMethod config))) + +(defn- method-as-text [config] + (clojure.string/join "/" (referenced-method-parts config))) + +(defn- method-as-maybe-link [config] + (let [redacted? (:redacted? config) + methodRepoMethod (: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 +92,10 @@ (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)}}]) From aab57f4ac89143f524aa2aca802a1c6298dcac00 Mon Sep 17 00:00:00 2001 From: David An Date: Mon, 5 Nov 2018 17:37:49 -0500 Subject: [PATCH 4/9] clojure.string -> string --- src/cljs/main/broadfcui/page/workspace/workspace_common.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index b71c4b0967..702760760a 100644 --- a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs +++ b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs @@ -52,7 +52,7 @@ ((juxt :sourceRepo :methodNamespace :methodName :methodPath :methodVersion) (:methodRepoMethod config))) (defn- method-as-text [config] - (clojure.string/join "/" (referenced-method-parts config))) + (string/join "/" (referenced-method-parts config))) (defn- method-as-maybe-link [config] (let [redacted? (:redacted? config) From e42fd9e8fe94ea71cbc9e79251956ebf53d908ea Mon Sep 17 00:00:00 2001 From: David An Date: Mon, 5 Nov 2018 17:41:54 -0500 Subject: [PATCH 5/9] juxt -> replace --- src/cljs/main/broadfcui/page/workspace/workspace_common.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index 702760760a..1f0d279c47 100644 --- a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs +++ b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs @@ -49,7 +49,7 @@ (select-keys config [:namespace :name])) (defn- referenced-method-parts [config] - ((juxt :sourceRepo :methodNamespace :methodName :methodPath :methodVersion) (:methodRepoMethod config))) + (replace (:methodRepoMethod config) [:sourceRepo :methodNamespace :methodName :methodPath :methodVersion])) (defn- method-as-text [config] (string/join "/" (referenced-method-parts config))) From 745681e80946eaf8d02c375388dc60d147ee29f1 Mon Sep 17 00:00:00 2001 From: David An Date: Tue, 6 Nov 2018 12:05:00 -0500 Subject: [PATCH 6/9] kebab case a var --- src/cljs/main/broadfcui/components/entity_details.cljs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cljs/main/broadfcui/components/entity_details.cljs b/src/cljs/main/broadfcui/components/entity_details.cljs index d9aff2f8ac..c9c50dd2a6 100644 --- a/src/cljs/main/broadfcui/components/entity_details.cljs +++ b/src/cljs/main/broadfcui/components/entity_details.cljs @@ -80,11 +80,11 @@ (make-field :namespace "Namespace") (make-field :name "Name") (make-field :snapshotId "Snapshot ID" :dropdown? true - :render (fn [snapshotId] + :render (fn [snapshot-id] (if redacted? - snapshotId - (let [method-id (merge entity {:snapshot-id snapshotId})] - (links/create-internal {:href (nav/get-link :method-loader method-id)} snapshotId)))))) + 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] From f0a1867d9482b75125ae559dbe01e53e23ccae7e Mon Sep 17 00:00:00 2001 From: David An Date: Tue, 6 Nov 2018 12:05:36 -0500 Subject: [PATCH 7/9] formatting --- src/cljs/main/broadfcui/page/workspace/workspace_common.cljs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index 1f0d279c47..3ad274aeb8 100644 --- a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs +++ b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs @@ -94,8 +94,7 @@ {:header "Method" :initial-width 800 :sort-by :text :as-text method-as-text - :render method-as-maybe-link - }]} + :render method-as-maybe-link}]} :toolbar {:get-items (constantly toolbar-items)}}]) From db5ca35b384540ecf7ac2b6de7ff8a2fa82cfb4a Mon Sep 17 00:00:00 2001 From: David An Date: Tue, 6 Nov 2018 12:08:14 -0500 Subject: [PATCH 8/9] :keys for destructuring --- src/cljs/main/broadfcui/page/workspace/workspace_common.cljs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs index 3ad274aeb8..c73d08382f 100644 --- a/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs +++ b/src/cljs/main/broadfcui/page/workspace/workspace_common.cljs @@ -55,8 +55,7 @@ (string/join "/" (referenced-method-parts config))) (defn- method-as-maybe-link [config] - (let [redacted? (:redacted? config) - methodRepoMethod (:methodRepoMethod config) + (let [{:keys [redacted? methodRepoMethod]} config repo (:sourceRepo methodRepoMethod) coldata (referenced-method-parts config)] (if (or redacted? (not (= repo "agora"))) From 5a8ce0ea4910e94e427946a59855de680909c567 Mon Sep 17 00:00:00 2001 From: David An Date: Tue, 6 Nov 2018 12:22:20 -0500 Subject: [PATCH 9/9] more destructuring --- .../workspace/monitor/submission_details.cljs | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) 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 0fbb2a8d01..866506ea2c 100644 --- a/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs +++ b/src/cljs/main/broadfcui/page/workspace/monitor/submission_details.cljs @@ -188,18 +188,22 @@ [:div {:style {:fontWeight 200 :display "inline-block" :width 90}} "Name:"] ;; 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. - (if (:ws-config @state) - (links/create-internal - {:data-test-id (str "method-config-" (:methodConfigurationName submission) "-link") - :style {:fontWeight "bold"} - :href (nav/get-link :workspace-method-config - (:workspace-id props) - {:namespace (:methodConfigurationNamespace submission) - :name (:methodConfigurationName submission)})} - (:methodConfigurationName submission)) - [:span {:style {:fontWeight 500}} (:methodConfigurationName submission) - (dropdown/render-info-box - {:text "This config was updated or deleted since this submission ran."})])]) + (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")