1
0
Fork 0
mirror of https://code.sup39.dev/repos/Wqawg synced 2024-12-27 17:14:52 +09:00

Display ticket class params AKA labels in ticket list view

This commit is contained in:
fr33domlover 2020-01-11 17:28:53 +00:00
parent 90e3b677c5
commit 031a4c0930
3 changed files with 13 additions and 4 deletions

View file

@ -34,6 +34,7 @@ import Control.Arrow ((***))
import Data.Foldable (for_) import Data.Foldable (for_)
import Data.Text (Text) import Data.Text (Text)
import Database.Esqueleto import Database.Esqueleto
import Database.Esqueleto.PostgreSQL
import Vervis.Foundation (AppDB) import Vervis.Foundation (AppDB)
import Vervis.Model import Vervis.Model
@ -53,7 +54,10 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $
`LeftOuterJoin` (tar `InnerJoin` ra `InnerJoin` ro `InnerJoin` i) `LeftOuterJoin` (tar `InnerJoin` ra `InnerJoin` ro `InnerJoin` i)
`InnerJoin` d `InnerJoin` d
`LeftOuterJoin` m `LeftOuterJoin` m
`LeftOuterJoin` (tpc `InnerJoin` wf)
) -> do ) -> do
on $ tpc ?. TicketParamClassField ==. wf ?. WorkflowFieldId
on $ just (t ^. TicketId) ==. tpc ?. TicketParamClassTicket
on $ just (d ^. DiscussionId) ==. m ?. MessageRoot on $ just (d ^. DiscussionId) ==. m ?. MessageRoot
on $ t ^. TicketDiscuss ==. d ^. DiscussionId on $ t ^. TicketDiscuss ==. d ^. DiscussionId
on $ ro ?. RemoteObjectInstance ==. i ?. InstanceId on $ ro ?. RemoteObjectInstance ==. i ?. InstanceId
@ -63,7 +67,7 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $
on $ p ?. PersonIdent ==. s ?. SharerId on $ p ?. PersonIdent ==. s ?. SharerId
on $ tal ?. TicketAuthorLocalAuthor ==. p ?. PersonId on $ tal ?. TicketAuthorLocalAuthor ==. p ?. PersonId
on $ just (t ^. TicketId) ==. tal ?. TicketAuthorLocalTicket on $ just (t ^. TicketId) ==. tal ?. TicketAuthorLocalTicket
where_ $ t ^. TicketProject ==. val jid where_ $ t ^. TicketProject ==. val jid
groupBy groupBy
( t ^. TicketId, s ?. SharerId ( t ^. TicketId, s ?. SharerId
, ra ?. RemoteActorId, ro ?. RemoteObjectId, i ?. InstanceId , ra ?. RemoteActorId, ro ?. RemoteObjectId, i ?. InstanceId
@ -80,9 +84,10 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $
, t ^. TicketTitle , t ^. TicketTitle
, t ^. TicketStatus , t ^. TicketStatus
, count $ m ?. MessageId , count $ m ?. MessageId
, arrayRemoveNull $ maybeArray $ arrayAgg $ wf ?. WorkflowFieldName
) )
where where
toSummary (Value n, ms, mi, mro, mra, Value c, Value t, Value d, Value r) = toSummary (Value n, ms, mi, mro, mra, Value c, Value t, Value d, Value r, Value wfs) =
TicketSummary TicketSummary
{ tsNumber = n { tsNumber = n
, tsCreatedBy = , tsCreatedBy =
@ -94,6 +99,7 @@ getTicketSummaries mfilt morder jid = fmap (map toSummary) $ select $ from $
_ -> error "Ticket author DB invalid state" _ -> error "Ticket author DB invalid state"
, tsCreatedAt = c , tsCreatedAt = c
, tsTitle = t , tsTitle = t
, tsLabels = wfs
, tsStatus = d , tsStatus = d
, tsComments = r , tsComments = r
} }

View file

@ -1,6 +1,6 @@
{- This file is part of Vervis. {- This file is part of Vervis.
- -
- Written in 2016, 2019 by fr33domlover <fr33domlover@riseup.net>. - Written in 2016, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
- -
- Copying is an act of love. Please copy, reuse and share. - Copying is an act of love. Please copy, reuse and share.
- -
@ -50,6 +50,7 @@ data TicketSummary = TicketSummary
, tsCreatedBy :: Either Sharer (Instance, RemoteObject, RemoteActor) , tsCreatedBy :: Either Sharer (Instance, RemoteObject, RemoteActor)
, tsCreatedAt :: UTCTime , tsCreatedAt :: UTCTime
, tsTitle :: Text , tsTitle :: Text
, tsLabels :: [Text]
, tsStatus :: TicketStatus , tsStatus :: TicketStatus
, tsComments :: Int , tsComments :: Int
} }

View file

@ -1,6 +1,6 @@
$# This file is part of Vervis. $# This file is part of Vervis.
$# $#
$# Written in 2016, 2019 by fr33domlover <fr33domlover@riseup.net>. $# Written in 2016, 2019, 2020 by fr33domlover <fr33domlover@riseup.net>.
$# $#
$# ♡ Copying is an act of love. Please copy, reuse and share. $# ♡ Copying is an act of love. Please copy, reuse and share.
$# $#
@ -37,6 +37,8 @@ $# <http://creativecommons.org/publicdomain/zero/1.0/>.
<span .ticket-title-column> <span .ticket-title-column>
<a href=@{TicketR shr prj $ tsNumber ts}> <a href=@{TicketR shr prj $ tsNumber ts}>
#{tsTitle ts} #{tsTitle ts}
$forall wfname <- tsLabels ts
\ [#{wfname}]
<span .ticket-tree-column> <span .ticket-tree-column>
$if tsComments ts > 0 $if tsComments ts > 0