-
Notifications
You must be signed in to change notification settings - Fork 122
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
Showing
1 changed file
with
27 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,45 @@ | ||
module Page.Debug exposing (..) | ||
|
||
import Html exposing (..) | ||
import Api exposing (Stats, getStats) | ||
import Flags exposing (Flags) | ||
import Api exposing (getStats, Stats) | ||
import Html exposing (..) | ||
import Http | ||
|
||
type alias Model = { resVersion : String, repositoryAdapter : String, eventsInTotal : String } | ||
|
||
type alias Model = | ||
{ resVersion : String, repositoryAdapter : String, eventsInTotal : String } | ||
|
||
|
||
type Msg | ||
= GotStats (Result Http.Error Stats) | ||
= GotStats (Result Http.Error Stats) | ||
|
||
|
||
init : Flags -> Model | ||
init flags = | ||
init flags = | ||
{ resVersion = flags.resVersion, repositoryAdapter = flags.repositoryAdapter, eventsInTotal = "" } | ||
|
||
|
||
initCmd : Flags -> Cmd Msg | ||
initCmd flags = | ||
getStats GotStats flags | ||
|
||
view: Model -> Html a | ||
|
||
view : Model -> Html a | ||
view model = | ||
div [] [ | ||
p [] [text ("RubyEventStore version: " ++ model.resVersion)], | ||
p [] [text ("RubyEventStore adapter: " ++ model.repositoryAdapter)], | ||
p [] [text ("Events in total: " ++ model.eventsInTotal)] | ||
] | ||
div [] | ||
[ p [] [ text ("RubyEventStore version: " ++ model.resVersion) ] | ||
, p [] [ text ("RubyEventStore adapter: " ++ model.repositoryAdapter) ] | ||
, p [] [ text ("Events in total: " ++ model.eventsInTotal) ] | ||
] | ||
|
||
update : Msg -> Model -> (Model, Cmd Msg) | ||
|
||
update : Msg -> Model -> ( Model, Cmd Msg ) | ||
update msg model = | ||
case msg of | ||
GotStats result -> | ||
case result of | ||
Ok stats -> | ||
({ model | eventsInTotal = String.fromInt stats.eventsInTotal }, Cmd.none) | ||
Err _ -> | ||
(model, Cmd.none) | ||
case msg of | ||
GotStats result -> | ||
case result of | ||
Ok stats -> | ||
( { model | eventsInTotal = String.fromInt stats.eventsInTotal }, Cmd.none ) | ||
|
||
Err _ -> | ||
( model, Cmd.none ) |