Add some style and validation.
while here add some automation
This commit is contained in:
parent
a24c411c9a
commit
beaf1ac0f3
17
Makefile
Normal file
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
build: elm append fix clean
|
||||||
|
|
||||||
|
elm: src/Main.elm
|
||||||
|
elm make --optimize src/Main.elm
|
||||||
|
|
||||||
|
|
||||||
|
append:
|
||||||
|
sed -i '/<!DOCTYPE HTML>/,$$d' pr-status.pl
|
||||||
|
cat index.html >> pr-status.pl
|
||||||
|
|
||||||
|
|
||||||
|
fix:
|
||||||
|
sed -i 's/<title>Main/<title>pr-status/' pr-status.pl
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f index.html
|
||||||
|
|
7
elm.json
7
elm.json
@ -10,14 +10,17 @@
|
|||||||
"elm/core": "1.0.5",
|
"elm/core": "1.0.5",
|
||||||
"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",
|
||||||
|
"rtfeldman/elm-css": "18.0.0"
|
||||||
},
|
},
|
||||||
"indirect": {
|
"indirect": {
|
||||||
"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/time": "1.0.0",
|
||||||
"elm/url": "1.0.0",
|
"elm/url": "1.0.0",
|
||||||
"elm/virtual-dom": "1.0.3"
|
"elm/virtual-dom": "1.0.3",
|
||||||
|
"robinheghan/murmur3": "1.0.0",
|
||||||
|
"rtfeldman/elm-hex": "1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"test-dependencies": {
|
"test-dependencies": {
|
||||||
|
3310
pr-status.pl
3310
pr-status.pl
File diff suppressed because it is too large
Load Diff
48
src/Main.elm
48
src/Main.elm
@ -1,11 +1,12 @@
|
|||||||
module Main exposing (..)
|
module Main exposing (..)
|
||||||
|
|
||||||
import Browser
|
import Browser
|
||||||
import Html exposing (..)
|
import Css exposing (alignItems, center, display, padding, pct, px, width)
|
||||||
import Html.Attributes exposing (href, placeholder, style)
|
import Html.Styled exposing (..)
|
||||||
import Html.Events exposing (onClick, onInput)
|
import Html.Styled.Attributes exposing (css, disabled, href, placeholder, style)
|
||||||
|
import Html.Styled.Events exposing (onClick, onInput)
|
||||||
import Http
|
import Http
|
||||||
import Json.Decode as Decode exposing (Decoder, field, int, list, map5, map6, string)
|
import Json.Decode as Decode exposing (Decoder, field, int, list, map5, string)
|
||||||
|
|
||||||
|
|
||||||
type Status
|
type Status
|
||||||
@ -37,7 +38,7 @@ main : Program () Model Msg
|
|||||||
main =
|
main =
|
||||||
Browser.element
|
Browser.element
|
||||||
{ init = init
|
{ init = init
|
||||||
, view = view
|
, view = view >> toUnstyled
|
||||||
, update = update
|
, update = update
|
||||||
, subscriptions = \_ -> Sub.none
|
, subscriptions = \_ -> Sub.none
|
||||||
}
|
}
|
||||||
@ -87,14 +88,36 @@ init _ =
|
|||||||
|
|
||||||
view : Model -> Html Msg
|
view : Model -> Html Msg
|
||||||
view model =
|
view model =
|
||||||
div []
|
div
|
||||||
[ div []
|
[ css
|
||||||
[ input [ placeholder "search...", onInput SetPR ] []
|
[ padding (px 30)
|
||||||
, button [ onClick RunSearch ] [ text "Search" ]
|
, width (pct 100)
|
||||||
]
|
]
|
||||||
, div []
|
|
||||||
[ viewResult model ]
|
|
||||||
]
|
]
|
||||||
|
[ div []
|
||||||
|
[ div []
|
||||||
|
[ input [ placeholder "search...", onInput SetPR ] []
|
||||||
|
, button
|
||||||
|
[ onClick RunSearch
|
||||||
|
, disabled (viewValidation model)
|
||||||
|
]
|
||||||
|
[ text "Search" ]
|
||||||
|
]
|
||||||
|
, div []
|
||||||
|
[ viewResult model
|
||||||
|
]
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
viewValidation : Model -> Bool
|
||||||
|
viewValidation model =
|
||||||
|
case model.pull_request of
|
||||||
|
0 ->
|
||||||
|
True
|
||||||
|
|
||||||
|
_ ->
|
||||||
|
False
|
||||||
|
|
||||||
|
|
||||||
viewResult : Model -> Html Msg
|
viewResult : Model -> Html Msg
|
||||||
@ -108,7 +131,8 @@ viewResult data =
|
|||||||
prStr =
|
prStr =
|
||||||
String.fromInt data.pull_request
|
String.fromInt data.pull_request
|
||||||
in
|
in
|
||||||
table []
|
table
|
||||||
|
[]
|
||||||
[ tr []
|
[ tr []
|
||||||
[ td [] [ b [] [ text "Title:" ] ]
|
[ td [] [ b [] [ text "Title:" ] ]
|
||||||
, td []
|
, td []
|
||||||
|
Loading…
Reference in New Issue
Block a user