view-progress-log end-point returns a self-contained HTML

This commit is contained in:
Filip Gralinski 2021-08-09 22:19:40 +02:00
parent b432fdd0e5
commit 6d7587aeac
2 changed files with 30 additions and 0 deletions

View File

@ -1688,3 +1688,31 @@ viewProgressWithWebSockets :: Swagger
viewProgressWithWebSockets = spec & definitions .~ defs viewProgressWithWebSockets = spec & definitions .~ defs
where where
(defs, spec) = runDeclare declareViewProgressWithWebSocketsSwagger mempty (defs, spec) = runDeclare declareViewProgressWithWebSocketsSwagger mempty
declareViewProgressLogSwagger :: Declare (Definitions Schema) Swagger
declareViewProgressLogSwagger = do
let numberSchema = toParamSchema (Proxy :: Proxy Int)
numberResponse <- declareResponse (Proxy :: Proxy Int)
return $ mempty
& paths .~
fromList [ ("/api/view-progress-log/{jobId}",
mempty & DS.get ?~ (mempty
& parameters .~ [ Inline $ mempty
& name .~ "jobId"
& description ?~ "The ID for the job to be shown"
& required ?~ True
& schema .~ ParamOther (mempty
& in_ .~ ParamPath
& paramSchema .~ numberSchema)]
& produces ?~ MimeList ["text/html"]
& description ?~ "Returns HTML code with embedded JS script for showing logs via web sockets"
& at 200 ?~ Inline numberResponse))
]
viewProgressLog :: Swagger
viewProgressLog = spec & definitions .~ defs
where
(defs, spec) = runDeclare declareViewProgressLogSwagger mempty

View File

@ -33,6 +33,8 @@ apiDescription = generalApi
<> challengeRepoApi <> challengeRepoApi
<> testProgressApi <> testProgressApi
<> viewProgressWithWebSockets <> viewProgressWithWebSockets
<> viewProgressLog
generalApi :: Swagger generalApi :: Swagger
generalApi = (mempty :: Swagger) generalApi = (mempty :: Swagger)