feat(workflows): show info and warnings about scheduled/performed archivation

This commit is contained in:
Sarah Vaupel 2022-05-19 00:22:10 +02:00 committed by Sarah Vaupel
parent 23b1065545
commit 424692d611
6 changed files with 28 additions and 0 deletions

View File

@ -106,6 +106,8 @@ WorkflowWorkflowWorkflowStateHeading: Zustand/Daten
WorkflowWorkflowWorkflowPayloadHeading: Aktueller Datensatz
WorkflowWorkflowWorkflowStateStateLabel: Aktueller Zustand
WorkflowWorkflowWorkflowStateStateHidden: Versteckter Zustand
WorkflowWorkflowWorkflowStateArchivedLabel: Archiviert seit
WorkflowWorkflowWorkflowArchivationInfo: Workflows, welche seit 61 Tagen abgeschlossen sind, werden automatisch archiviert. Archivierte Workflows werden nicht als laufende Workflows gelistet. Das Auslösen einer Aktion setzt den Archivierungszeitpunkt eines Workflows zurück.
WorkflowWorkflowWorkflowHistoryLabelOthers: Aktionen Anderer
WorkflowWorkflowWorkflowHistoryLabelOwn: Eigene Aktionen

View File

@ -65,6 +65,8 @@ WorkflowWorkflowWorkflowStateHeading: State/Data
WorkflowWorkflowWorkflowPayloadHeading: Current data
WorkflowWorkflowWorkflowStateStateLabel: Current state
WorkflowWorkflowWorkflowStateStateHidden: Hidden state
WorkflowWorkflowWorkflowStateArchivedLabel: Archived since
WorkflowWorkflowWorkflowArchivationInfo: Workflows that are finalized since 61 days will be automatically moved to the archive. Archived workflows are not listed as running. Actions reset the archivation date of a workflow.
WorkflowWorkflowWorkflowHistoryLabelOthers: Other users' actions
WorkflowWorkflowWorkflowHistoryLabelOwn: Your actions

View File

@ -52,6 +52,7 @@ data WorkflowHistoryItem = WorkflowHistoryItem
data WorkflowCurrentState = WorkflowCurrentState
{ wcsState :: Maybe (Text, Maybe Icon)
, wcsArchived :: Maybe UTCTime
, wcsMessages :: Set Message
, wcsPayload :: [(Text, ([WorkflowFieldPayloadW Void (Maybe (Entity User))], Maybe Text))]
}
@ -76,6 +77,7 @@ getSWWFilesR ssh = getWorkflowFilesR $ WSSchool ssh
workflowR :: RouteWorkflowScope -> CryptoFileNameWorkflowWorkflow -> Handler Html
workflowR rScope cID = workflowsDisabledWarning title heading $ do
now <- liftIO getCurrentTime
(mEdge, (workflowState, workflowHistory)) <- runDB $ do
wwId <- decrypt cID
WorkflowWorkflow{..} <- get404 wwId
@ -212,6 +214,8 @@ workflowR rScope cID = workflowsDisabledWarning title heading $ do
messageContent <- selectLanguageI18n wnmContent
return Message{..}
let wcsArchived = workflowWorkflowArchived
tell ( Just $ Last WorkflowCurrentState{..}
, pure WorkflowHistoryItem{..}
)
@ -255,6 +259,7 @@ workflowR rScope cID = workflowsDisabledWarning title heading $ do
Nothing -> i18n MsgWorkflowPayloadUserGone
Just (Entity _ User{..}) -> nameWidget userDisplayName userSurname
WorkflowFieldPayloadW (WFPFile v ) -> absurd v
archivationScheduled archived = $(i18nWidgetFile "workflow-archivation-scheduled")
$(widgetFile "workflows/workflow")
where
(heading, title) = case rScope of

View File

@ -0,0 +1,4 @@
$newline never
<p>
Dieser Workflow wird am ^{formatTimeW SelFormatDateTime archived} archiviert.

View File

@ -0,0 +1,4 @@
$newline never
<p>
This workflow will be archived on ^{formatTimeW SelFormatDateTime archived}.

View File

@ -1,6 +1,10 @@
$newline never
$maybe WorkflowCurrentState{..} <- workflowState
<section>
$maybe archived <- wcsArchived
$if now < archived
^{notification NotificationBroad =<< messageWidget Warning (archivationScheduled archived)}
<h2>
_{MsgWorkflowWorkflowWorkflowStateHeading}
@ -16,6 +20,13 @@ $maybe WorkflowCurrentState{..} <- workflowState
$nothing
<span .workflow-state--state-special>
_{MsgWorkflowWorkflowWorkflowStateStateHidden}
$maybe archived <- wcsArchived
$if now >= archived
<dt .deflist__dt>
_{MsgWorkflowWorkflowWorkflowStateArchivedLabel} #
^{messageTooltip =<< messageI Info MsgWorkflowWorkflowWorkflowArchivationInfo}
<dd .deflist__dd>
^{formatTimeW SelFormatDateTime archived}
$forall msg <- wcsMessages
^{notification NotificationBroad msg}