UI: getClothR: If a Bundle exists in DB, display list of its patches

This commit is contained in:
fr33domlover 2022-09-19 12:02:48 +00:00
parent ffe68390e5
commit 0b10056cc3
3 changed files with 32 additions and 7 deletions

View file

@ -265,10 +265,10 @@ getClothR loomHash clothHash = do
where where
getClothHtml = do getClothHtml = do
mpid <- maybeAuthId mpid <- maybeAuthId
(ticket, targetRepo, author, tparams, eparams, cparams, moriginRepo) <- handlerToWidget $ runDB $ do (ticket, targetRepo, author, tparams, eparams, cparams, moriginRepo, mbundle) <- handlerToWidget $ runDB $ do
(Entity _ loom, Entity _ cloth, Entity ticketID ticket, author, _maybe_ResolveAndEitherTrlOrTrr, proposal) <- (Entity _ loom, Entity _ cloth, Entity ticketID ticket, author, _maybe_ResolveAndEitherTrlOrTrr, proposal) <-
getCloth404 loomHash clothHash getCloth404 loomHash clothHash
(ticket,,,,,,) (ticket,,,,,,,)
<$> getLocalRepo (loomRepo loom) (ticketLoomBranch cloth) <$> getLocalRepo (loomRepo loom) (ticketLoomBranch cloth)
<*> bitraverse <*> bitraverse
(\ (Entity _ (TicketAuthorLocal _ personID _)) -> do (\ (Entity _ (TicketAuthorLocal _ personID _)) -> do
@ -295,6 +295,14 @@ getClothR loomHash clothHash = do
) )
) )
(justThere proposal) (justThere proposal)
<*> traverse
(\ (bundleID :| _) -> do
ids <- selectKeysList [PatchBundle ==. bundleID] [Desc PatchId]
case nonEmpty ids of
Nothing -> error "Bundle without any Patches in DB"
Just ne -> return (bundleID, ne)
)
(justHere proposal)
hashMessageKey <- handlerToWidget getEncodeKeyHashid hashMessageKey <- handlerToWidget getEncodeKeyHashid
let desc :: Widget let desc :: Widget
desc = toWidget $ preEscapedToMarkup $ ticketDescription ticket desc = toWidget $ preEscapedToMarkup $ ticketDescription ticket
@ -316,6 +324,8 @@ getClothR loomHash clothHash = do
(ClothFollowR loomHash clothHash) (ClothFollowR loomHash clothHash)
(ClothUnfollowR loomHash clothHash) (ClothUnfollowR loomHash clothHash)
(ticketFollowers ticket) (ticketFollowers ticket)
hashBundle <- handlerToWidget getEncodeKeyHashid
hashPatch <- handlerToWidget getEncodeKeyHashid
$(widgetFile "cloth/one") $(widgetFile "cloth/one")
where where
getLocalRepo repoID mbranch = do getLocalRepo repoID mbranch = do

View file

@ -22,11 +22,14 @@ $nothing
Older versions, last to first: Older versions, last to first:
<ul> <ul>
$forall bundleID <- previousBundles $forall bundleID <- previousBundles
<li>
<a href=@{versionRoute bundleID}> <a href=@{versionRoute bundleID}>
#{keyHashidText $ hashBundle bundleID} #{keyHashidText $ hashBundle bundleID}
<div> <div>
Patches, last to first: Patches, last to first:
<ul>
$forall patchID <- patchIDs $forall patchID <- patchIDs
<li>
<a href=@{patchRoute patchID}> <a href=@{patchRoute patchID}>
#{keyHashidText $ hashPatch patchID} #{keyHashidText $ hashPatch patchID}

View file

@ -54,6 +54,18 @@ $with (repoHash, name, maybeBranch) <- targetRepo
<a href=@{RepoBranchSourceR repoHash branch []}> <a href=@{RepoBranchSourceR repoHash branch []}>
#{branch} #{branch}
$maybe (bundleID, patchIDs) <- mbundle
<div>
Bundle
<a href=@{BundleR loomHash clothHash (hashBundle bundleID)}>
#{keyHashidText $ hashBundle bundleID}
patches, last to first:
<ul>
$forall patchID <- patchIDs
<li>
<a href=@{PatchR loomHash clothHash (hashBundle bundleID) (hashPatch patchID)}>
#{keyHashidText $ hashPatch patchID}
<div> <div>
<span> <span>
<a href=@{ClothFollowersR loomHash clothHash}> <a href=@{ClothFollowersR loomHash clothHash}>