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
|
UniqueWorkflowFieldEnumCtor enum name
|
||||||
|
|
||||||
|
TicketParamText
|
||||||
|
ticket TicketId
|
||||||
|
field WorkflowFieldId
|
||||||
|
value Text
|
||||||
|
|
||||||
|
UniqueTicketParamText ticket field
|
||||||
|
|
||||||
Ticket
|
Ticket
|
||||||
project ProjectId
|
project ProjectId
|
||||||
number Int
|
number Int
|
||||||
|
|
|
@ -84,6 +84,7 @@ import Vervis.GraphProxy (ticketDepGraph)
|
||||||
import Vervis.MediaType (MediaType (Markdown))
|
import Vervis.MediaType (MediaType (Markdown))
|
||||||
import Vervis.Model
|
import Vervis.Model
|
||||||
import Vervis.Model.Ident
|
import Vervis.Model.Ident
|
||||||
|
import Vervis.Model.Workflow
|
||||||
import Vervis.Render (renderSourceT)
|
import Vervis.Render (renderSourceT)
|
||||||
import Vervis.Settings (widgetFile)
|
import Vervis.Settings (widgetFile)
|
||||||
import Vervis.Ticket
|
import Vervis.Ticket
|
||||||
|
@ -175,33 +176,62 @@ getTicketNewR shar proj = do
|
||||||
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
|
getTicketR :: ShrIdent -> PrjIdent -> Int -> Handler Html
|
||||||
getTicketR shar proj num = do
|
getTicketR shar proj num = do
|
||||||
mpid <- maybeAuthId
|
mpid <- maybeAuthId
|
||||||
(author, massignee, closer, ticket, deps, rdeps) <- runDB $ do
|
(wshr, wfl, author, massignee, closer, ticket, tparams, deps, rdeps) <-
|
||||||
Entity tid ticket <- do
|
runDB $ do
|
||||||
Entity s _ <- getBy404 $ UniqueSharer shar
|
(jid, wshr, wid, wfl) <- do
|
||||||
Entity p _ <- getBy404 $ UniqueProject proj s
|
Entity s sharer <- getBy404 $ UniqueSharer shar
|
||||||
getBy404 $ UniqueTicket p num
|
Entity p project <- getBy404 $ UniqueProject proj s
|
||||||
author <- do
|
w <- get404 $ projectWorkflow project
|
||||||
person <- get404 $ ticketCreator ticket
|
wsharer <-
|
||||||
get404 $ personIdent person
|
if workflowSharer w == s
|
||||||
massignee <- for (ticketAssignee ticket) $ \ apid -> do
|
then return sharer
|
||||||
person <- get404 apid
|
else get404 $ workflowSharer w
|
||||||
sharer <- get404 $ personIdent person
|
return
|
||||||
return (sharer, fromMaybe False $ (== apid) <$> mpid)
|
( p
|
||||||
closer <-
|
, sharerIdent wsharer
|
||||||
if ticketDone ticket
|
, projectWorkflow project
|
||||||
then do
|
, workflowIdent w
|
||||||
person <- get404 $ ticketCloser ticket
|
)
|
||||||
get404 $ personIdent person
|
Entity tid ticket <- getBy404 $ UniqueTicket jid num
|
||||||
else return author
|
author <- do
|
||||||
deps <- select $ from $ \ (dep `InnerJoin` t) -> do
|
person <- get404 $ ticketCreator ticket
|
||||||
on $ dep ^. TicketDependencyChild E.==. t ^. TicketId
|
get404 $ personIdent person
|
||||||
where_ $ dep ^. TicketDependencyParent E.==. val tid
|
massignee <- for (ticketAssignee ticket) $ \ apid -> do
|
||||||
return t
|
person <- get404 apid
|
||||||
rdeps <- select $ from $ \ (dep `InnerJoin` t) -> do
|
sharer <- get404 $ personIdent person
|
||||||
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
|
return (sharer, fromMaybe False $ (== apid) <$> mpid)
|
||||||
where_ $ dep ^. TicketDependencyChild E.==. val tid
|
closer <-
|
||||||
return t
|
if ticketDone ticket
|
||||||
return (author, massignee, closer, ticket, deps, rdeps)
|
then 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
|
||||||
|
return t
|
||||||
|
rdeps <- select $ from $ \ (dep `InnerJoin` t) -> do
|
||||||
|
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
|
||||||
|
where_ $ dep ^. TicketDependencyChild E.==. val tid
|
||||||
|
return t
|
||||||
|
return
|
||||||
|
( wshr, wfl
|
||||||
|
, author, massignee, closer, ticket, tparams, deps, rdeps
|
||||||
|
)
|
||||||
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
|
let desc = renderSourceT Markdown $ T.filter (/= '\r') $ ticketDesc ticket
|
||||||
discuss =
|
discuss =
|
||||||
discussionW
|
discussionW
|
||||||
|
|
|
@ -100,6 +100,22 @@ $if not $ ticketDone ticket
|
||||||
|
|
||||||
^{desc}
|
^{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
|
<h3>Discussion
|
||||||
|
|
||||||
^{discuss}
|
^{discuss}
|
||||||
|
|
Loading…
Reference in a new issue