Reverse dependencies page for tickets

This commit is contained in:
fr33domlover 2016-07-27 08:35:50 +00:00
parent 350f8a9521
commit d1e1f3c0f7
4 changed files with 22 additions and 4 deletions

View file

@ -110,5 +110,6 @@
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/!reply TicketTopReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/d/#Int/reply TicketReplyR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/deps TicketDepsR GET /s/#ShrIdent/p/#PrjIdent/t/#Int/deps TicketDepsR GET
/s/#ShrIdent/p/#PrjIdent/t/#Int/rdeps TicketReverseDepsR GET
/s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET /s/#ShrIdent/p/#PrjIdent/w/+Texts WikiPageR GET

View file

@ -495,5 +495,8 @@ instance YesodBreadcrumbs App where
TicketDepsR shr prj num -> ( "Dependencies" TicketDepsR shr prj num -> ( "Dependencies"
, Just $ TicketR shr prj num , Just $ TicketR shr prj num
) )
TicketReverseDepsR shr prj num -> ( "Dependants"
, Just $ TicketR shr prj num
)
WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj) WikiPageR shr prj _page -> ("Wiki", Just $ ProjectR shr prj)

View file

@ -41,6 +41,7 @@ module Vervis.Handler.Ticket
, getTicketTopReplyR , getTicketTopReplyR
, getTicketReplyR , getTicketReplyR
, getTicketDepsR , getTicketDepsR
, getTicketReverseDepsR
) )
where where
@ -543,8 +544,12 @@ getTicketReplyR shar proj tnum cnum =
(selectDiscussionId shar proj tnum) (selectDiscussionId shar proj tnum)
cnum cnum
getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html getTicketDeps :: Bool -> ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDepsR shr prj num = do getTicketDeps forward shr prj num = do
let from' =
if forward then TicketDependencyParent else TicketDependencyChild
to' =
if forward then TicketDependencyChild else TicketDependencyParent
rows <- runDB $ do rows <- runDB $ do
Entity sid _ <- getBy404 $ UniqueSharer shr Entity sid _ <- getBy404 $ UniqueSharer shr
Entity jid _ <- getBy404 $ UniqueProject prj sid Entity jid _ <- getBy404 $ UniqueProject prj sid
@ -557,8 +562,8 @@ getTicketDepsR shr prj num = do
) -> do ) -> do
on $ person ^. PersonIdent E.==. sharer ^. SharerId on $ person ^. PersonIdent E.==. sharer ^. SharerId
on $ ticket ^. TicketCreator E.==. person ^. PersonId on $ ticket ^. TicketCreator E.==. person ^. PersonId
on $ td ^. TicketDependencyChild E.==. ticket ^. TicketId on $ td ^. to' E.==. ticket ^. TicketId
where_ $ td ^. TicketDependencyParent E.==. val tid where_ $ td ^. from' E.==. val tid
orderBy [asc $ ticket ^. TicketNumber] orderBy [asc $ ticket ^. TicketNumber]
return return
( ticket ^. TicketNumber ( ticket ^. TicketNumber
@ -567,3 +572,9 @@ getTicketDepsR shr prj num = do
, ticket ^. TicketDone , ticket ^. TicketDone
) )
defaultLayout $(widgetFile "ticket/dep/list") defaultLayout $(widgetFile "ticket/dep/list")
getTicketDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketDepsR = getTicketDeps True
getTicketReverseDepsR :: ShrIdent -> PrjIdent -> Int -> Handler Html
getTicketReverseDepsR = getTicketDeps False

View file

@ -77,6 +77,9 @@ $if not $ ticketDone ticket
<p> <p>
<a href=@{TicketDepsR shar proj num}>Dependencies <a href=@{TicketDepsR shar proj num}>Dependencies
<p>
<a href=@{TicketReverseDepsR shar proj num}>Dependants
<p> <p>
Status: # Status: #
$if ticketDone ticket $if ticketDone ticket