<commit_before>(ns org.broadinstitute.firecloud-ui.page.status
  (:require
   [dmohs.react :as react]
   [org.broadinstitute.firecloud-ui.utils :as utils :refer [rlog jslog cljslog]]
   ))


(react/defc StatusLine
  {:render
   (fn [{:keys [props state]}]
     [:div {:style {:marginTop "0.5em"}}
      [:div {}
       (:label props) ": "
       (cond
         (nil? (:response @state))
         [:img {:src "assets/spinner.gif"
                :style {:height "1em" :verticalAlign "middle"}}]
         (not (:success? (:response @state)))
         [:span {} [:span {:style {:color "red"}} "Error"]
          (when-not (:show-error-details? @state)
            [:span {} 
             " ("
             [:a {:href "javascript:;" :style {:textDecoration "none"}
                  :onClick #(swap! state assoc :show-error-details? true)}
              "show details"]
             ")"])] 
         :else
         [:span {:style {:color "green"}} "Okay"])]
      (when (:show-error-details? @state)
        (let [response (:response @state)]
          [:div {:style {:backgroundColor "#eee" :padding 6 :fontSize "smaller"}}
           [:div {} "Status code: " (:status-code response)]
           [:div {} "Status text: " (:status-text response)]
           [:div {} "Response text:" [:br] (-> (:xhr response) .-responseText)]]))])
   :component-did-mount
   (fn [{:keys [props state]}]
     (utils/ajax-orch (:path (:request props))
                      {:on-done #(swap! state assoc :response %)}))})


(defn render []
  (react/create-element
   :div {:style {:padding "1em"}}
   [:h2 {} "Service Status"]
   [:div {}
    [StatusLine {:label "Orchestration" :request {:path "/status/ping"}}]
    [StatusLine {:label "Rawls" :request {:path "/workspaces"}}]
    [StatusLine {:label "Agora" :request {:path "/methods"}}]
    [StatusLine {:label "Thurloe" :request {:path "/register/profile"}}]]))<commit_msg>Fix broken Thurloe status link<commit_after>(ns org.broadinstitute.firecloud-ui.page.status
  (:require
   [dmohs.react :as react]
   [org.broadinstitute.firecloud-ui.utils :as utils :refer [rlog jslog cljslog]]
   ))


(react/defc StatusLine
  {:render
   (fn [{:keys [props state]}]
     [:div {:style {:marginTop "0.5em"}}
      [:div {}
       (:label props) ": "
       (cond
         (nil? (:response @state))
         [:img {:src "assets/spinner.gif"
                :style {:height "1em" :verticalAlign "middle"}}]
         (not (:success? (:response @state)))
         [:span {} [:span {:style {:color "red"}} "Error"]
          (when-not (:show-error-details? @state)
            [:span {} 
             " ("
             [:a {:href "javascript:;" :style {:textDecoration "none"}
                  :onClick #(swap! state assoc :show-error-details? true)}
              "show details"]
             ")"])] 
         :else
         [:span {:style {:color "green"}} "Okay"])]
      (when (:show-error-details? @state)
        (let [response (:response @state)]
          [:div {:style {:backgroundColor "#eee" :padding 6 :fontSize "smaller"}}
           [:div {} "Status code: " (:status-code response)]
           [:div {} "Status text: " (:status-text response)]
           [:div {} "Response text:" [:br] (-> (:xhr response) .-responseText)]]))])
   :component-did-mount
   (fn [{:keys [props state]}]
     (if (= (:path (:request props)) "/profile")
       (utils/ajax-orch (:path (:request props))
                        {:on-done #(swap! state assoc :response %)}
                        :service-prefix "/service/register")
       (utils/ajax-orch (:path (:request props))
                        {:on-done #(swap! state assoc :response %)})))})


(defn render []
  (react/create-element
   :div {:style {:padding "1em"}}
   [:h2 {} "Service Status"]
   [:div {}
    [StatusLine {:label "Orchestration" :request {:path "/status/ping"}}]
    [StatusLine {:label "Rawls" :request {:path "/workspaces"}}]
    [StatusLine {:label "Agora" :request {:path "/methods"}}]
    [StatusLine {:label "Thurloe" :request {:path "/profile"}}]]))
{'fraction_non_alphanumeric': 0.19679012345679012, 'fraction_numerical': 0.002962962962962963, 'mean_word_length': 2.46535500427716, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3224516', 'n_tokens_mistral': 1370, 'n_tokens_neox': 1256, 'n_words': 327}