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,11 +176,23 @@ 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
|
||||||
|
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
|
author <- do
|
||||||
person <- get404 $ ticketCreator ticket
|
person <- get404 $ ticketCreator ticket
|
||||||
get404 $ personIdent person
|
get404 $ personIdent person
|
||||||
|
@ -193,6 +206,20 @@ getTicketR shar proj num = do
|
||||||
person <- get404 $ ticketCloser ticket
|
person <- get404 $ ticketCloser ticket
|
||||||
get404 $ personIdent person
|
get404 $ personIdent person
|
||||||
else return author
|
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
|
deps <- select $ from $ \ (dep `InnerJoin` t) -> do
|
||||||
on $ dep ^. TicketDependencyChild E.==. t ^. TicketId
|
on $ dep ^. TicketDependencyChild E.==. t ^. TicketId
|
||||||
where_ $ dep ^. TicketDependencyParent E.==. val tid
|
where_ $ dep ^. TicketDependencyParent E.==. val tid
|
||||||
|
@ -201,7 +228,10 @@ getTicketR shar proj num = do
|
||||||
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
|
on $ dep ^. TicketDependencyParent E.==. t ^. TicketId
|
||||||
where_ $ dep ^. TicketDependencyChild E.==. val tid
|
where_ $ dep ^. TicketDependencyChild E.==. val tid
|
||||||
return t
|
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
|
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