diff options
author | stuebinm | 2022-02-10 00:14:43 +0100 |
---|---|---|
committer | stuebinm | 2022-02-10 00:14:43 +0100 |
commit | 485af1d460be0979b7093da307f379ef088a98db (patch) | |
tree | 8d0358713b5915f73bb2a72b42b0ead1472ad0bd /server/Server.hs | |
parent | 3a109e79363b52e22da35aaecf666014a75fcb63 (diff) |
server: simple servant-lucid stuff
Diffstat (limited to 'server/Server.hs')
-rw-r--r-- | server/Server.hs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/server/Server.hs b/server/Server.hs index a5a820a..536350f 100644 --- a/server/Server.hs +++ b/server/Server.hs @@ -27,12 +27,14 @@ import GHC.Generics (Generic) import Lens.Micro (over) import Lens.Micro.TH import LintConfig (LintConfig') +import Lucid (ToHtml (..)) +import Lucid.Html5 +import Orphans () import System.Exit.Compat (exitFailure) import Toml (TomlCodec) import qualified Toml import Toml.Codec ((.=)) - -- | a reference in a remote git repository data RemoteRef = RemoteRef { repourl :: Text @@ -69,6 +71,23 @@ data State = State , _registry :: Map UUID RemoteRef } +instance ToHtml JobStatus where + toHtml status = html_ $ do + head_ $ do + title_ "Job Status" + link_ [rel_ "stylesheet", type_ "text/css", href_ "/styles.css"] + body_ $ div_ [class_ "main-content"] $ case status of + Pending -> do + h2_ "Pending …" + p_ "(please note that this site won't auto-reload, you'll have to refresh it yourself)" + Linted res -> do + p_ "Linted" + toHtml res + Failed err -> do + h2_ "System Error" + p_ $ "error: " <> toHtml err + p_ "you should probably ping an admin about this or sth" + makeLenses ''State defaultState :: State |