Skip to content

Commit

Permalink
GUI: fix logs tab
Browse files Browse the repository at this point in the history
  • Loading branch information
pirbo committed Feb 27, 2024
1 parent 3a4a12f commit a9e7741
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions gui/tab_log.ml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
(******************************************************************************)

module Html = Tyxml_js.Html5
open Lwt.Infix

let tab_is_active, set_tab_is_active = React.S.create false
let tab_was_active = ref false
Expand All @@ -22,29 +21,30 @@ let line_count state =
let navli () =
Ui_common.label_news tab_is_active (fun state -> line_count state)

let dont_gc_me = ref []

let content () =
let state_log, set_state_log = React.S.create ("" : string) in
let () =
dont_gc_me :=
[
Lwt_react.S.map_s
(fun _ ->
State_simulation.with_simulation_info ~label:__LOC__
~ready:(fun manager _ ->
manager#simulation_detail_log_message
>>= Api_common.result_bind_lwt
~ok:(fun (log_messages : Api_types_j.log_message) ->
let () = set_state_log log_messages in
Lwt.return (Result_util.ok ())))
~stopped:(fun _ ->
let () = set_state_log "" in
Lwt.return (Result_util.ok ()))
())
(React.S.on tab_is_active State_simulation.dummy_model
State_simulation.model);
]
let state_log =
React.S.bind
(React.S.on
tab_is_active State_simulation.dummy_model State_simulation.model)
(fun _ ->
React.S.hold
""
(Lwt_react.E.from (fun () ->
Lwt.map (fun x -> match x.Result_util.value with
| Ok x -> x
| Error list ->
String.concat "\n"
(List.map
(fun Result_util.{text; _ } -> text)
list))
(State_simulation.with_simulation_info ~label:__LOC__
~ready:(fun manager _ ->
manager#simulation_detail_log_message)
~stopped:(fun _ ->
Lwt.return (Result_util.ok ""))
~initializing:(fun _ ->
Lwt.return (Result_util.ok ""))
()))))
in
[
Html.div
Expand Down

0 comments on commit a9e7741

Please sign in to comment.