add status to all Reply messages

This commit is contained in:
MMesch 2018-07-14 10:55:02 +02:00
parent d5b56fbb51
commit c10f3e085b
4 changed files with 13 additions and 3 deletions

View File

@ -177,6 +177,7 @@ replyTo config _ interface KernelInfoRequest{} replyHeader = do
, implementationVersion = kernelImplVersion config
, banner = kernelBanner config
, protocolVersion = kernelProtocolVersion config
, status = Ok
}
replyTo config _ _ CommInfoRequest{} replyHeader =

View File

@ -31,6 +31,7 @@ instance ToJSON Message where
, "implementation" .= implementation rep
, "implementation_version" .= implementationVersion rep
, "language_info" .= languageInfo rep
, "status" .= show (status rep)
]
toJSON CommInfoReply
@ -38,7 +39,9 @@ instance ToJSON Message where
, commInfo = commInfo
} =
object
[ "comms" .= Map.map (\comm -> object ["target_name" .= comm]) commInfo ]
[ "comms" .= Map.map (\comm -> object ["target_name" .= comm]) commInfo
, "status" .= string "ok"
]
toJSON ExecuteRequest
{ getCode = code
@ -109,7 +112,9 @@ instance ToJSON Message where
]
toJSON ShutdownReply { restartPending = restart } =
object ["restart" .= restart]
object ["restart" .= restart
, "status" .= string "ok"
]
toJSON ClearOutput { wait = wait } =
object ["wait" .= wait]
@ -132,7 +137,9 @@ instance ToJSON Message where
object ["comm_id" .= commUuid req, "data" .= commData req]
toJSON req@HistoryReply{} =
object ["history" .= map tuplify (historyReply req)]
object ["history" .= map tuplify (historyReply req)
, "status" .= string "ok"
]
where
tuplify (HistoryReplyElement sess linum res) = (sess, linum, case res of
Left inp -> toJSON inp

View File

@ -299,6 +299,7 @@ data Message =
, implementation :: String -- ^ e.g. IHaskell
, implementationVersion :: String -- ^ The version of the implementation
, languageInfo :: LanguageInfo
, status :: ExecuteReplyStatus
}
|
-- | A request from a frontend for information about the comms.

View File

@ -275,6 +275,7 @@ replyTo interface KernelInfoRequest{} replyHeader state = do
, languageFileExtension = ".hs"
, languageCodeMirrorMode = "ihaskell"
}
, status = Ok
})
replyTo _ CommInfoRequest{} replyHeader state =