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/html": "1.0.0",
|
||||
"elm/http": "2.0.0",
|
||||
"elm/json": "1.1.3"
|
||||
"elm/json": "1.1.3",
|
||||
"rtfeldman/elm-css": "18.0.0"
|
||||
},
|
||||
"indirect": {
|
||||
"elm/bytes": "1.0.8",
|
||||
"elm/file": "1.0.5",
|
||||
"elm/time": "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": {
|
||||
|
3308
pr-status.pl
3308
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 (..)
|
||||
|
||||
import Browser
|
||||
import Html exposing (..)
|
||||
import Html.Attributes exposing (href, placeholder, style)
|
||||
import Html.Events exposing (onClick, onInput)
|
||||
import Css exposing (alignItems, center, display, padding, pct, px, width)
|
||||
import Html.Styled exposing (..)
|
||||
import Html.Styled.Attributes exposing (css, disabled, href, placeholder, style)
|
||||
import Html.Styled.Events exposing (onClick, onInput)
|
||||
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
|
||||
@ -37,7 +38,7 @@ main : Program () Model Msg
|
||||
main =
|
||||
Browser.element
|
||||
{ init = init
|
||||
, view = view
|
||||
, view = view >> toUnstyled
|
||||
, update = update
|
||||
, subscriptions = \_ -> Sub.none
|
||||
}
|
||||
@ -87,14 +88,36 @@ init _ =
|
||||
|
||||
view : Model -> Html Msg
|
||||
view model =
|
||||
div []
|
||||
[ div []
|
||||
[ input [ placeholder "search...", onInput SetPR ] []
|
||||
, button [ onClick RunSearch ] [ text "Search" ]
|
||||
div
|
||||
[ css
|
||||
[ padding (px 30)
|
||||
, 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
|
||||
@ -108,7 +131,8 @@ viewResult data =
|
||||
prStr =
|
||||
String.fromInt data.pull_request
|
||||
in
|
||||
table []
|
||||
table
|
||||
[]
|
||||
[ tr []
|
||||
[ td [] [ b [] [ text "Title:" ] ]
|
||||
, td []
|
||||
|
Loading…
Reference in New Issue
Block a user