Use elm-spa #1

Manually merged
cadey merged 3 commits from spa into master 2020-01-18 18:26:57 +00:00
5 changed files with 72 additions and 14877 deletions
Showing only changes of commit dba02e8f4c - Show all commits

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)