-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Juan Pedro Monetta Sanchez
authored and
Juan Pedro Monetta Sanchez
committed
Jul 27, 2023
1 parent
9f76efe
commit 2403a05
Showing
22 changed files
with
435 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
(ns flow-storm.debugger.ui.timeline.screen | ||
(:require [flow-storm.debugger.ui.utils | ||
:as ui-utils | ||
:refer [label table-view h-box border-pane icon-button event-handler]] | ||
[flow-storm.debugger.ui.state-vars | ||
:as ui-vars | ||
:refer [obj-lookup store-obj]] | ||
[flow-storm.debugger.runtime-api :as runtime-api :refer [rt-api]] | ||
[clojure.string :as str] | ||
[flow-storm.debugger.state :as dbg-state] | ||
[flow-storm.debugger.ui.flows.screen :as flows-screen]) | ||
(:import [javafx.scene.layout Priority VBox] | ||
[javafx.scene.control TableCell TableRow CheckBox] | ||
[javafx.scene.input MouseButton])) | ||
|
||
(def thread-colors ["#DAE8FC" "#D5E8D4" "#FFE6CC" "#F8CECC" "#E1D5E7" "#60A917" "#4C0099" "#CC00CC"]) | ||
|
||
(defn set-recording-check [recording?] | ||
(ui-utils/run-later | ||
(let [[record-btn] (obj-lookup "total-order-record-btn")] | ||
(.setSelected record-btn recording?)))) | ||
|
||
(defn clear-timeline [] | ||
(let [[{:keys [clear]}] (obj-lookup "total-order-table-data")] | ||
(clear))) | ||
|
||
(defn main-pane [] | ||
(let [{:keys [table-view-pane table-view add-all] :as table-data} | ||
(table-view {:columns ["Thread Id" "Thread Name" "Function" "Expression" "Value"] | ||
:resize-policy :constrained | ||
:cell-factory-fn (fn [_ cell-val] | ||
(doto (label (str cell-val)) | ||
(.setStyle "-fx-text-fill: #333"))) | ||
:row-update-fn (fn [^TableRow trow row-vec] | ||
(doto trow | ||
(.setStyle (format "-fx-background-color: %s" (-> row-vec meta :color))) | ||
(.setOnMouseClicked | ||
(event-handler | ||
[mev] | ||
(when (and (= MouseButton/PRIMARY (.getButton mev)) | ||
(= 2 (.getClickCount mev))) | ||
(let [{:keys [flow-id thread-id thread-timeline-idx]} (meta row-vec)] | ||
(flows-screen/goto-location {:flow-id flow-id | ||
:thread-id thread-id | ||
:idx thread-timeline-idx}))))))) | ||
:search-predicate (fn [[_ thread-id function expression] search-str] | ||
(boolean | ||
(or (str/includes? (str thread-id) search-str) | ||
(str/includes? function search-str) | ||
(str/includes? expression search-str)))) | ||
:items []}) | ||
record-btn (doto (CheckBox.) | ||
(.setSelected false)) | ||
_ (.setOnAction record-btn | ||
(event-handler [_] (runtime-api/set-total-order-recording rt-api (.isSelected record-btn)))) | ||
refresh-btn (icon-button :icon-name "mdi-reload" | ||
:on-click (fn [] | ||
(let [timeline (runtime-api/total-order-timeline rt-api) | ||
thread-ids (->> timeline | ||
(map :thread-id) | ||
(into #{})) | ||
thread-color (zipmap thread-ids thread-colors)] | ||
(->> timeline | ||
(mapv (fn [{:keys [type thread-id fn-ns fn-name expr-str expr-val-str] :as tl-entry}] | ||
(let [{:keys [thread/name]} (dbg-state/get-thread-info thread-id)] | ||
(with-meta | ||
(case type | ||
:fn-call [thread-id name (format "%s/%s" fn-ns fn-name) "" ""] | ||
:fn-return [thread-id name "RETURN" "" ""] | ||
:expr-exec [thread-id name "" expr-str expr-val-str]) | ||
(assoc tl-entry :color (thread-color thread-id)))))) | ||
add-all))) | ||
:tooltip "Refresh the content of the timeline") | ||
main-pane (border-pane | ||
{:top (doto (h-box [refresh-btn (label "Enable:") record-btn] "controls-box") | ||
(.setSpacing 5)) | ||
:center table-view-pane} | ||
"timeline-tool")] | ||
|
||
(store-obj "total-order-record-btn" record-btn) | ||
(store-obj "total-order-table-data" table-data) | ||
|
||
(VBox/setVgrow table-view Priority/ALWAYS) | ||
|
||
main-pane)) | ||
|
||
(comment | ||
|
||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -211,4 +211,8 @@ | |
|
||
(flow-storm.api/continue) | ||
|
||
(defn my-sum [a b] (+ a b)) | ||
|
||
(doall (pmap (fn my-sum [i] (+ i i)) (range 4))) | ||
|
||
) |
Oops, something went wrong.