Skip to content

Commit dd1b826

Browse files
committed
Render queue
1 parent 2883966 commit dd1b826

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

src/Client/Index.fs

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@ open Thoth.Fetch
66
open Shared
77

88
type Model =
9-
{ Hello: string }
9+
{ Hello: string
10+
Status: BuildStatus }
1011

1112
type Msg =
1213
| GotHello of string
1314

1415
let init() =
1516
let model : Model =
16-
{ Hello = "" }
17+
{ Hello = ""
18+
Status = Requests [ BuildRequest.create() ] }
1719
let getHello() = Fetch.get<unit, string> Route.hello
1820
let cmd = Cmd.OfPromise.perform getHello () GotHello
1921
model, cmd
@@ -25,6 +27,48 @@ let update msg model =
2527

2628
open Feliz
2729

30+
let renderRequest request =
31+
Html.tr [
32+
prop.style [
33+
style.border (1, borderStyle.solid, "lightgray")
34+
]
35+
prop.children [
36+
Html.td request.User
37+
Html.td [
38+
Html.a [
39+
prop.style [ style.fontFamily "monospace" ]
40+
prop.href (sprintf "http://github/owner/repo/commit/%A" request.Sha1)
41+
prop.text (request.Sha1.ToString().Substring(0, 7))
42+
]
43+
]
44+
Html.td [
45+
prop.style [ style.fontFamily "monospace" ]
46+
prop.text (request.Platform.ToString())
47+
]
48+
Html.td [
49+
prop.style [ style.fontFamily "monospace" ]
50+
prop.text (request.Configuration.ToString())
51+
]
52+
]
53+
]
54+
55+
let renderQueue model =
56+
Html.table [
57+
prop.style [
58+
style.marginLeft length.auto
59+
style.marginRight length.auto
60+
style.borderCollapse.collapse
61+
]
62+
prop.children [
63+
Html.tbody [
64+
match model.Status with
65+
| Requests requests ->
66+
for r in requests do
67+
yield renderRequest r
68+
]
69+
]
70+
]
71+
2872
let view model dispatch =
2973
Html.div [
3074
prop.style [
@@ -37,6 +81,7 @@ let view model dispatch =
3781
Html.img [ prop.src "favicon.png" ]
3882
Html.h1 "safe_minimal"
3983
Html.h2 model.Hello
84+
renderQueue model
4085
]
4186
]
4287
]

0 commit comments

Comments
 (0)