<commit_before>(ns searchbot.core
  (:require-macros [cljs.core.async.macros :refer [go alt!]])
  (:require [om.core :as om :include-macros true]
;;             [om-tools.dom :as dom :include-macros true]
            [om-tools.core :refer-macros [defcomponent]]
            [sablono.core :as html :refer-macros [html]]
            [cljs-http.client :as http]
            [goog.events :as events]
            [cljs.core.async :refer [put! <! >! chan timeout]]
            [searchbot.widgets :refer [the-aggregator widgets init-app-state navbar >jobs]]
            [searchbot.menus :refer [off-canvas widgets-grid widget-detail]]))

(defonce app-state (atom {:aggregators []
                          :agg {}}))

(defn- agg-jobs [] (om/ref-cursor (:aggregators (om/root-cursor app-state))))
(defn- es-settings [] (om/ref-cursor (:es-settings (om/root-cursor app-state))))

(defcomponent my-app [app owner]
  (will-mount [_]
              (go (let [{jobs :aggregators} (<! (init-app-state app))]
                    (>jobs jobs (:req-chan (om/get-shared owner)) es-settings))))
  (render [_] (html [:div
                     (om/build navbar app)
                     (om/build widgets app)]))
  (did-update [_ _ _]
              (.log js/console "# updating my-app")))


(defn main []
;;   (om/root my-app app-state {:target js/document.body})
  (let [req-chan (chan)
        resp-chan (chan)]
    (go (while true
          (let [jobs (agg-jobs)]
            (.log js/console (str (count jobs) " jobs: " (map :agg-key jobs)))
            (>jobs jobs req-chan es-settings)
            (<! (timeout 30000)))))

    (om/root off-canvas
             app-state
             {:target js/document.body
              :opts {:content my-app
                     :top-menu {:content widgets-grid :header "Widgets"}
                     :sub-menu {:content widget-detail :header "Widget Design"}}
              :shared {:req-chan req-chan
                       :resp-chan resp-chan
                       :es-settings es-settings}})
    ))<commit_msg>get poll-interval from app-state if possible<commit_after>(ns searchbot.core
  (:require-macros [cljs.core.async.macros :refer [go alt!]])
  (:require [om.core :as om :include-macros true]
;;             [om-tools.dom :as dom :include-macros true]
            [om-tools.core :refer-macros [defcomponent]]
            [sablono.core :as html :refer-macros [html]]
            [cljs-http.client :as http]
            [goog.events :as events]
            [cljs.core.async :refer [put! <! >! chan timeout]]
            [searchbot.widgets :refer [the-aggregator widgets init-app-state navbar >jobs]]
            [searchbot.menus :refer [off-canvas widgets-grid widget-detail]]))

(defonce app-state (atom {:aggregators []
                          :agg {}}))

(defn- agg-jobs [] (om/ref-cursor (:aggregators (om/root-cursor app-state))))
(defn- es-settings [] (om/ref-cursor (:es-settings (om/root-cursor app-state))))

(defcomponent my-app [app owner]
  (will-mount [_]
              (go (let [{jobs :aggregators} (<! (init-app-state app))]
                    (>jobs jobs (:req-chan (om/get-shared owner)) es-settings))))
  (render [_] (html [:div
                     (om/build navbar app)
                     (om/build widgets app)]))
  (did-update [_ _ _]
              (.log js/console "# updating my-app")))


(defn main []
;;   (om/root my-app app-state {:target js/document.body})
  (let [req-chan (chan)
        resp-chan (chan)]
    (go (while true
          (let [jobs (agg-jobs)]
            (.log js/console (str (count jobs) " jobs: " (map :agg-key jobs)))
            (>jobs jobs req-chan es-settings)
            (<! (timeout (or (:poll-interval @app-state) 30000))))))

    (om/root off-canvas
             app-state
             {:target js/document.body
              :opts {:content my-app
                     :top-menu {:content widgets-grid :header "Widgets"}
                     :sub-menu {:content widget-detail :header "Widget Design"}}
              :shared {:req-chan req-chan
                       :resp-chan resp-chan
                       :es-settings es-settings}})
    ))
{'fraction_non_alphanumeric': 0.1559633027522936, 'fraction_numerical': 0.0024142926122646064, 'mean_word_length': 1.9237826393789696, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4485016', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1270, 'n_words': 320}