mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
acb05e09b9
* Started converting URL bar to Elm * Working dropdown * Fix * Some fixes
84 lines
1.3 KiB
Elm
84 lines
1.3 KiB
Elm
port module ResponsePaneHeader exposing (..)
|
|
|
|
import Html exposing (..)
|
|
import Html.Attributes exposing (..)
|
|
import Html.App as App
|
|
import TimeTag exposing (..)
|
|
import SizeTag exposing (..)
|
|
import StatusTag exposing (..)
|
|
|
|
|
|
-- APP
|
|
|
|
|
|
main : Program Model
|
|
main =
|
|
App.programWithFlags
|
|
{ init = init
|
|
, view = view
|
|
, update = update
|
|
, subscriptions = subscriptions
|
|
}
|
|
|
|
|
|
|
|
-- MODEL
|
|
|
|
|
|
type alias Model =
|
|
{ statusCode : Int
|
|
, statusMessage : String
|
|
, statusDescription : String
|
|
, elapsedTime : Int
|
|
, bytesRead : Int
|
|
}
|
|
|
|
|
|
init : Model -> ( Model, Cmd Msg )
|
|
init flags =
|
|
flags ! []
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
type Msg
|
|
= NewModel Model
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Cmd Msg )
|
|
update msg model =
|
|
case msg of
|
|
NewModel newModel ->
|
|
newModel ! []
|
|
|
|
|
|
|
|
-- SUBSCRIPTIONS
|
|
|
|
|
|
port replaceModel : (Model -> msg) -> Sub msg
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
subscriptions model =
|
|
replaceModel NewModel
|
|
|
|
|
|
|
|
-- VIEW
|
|
|
|
|
|
view : Model -> Html Msg
|
|
view model =
|
|
div []
|
|
[ StatusTag.view
|
|
{ code = model.statusCode
|
|
, message = model.statusMessage
|
|
, description = model.statusDescription
|
|
}
|
|
, TimeTag.view model.elapsedTime
|
|
, SizeTag.view model.bytesRead
|
|
]
|