Only display certain views when they are useful.
This commit is contained in:
parent
23ff56ef82
commit
b96c16918b
|
@ -151,13 +151,10 @@ viewCache level (cm, cs) =
|
||||||
viewCacheHierarchy : CacheHierarchy -> Html Msg
|
viewCacheHierarchy : CacheHierarchy -> Html Msg
|
||||||
viewCacheHierarchy ch =
|
viewCacheHierarchy ch =
|
||||||
let
|
let
|
||||||
levels = div [ class "cache-levels" ]
|
levels = div []
|
||||||
<| List.indexedMap viewCache ch
|
<| List.indexedMap viewCache ch
|
||||||
in
|
in
|
||||||
div [] <|
|
levels
|
||||||
[ h2 [] [ text <| "Cache State" ]
|
|
||||||
, levels
|
|
||||||
]
|
|
||||||
|
|
||||||
viewAccessView : Model -> AccessView -> Html Msg
|
viewAccessView : Model -> AccessView -> Html Msg
|
||||||
viewAccessView m av =
|
viewAccessView m av =
|
||||||
|
@ -170,7 +167,9 @@ viewAccessView m av =
|
||||||
[ primaryButton "Back" AccessViewBack
|
[ primaryButton "Back" AccessViewBack
|
||||||
, primaryButton "Forward" AccessViewForward
|
, primaryButton "Forward" AccessViewForward
|
||||||
]
|
]
|
||||||
|
, h3 [] [ text "Access event log" ]
|
||||||
, viewAccessLog av
|
, viewAccessLog av
|
||||||
|
, h3 [] [ text "Current cache state" ]
|
||||||
, viewCacheHierarchy <| effectiveCacheHierarchy currentCache av
|
, viewCacheHierarchy <| effectiveCacheHierarchy currentCache av
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -194,23 +193,18 @@ viewAccessLog (aes, ap) =
|
||||||
Up n -> List.indexedMap downEvent aes ++
|
Up n -> List.indexedMap downEvent aes ++
|
||||||
(List.indexedMap upEvent <| List.drop n aes)
|
(List.indexedMap upEvent <| List.drop n aes)
|
||||||
in
|
in
|
||||||
div [ ]
|
div [] events
|
||||||
[ h3 [] [ text "Simulation events" ]
|
|
||||||
, div [] events
|
|
||||||
]
|
|
||||||
|
|
||||||
viewAccessInput : Model -> Html Msg
|
viewAccessInput : Model -> Html Msg
|
||||||
viewAccessInput m =
|
viewAccessInput m =
|
||||||
let
|
let
|
||||||
accessButton = maybeButton (String.toInt m.accessInput) "Access address" Access
|
accessButton = maybeButton (String.toInt m.accessInput) "Access address" Access
|
||||||
|
editHierarchyButton = button "Edit hierarchy" (UseHierarchy Nothing)
|
||||||
in
|
in
|
||||||
div []
|
div []
|
||||||
[ h2 [] [ text "Run access simulation" ]
|
[ h2 [] [ text "Run access simulation" ]
|
||||||
, div [ classList [("alert", True), ("alert-primary", True)] ]
|
|
||||||
[ text "Please make sure to click \"Use Hierarchy\" to load a hierarchy to simulate."
|
|
||||||
]
|
|
||||||
, labeledInput "Access address" m.accessInput ChangeAccessInput
|
, labeledInput "Access address" m.accessInput ChangeAccessInput
|
||||||
, accessButton
|
, buttonWrapper [ accessButton, editHierarchyButton ]
|
||||||
]
|
]
|
||||||
|
|
||||||
viewDescription : Html Msg
|
viewDescription : Html Msg
|
||||||
|
@ -234,9 +228,13 @@ viewBase : Model -> Html Msg
|
||||||
viewBase m =
|
viewBase m =
|
||||||
let
|
let
|
||||||
rawView =
|
rawView =
|
||||||
case m.accessView of
|
case m.hierarchy of
|
||||||
Nothing -> [ viewRawCacheModelHierarchy m.rawHierarchy ]
|
Nothing -> [ viewRawCacheModelHierarchy m.rawHierarchy ]
|
||||||
Just _ -> []
|
Just _ -> []
|
||||||
|
accessInputView =
|
||||||
|
case (m.hierarchy, m.accessView) of
|
||||||
|
(Just _, Nothing) -> [ viewAccessInput m ]
|
||||||
|
_ -> []
|
||||||
cacheView =
|
cacheView =
|
||||||
case m.accessView of
|
case m.accessView of
|
||||||
Nothing ->
|
Nothing ->
|
||||||
|
@ -244,7 +242,6 @@ viewBase m =
|
||||||
<| Maybe.map (List.singleton << viewCacheHierarchy) <| m.hierarchy
|
<| Maybe.map (List.singleton << viewCacheHierarchy) <| m.hierarchy
|
||||||
Just _ -> []
|
Just _ -> []
|
||||||
accessView = Maybe.withDefault [] <| Maybe.map (List.singleton << viewAccessView m) <| m.accessView
|
accessView = Maybe.withDefault [] <| Maybe.map (List.singleton << viewAccessView m) <| m.accessView
|
||||||
accessInputView = [ viewAccessInput m ]
|
|
||||||
in
|
in
|
||||||
div [ class "container" ]
|
div [ class "container" ]
|
||||||
<| [ viewDescription] ++ rawView ++ cacheView ++ accessView ++ accessInputView
|
<| [ viewDescription] ++ rawView ++ accessInputView ++ accessView ++ cacheView
|
||||||
|
|
Loading…
Reference in New Issue
Block a user