mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-02-21 07:07:52 +01:00
Provide JSON representation of the diff
This commit is contained in:
parent
62434f29c5
commit
b4f2c27017
@ -27,17 +27,19 @@ getStackageHomeR name = do
|
|||||||
$(widgetFile "stackage-home")
|
$(widgetFile "stackage-home")
|
||||||
where strip x = fromMaybe x (stripSuffix "." x)
|
where strip x = fromMaybe x (stripSuffix "." x)
|
||||||
|
|
||||||
getStackageDiffR :: SnapName -> SnapName -> Handler Html
|
getStackageDiffR :: SnapName -> SnapName -> Handler TypedContent
|
||||||
getStackageDiffR name1 name2 = do
|
getStackageDiffR name1 name2 = do
|
||||||
Entity sid1 _ <- lookupSnapshot name1 >>= maybe notFound return
|
Entity sid1 _ <- lookupSnapshot name1 >>= maybe notFound return
|
||||||
Entity sid2 _ <- lookupSnapshot name2 >>= maybe notFound return
|
Entity sid2 _ <- lookupSnapshot name2 >>= maybe notFound return
|
||||||
(map (snapshotName . entityVal) -> snapNames) <- getSnapshots Nothing 0 0
|
(map (snapshotName . entityVal) -> snapNames) <- getSnapshots Nothing 0 0
|
||||||
let (ltsSnaps, nightlySnaps) = partition isLts $ reverse $ sort snapNames
|
let (ltsSnaps, nightlySnaps) = partition isLts $ reverse $ sort snapNames
|
||||||
snapDiff <- getSnapshotDiff sid1 sid2
|
snapDiff <- getSnapshotDiff sid1 sid2
|
||||||
defaultLayout $ do
|
selectRep $ do
|
||||||
setTitle $ "Compare " ++ toHtml (toPathPiece name1) ++ " with "
|
provideRep $ defaultLayout $ do
|
||||||
++ toHtml (toPathPiece name2)
|
setTitle $ "Compare " ++ toHtml (toPathPiece name1) ++ " with "
|
||||||
$(widgetFile "stackage-diff")
|
++ toHtml (toPathPiece name2)
|
||||||
|
$(widgetFile "stackage-diff")
|
||||||
|
provideRep $ pure $ toJSON $ WithSnapshotNames name1 name2 snapDiff
|
||||||
|
|
||||||
getStackageCabalConfigR :: SnapName -> Handler TypedContent
|
getStackageCabalConfigR :: SnapName -> Handler TypedContent
|
||||||
getStackageCabalConfigR name = do
|
getStackageCabalConfigR name = do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user