summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2021-08-29 10:54:13 -0400
committerBen Sima <ben@bsima.me>2021-11-26 13:47:38 -0500
commit1a5ea40711e35f8b108d10a0667423926d63fd34 (patch)
tree1e7d999680b4fa8f271c8e526f7b8a449296fdc5
parent75097ce64d7547b1ec4b084e41c5889071ff0bec (diff)
Add Post Analysis form hints to admin page
-rw-r--r--Biz/Dragons.hs30
1 files changed, 22 insertions, 8 deletions
diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs
index d370693..4294172 100644
--- a/Biz/Dragons.hs
+++ b/Biz/Dragons.hs
@@ -1154,14 +1154,7 @@ instance Lucid.ToHtml AdminDashboard where
Lucid.h2_ <| Lucid.toHtml <| "Total Analyses: " <> tshow totalAnalyses
Lucid.section_ <| do
Lucid.h2_ "Post analysis"
- let action = linkAction_ "/" <| fieldLink postAnalysis
- Lucid.form_ [action, Lucid.method_ "post"] <| do
- Lucid.input_ [Lucid.type_ "text", Lucid.name_ "owner"]
- Lucid.input_ [Lucid.type_ "text", Lucid.name_ "repo"]
- Lucid.input_
- [ Lucid.type_ "submit"
- ]
-
+ Lucid.toHtml <| SubmitAnalysis "github" "training-kit"
Lucid.section_ <| do
Lucid.h2_ "All Users"
Lucid.ul_
@@ -1484,6 +1477,27 @@ data SubmitAnalysis = SubmitAnalysis
instance Web.FromForm SubmitAnalysis
+instance Lucid.ToHtml SubmitAnalysis where
+ toHtmlRaw = Lucid.toHtml
+ toHtml SubmitAnalysis {..} = do
+ let action = linkAction_ "/" <| fieldLink postAnalysis
+ Lucid.form_ [action, Lucid.method_ "post"] <| do
+ Lucid.input_
+ [ Lucid.type_ "text",
+ Lucid.name_ "owner",
+ Lucid.placeholder_ "owner",
+ Lucid.value_ owner
+ ]
+ Lucid.input_
+ [ Lucid.type_ "text",
+ Lucid.name_ "repo",
+ Lucid.placeholder_ "repo",
+ Lucid.value_ repo
+ ]
+ Lucid.input_
+ [ Lucid.type_ "submit"
+ ]
+
-- | I need more information than just 'Analysis' has to render a full, useful
-- web page, hence this type.
data AnalysisDisplay = AnalysisDisplay User AnalysisAction