-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
usability: links to methods and configs [risk: low] #1444
Changes from 5 commits
931ff26
fc8bdd8
29a86a2
aab57f4
e42fd9e
745681e
f0a1867
db5ca35
5a8ce0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Destructure state and props There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also wrap this in a let and destructure the things you're using from |
||
(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))}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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] | ||
(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 [redacted? (:redacted? config) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use :keys to destructure multiple at once |
||
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 | ||
}]} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move these up a line |
||
:toolbar {:get-items (constantly toolbar-items)}}]) | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kebab case the param