Display custom ticket field values in ticket page
This commit is contained in:
parent
ec7dd4ee7e
commit
35933061c9
3 changed files with 80 additions and 27 deletions
|
@ -189,6 +189,13 @@ WorkflowFieldEnumCtor
|
|||
|
||||
UniqueWorkflowFieldEnumCtor enum name
|
||||
|
||||
TicketParamText
|
||||
ticket TicketId
|
||||
field WorkflowFieldId
|
||||
value Text
|
||||
|
||||
UniqueTicketParamText ticket field
|
||||
|
||||
Ticket
|
||||
project ProjectId
|
||||
number Int
|
||||
|
|
|
@ -84,6 +84,7 @@ import Vervis.GraphProxy (ticketDepGraph)
|
|||
import Vervis.MediaType (MediaType (Markdown))
|
||||
import Vervis.Model
|
||||
import Vervis.Model.Ident
|
||||
import Vervis.Model.Workflow
|
||||
import Vervis.Render (renderSourceT)
|
||||
import Vervis.Settings (widgetFile)
|
||||
import Vervis.Ticket
|
||||
|
@ -175,11 +176,23 @@ getTicketNewR shar proj = do
|
|||
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
|
||||
getTicketR shar proj num = do
|
||||
mpid <- maybeAuthId
|
||||
(author, massignee, closer, ticket, deps, rdeps) <- runDB $ do
|
||||
Entity tid ticket <- do
|
||||
Entity s _ <- getBy404 $ UniqueSharer shar
|
||||
Entity p _ <- getBy404 $ UniqueProject proj s
|
||||
getBy404 $ UniqueTicket p num
|
||||
(wshr, wfl, author, massignee, closer, ticket, tparams, deps, rdeps) <-
|
||||
runDB $ do
|
||||
(jid, wshr, wid, wfl) <- do
|
||||
Entity s sharer <- getBy404 $ UniqueSharer shar
|
||||
Entity p project <- getBy404 $ UniqueProject proj s
|
||||
w <- get404 $ projectWorkflow project
|
||||
wsharer <-
|
||||
if workflowSharer w == s
|
||||
then return sharer
|
||||
else get404 $ workflowSharer w
|
||||
return
|
||||
( p
|
||||
, sharerIdent wsharer
|
||||
, projectWorkflow project
|
||||
, workflowIdent w
|
||||
)
|
||||
Entity tid ticket <- getBy404 $ UniqueTicket jid num
|
||||
author <- do
|
||||
person <- get404 $ ticketCreator ticket
|
||||
get404 $ personIdent person
|
||||
|
@ -193,6 +206,20 @@ getTicketR shar proj num = do
|
|||
person <- get404 $ ticketCloser ticket
|
||||
get404 $ personIdent person
|
||||
else return author
|
||||
tparams <- select $ from $ \ (f `LeftOuterJoin` p) -> do
|
||||
on $
|
||||
just (f ^. WorkflowFieldId) E.==. p ?. TicketParamTextField
|
||||
&&.
|
||||
p ?. TicketParamTextTicket E.==. just (val tid)
|
||||
where_ $
|
||||
f ^. WorkflowFieldWorkflow E.==. val wid &&.
|
||||
f ^. WorkflowFieldType E.==. val WFTText
|
||||
return
|
||||
( f ^. WorkflowFieldIdent
|
||||
, f ^. WorkflowFieldName
|
||||
, f ^. WorkflowFieldRequired
|
||||
, p ?. TicketParamTextValue
|
||||
)
|
||||
deps <- select $ from $ \ (dep `InnerJoin` t) -> do
|
||||
on $ dep ^. TicketDependencyChild E.==. t ^. TicketId
|
||||
where_ $ dep ^. TicketDependencyParent E.==. val tid
|
||||
|
@ -201,7 +228,10 @@ getTicketR shar proj num = do
|
|||
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
|
||||
where_ $ dep ^. TicketDependencyChild E.==. val tid
|
||||
return t
|
||||
return (author, massignee, closer, ticket, deps, rdeps)
|
||||
return
|
||||
( wshr, wfl
|
||||
, author, massignee, closer, ticket, tparams, deps, rdeps
|
||||
)
|
||||
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
|
||||
discuss =
|
||||
discussionW
|
||||
|
|
|
@ -100,6 +100,22 @@ $if not $ ticketDone ticket
|
|||
|
||||
^{desc}
|
||||
|
||||
<h3>Custom fields
|
||||
|
||||
<ul>
|
||||
$forall (Value fld, Value name, Value req, Value mvalue) <- tparams
|
||||
<li>
|
||||
<a href=@{WorkflowFieldR wshr wfl fld}>
|
||||
#{name}
|
||||
:
|
||||
$maybe value <- mvalue
|
||||
#{value}
|
||||
$nothing
|
||||
$if req
|
||||
NO VALUE FOR REQUIRED FIELD
|
||||
$else
|
||||
(none)
|
||||
|
||||
<h3>Discussion
|
||||
|
||||
^{discuss}
|
||||
|
|
Loading…
Reference in a new issue