@@ -16,28 +16,15 @@ using GraphMakie.NetworkLayout
16
16
export ContinuousSlider, RoundedLabel
17
17
include (" widgets.jl" )
18
18
19
+ export wrap_assets
20
+ include (" utils.jl" )
21
+
19
22
function apptheme ()
20
23
Theme (
21
24
fontsize= 10 ,
22
25
)
23
26
end
24
27
25
- export wrap_assets
26
- function wrap_assets (appdom)
27
- jquery
= Asset (
" https://cdn.jsdelivr.net/npm/[email protected] /dist/jquery.min.js" )
28
- select2_css
= Asset (
" https://cdn.jsdelivr.net/npm/[email protected] /dist/css/select2.min.css" )
29
- select2_js
= Asset (
" https://cdn.jsdelivr.net/npm/[email protected] /dist/js/select2.min.js" )
30
- css = Asset (joinpath (pkgdir (NetworkDynamicsInspector), " assets" , " app.css" ))
31
-
32
- DOM. body (
33
- jquery,
34
- select2_css,
35
- select2_js,
36
- css,
37
- appdom;
38
- )
39
- end
40
-
41
28
function graphplot_card (app; kwargs... )
42
29
nw = map! (extract_nw, Observable {Network} (), app. sol)
43
30
NV = nv (nw[])
@@ -334,35 +321,6 @@ function _maxrange(sol, idxs, rel)
334
321
extrema (Iterators. flatten (u_for_t))
335
322
end
336
323
337
- function gen_state_options (nw:: Network , sidxs)
338
- options = OptionGroup{Symbol}[]
339
- isempty (sidxs) && return options
340
- groups = [
341
- (" Outputs & States" , cf -> unique! (vcat (NetworkDynamics. outsym_flat (cf), sym (cf)))),
342
- (" Inputs" , cf -> collect (NetworkDynamics. insym_all (cf))),
343
- (" Observables" , obssym),
344
- (" Parameters" , psym),
345
- ]
346
- exclusive_syms = Symbol[]
347
- for (label, getter) in groups
348
- common_syms = mapreduce (∩ , sidxs) do sidx
349
- cf = nw[sidx]
350
- getter (cf)
351
- end
352
- push! (options, OptionGroup {Symbol} (label, common_syms))
353
-
354
- all_syms = mapreduce (∪ , sidxs) do sidx
355
- cf = nw[sidx]
356
- getter (cf)
357
- end
358
- append! (exclusive_syms, setdiff (all_syms, common_syms))
359
- end
360
- if ! isempty (exclusive_syms)
361
- push! (options, OptionGroup {Symbol} (" Partially available syms" , exclusive_syms))
362
- end
363
- options
364
- end
365
-
366
324
function timeseries_card (app, session)
367
325
comp_options = Observable {Vector{OptionGroup{SymbolicIndex}}} ()
368
326
on (app. sol; update= true ) do _sol
@@ -560,52 +518,4 @@ function _smallest_free(d::Dict)
560
518
return i
561
519
end
562
520
563
-
564
- function clear_obs! (nt:: NamedTuple )
565
- for v in values (nt)
566
- clear_obs! (v)
567
- end
568
- end
569
- clear_obs! (obs:: Observable ) = empty! (obs. listeners)
570
- clear_obs! (x) = x
571
-
572
- # TODO : move to grpahmakie
573
- GraphMakie. _dimensionality (obs:: Observable , g) = GraphMakie. _dimensionality (obs[], g)
574
-
575
-
576
- SERVER = Ref {Any} (nothing )
577
-
578
- export serve_app
579
- function serve_app (newapp)
580
- if ! isnothing (SERVER[]) && Bonito. HTTPServer. isrunning (SERVER[])
581
- @info " Stop running server..."
582
- close (SERVER[])
583
- end
584
- SERVER[] = Bonito. Server (newapp, " 0.0.0.0" , 8080 )
585
- end
586
-
587
- # APP = Ref{Any}(nothing)
588
- # function serve_app(newapp)
589
- # if isnothing(SERVER[]) || !Bonito.HTTPServer.isrunning(SERVER[])
590
- # @info "Start new SErver"
591
- # SERVER[] = Bonito.Server(newapp, "0.0.0.0", 8080)
592
- # APP[] = newapp
593
- # else
594
- # oldapp = APP[]
595
- # APP[] = newapp
596
- # @info "Update App"
597
- # Bonito.update_app!(oldapp, newapp)
598
- # end
599
- # nothing
600
- # end
601
-
602
- NetworkDynamics. extract_nw (o:: Observable ) = extract_nw (o. val)
603
- function NetworkDynamics. extract_nw (o:: NamedTuple )
604
- if haskey (o, :sol )
605
- return extract_nw (o. sol)
606
- else
607
- error (" No sol in NamedTuple" )
608
- end
609
- end
610
-
611
521
end # module NetworkDynamicsInspector
0 commit comments