Add more stuff

This commit is contained in:
Cadey Ratio 2020-01-18 13:25:48 -05:00
parent 68ed7658f1
commit dba02e8f4c
5 changed files with 72 additions and 14877 deletions

View File

@ -11,15 +11,17 @@
"elm/html": "1.0.0", "elm/html": "1.0.0",
"elm/http": "2.0.0", "elm/http": "2.0.0",
"elm/json": "1.1.3", "elm/json": "1.1.3",
"elm/time": "1.0.0",
"elm/url": "1.0.0", "elm/url": "1.0.0",
"mdgriffith/elm-ui": "1.1.5", "mdgriffith/elm-ui": "1.1.5",
"rtfeldman/elm-iso8601-date-strings": "1.1.3",
"ryannhg/elm-spa": "3.0.0" "ryannhg/elm-spa": "3.0.0"
}, },
"indirect": { "indirect": {
"elm/browser": "1.0.2", "elm/browser": "1.0.2",
"elm/bytes": "1.0.8", "elm/bytes": "1.0.8",
"elm/file": "1.0.5", "elm/file": "1.0.5",
"elm/time": "1.0.0", "elm/parser": "1.1.0",
"elm/virtual-dom": "1.0.2" "elm/virtual-dom": "1.0.2"
} }
}, },

1
frontend/public/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
dist

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,64 @@
module Mi.SwitchData exposing
( Switch
, decoder
, frontURL
, idURL
, listURL
, switchURL
)
import Html exposing (..)
import Html.Attributes exposing (..)
import Iso8601
import Json.Decode exposing (Decoder, field, int, map5, nullable, string)
import Time exposing (Posix)
import Url.Builder as UB
type alias Switch =
{ id : String
, who : String
, started_at : Posix
, ended_at : Maybe Posix
, duration : Int
}
decoder : Decoder Switch
decoder =
map5 Switch
(field "id" string)
(field "who" string)
(field "started_at" Iso8601.decoder)
(field "ended_at" (nullable Iso8601.decoder))
(field "duration" int)
switchURL : String
switchURL =
UB.absolute
[ "switches", "switch" ]
[]
idURL : String -> String
idURL id =
UB.absolute
[ "switches", "id", id ]
[]
frontURL : String
frontURL =
UB.absolute
[ "switches", "current" ]
[]
listURL : Int -> Int -> String
listURL limit page =
UB.absolute
[ "switches", "" ]
[ UB.int "limit" limit
, UB.int "page" page
]

View File

@ -1,9 +1,11 @@
module Pages.Switches exposing (Model, Msg, page) module Pages.Switches exposing (Model, Msg, page)
import Spa.Page
import Element exposing (..) import Element exposing (..)
import Generated.Params as Params import Generated.Params as Params
import Global import Global
import Mi
import Mi.SwitchData
import Spa.Page
import Utils.Spa exposing (Page) import Utils.Spa exposing (Page)
@ -65,4 +67,4 @@ subscriptions model =
view : Model -> Element Msg view : Model -> Element Msg
view model = view model =
text "Switches" text "Switches"