Commit b8b732f8 authored by Haye Böhm's avatar Haye Böhm

Some steps towards fixing InciDone

parent 6f4f6f10
Pipeline #13777 failed with stage
in 1 minute and 31 seconds
......@@ -15,10 +15,10 @@ import Incidone.OP.Concepts
// are limited by what can be constructed with the user catalog editor.
//Wrapped action for usage in action plans
:: ActionDefinition c
:: ActionDefinition c sds
= { identity :: String
, meta :: ItemMeta
, task :: c (Shared ActionStatus) -> Task ()
, task :: c (sds () ActionStatus ActionStatus) -> Task ()
}
//Wrapped action for storage in the action catalog
:: CatalogAction =
......@@ -33,9 +33,9 @@ import Incidone.OP.Concepts
}
:: ActionTasks
= E.c: ActionTasks
= E.c sds: ActionTasks
([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) //Configuration task
(c (Shared ActionStatus) -> Task ()) & iTask c //An action item that needs to be configured before it can be deployed
(c (sds () ActionStatus ActionStatus) -> Task ()) & iTask c & RWShared sds //An action item that needs to be configured before it can be deployed
:: ActionProgress
= ActionPlanned
......@@ -144,45 +144,45 @@ derive gDefault CatalogAction
derive gText CatalogAction
derive gEditor CatalogAction
toInstantAction :: c ActionProgress [ContactNo] [IncidentNo] (ActionDefinition c) -> CatalogAction | iTask c
toConfigurableAction :: ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (ActionDefinition c) -> CatalogAction | iTask c
toContactAction :: (Maybe String) (ActionDefinition ContactNo) -> CatalogAction
toIncidentAction :: (ActionDefinition IncidentNo) -> CatalogAction
toContactForIncidentAction :: (Maybe String) (ActionDefinition (ContactNo,IncidentNo)) -> CatalogAction
toInstantAction :: c ActionProgress [ContactNo] [IncidentNo] (ActionDefinition c sds) -> CatalogAction | iTask c & RWShared sds
toConfigurableAction :: ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (ActionDefinition c sds) -> CatalogAction | iTask c & RWShared sds
toContactAction :: (Maybe String) (ActionDefinition ContactNo sds) -> CatalogAction | RWShared sds
toIncidentAction :: (ActionDefinition IncidentNo sds) -> CatalogAction | RWShared sds
toContactForIncidentAction :: (Maybe String) (ActionDefinition (ContactNo,IncidentNo) sds) -> CatalogAction | RWShared sds
forIncident :: IncidentNo (ActionDefinition (ContactNo,IncidentNo)) -> ActionDefinition ContactNo
forIncident :: IncidentNo (ActionDefinition (ContactNo,IncidentNo) sds) -> ActionDefinition ContactNo sds | RWShared sds
addDefaultStatus :: (Task c) -> ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) | iTask c
//Shared catalog of predefined action items
actionCatalog :: ReadOnlyShared [CatalogAction]
builtinActionCatalog :: ReadOnlyShared [CatalogAction]
userActionCatalog :: Shared [UserCatalogAction]
actionCatalog :: SDSLens () [CatalogAction] ()
builtinActionCatalog :: SDSLens () [CatalogAction] ()
userActionCatalog :: SDSLens () [UserCatalogAction] [UserCatalogAction]
//Shares providing filtered views on iTasks task instances.
//They select only those detached tasks that are tagged to be action items
actionStatuses :: ROShared () [(InstanceNo,InstanceNo,ActionStatus)] //(Instance no, parent instance no, status)
actionStatusesByIncident :: ROShared IncidentNo [(InstanceNo,InstanceNo,ActionStatus)]
actionStatusesByContact :: ROShared ContactNo [(InstanceNo,InstanceNo,ActionStatus)]
actionStatusesOfCurrentContact :: ROShared () [(InstanceNo,InstanceNo,ActionStatus)]
actionStatuses :: SDSLens () [(InstanceNo,InstanceNo,ActionStatus)] () //(Instance no, parent instance no, status)
actionStatusesByIncident :: SDSLens IncidentNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesByContact :: SDSLens ContactNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesOfCurrentContact :: SDSSequence () [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusByNo :: RWShared InstanceNo ActionStatus ActionStatus
actionStatusByNo :: SDSLens InstanceNo ActionStatus ActionStatus
numActionsByContact :: ROShared ContactNo Int
numActionsByContact :: SDSLens ContactNo Int ()
//Todo items
todoItemTask :: () (Shared ActionStatus) -> Task ()
todoItemTask :: () (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
blankTodoItem :: CatalogAction
predefinedTodoItem :: String ItemMeta -> CatalogAction
predefinedInstantItem :: String ItemMeta ActionProgress ((Shared ActionStatus) -> Task a) -> CatalogAction| iTask a
predefinedConfigurableItem :: String ItemMeta ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (c (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c
predefinedInstantItem :: String ItemMeta ActionProgress ((sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
predefinedConfigurableItem :: String ItemMeta ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (c (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c & RWShared sds
//Contact or incident
predefinedIncidentItem :: String ItemMeta (IncidentNo (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedContactItem :: String ItemMeta (Maybe String) (ContactNo (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedIncidentItem :: String ItemMeta (IncidentNo (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
predefinedContactItem :: String ItemMeta (Maybe String) (ContactNo (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
//Action lists items
listItemTask :: (String,ActionPlan) (Shared ActionStatus) -> Task ()
listItemTask :: (String,ActionPlan) (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
blankListItem :: CatalogAction
predefinedListItem :: String ItemMeta ActionPlan -> CatalogAction
configurableListItem :: String ItemMeta (Task c) (c -> ActionPlan) -> CatalogAction | iTask c
......@@ -192,7 +192,7 @@ configurableListItem :: String ItemMeta (Task c) (c -> ActionPlan)
* @param Group by incidents
* @param Use 'my actions' group for current user
*/
chooseActionItem :: d Bool Bool (ROShared () [(InstanceNo,InstanceNo,ActionStatus)]) -> Task InstanceNo | toPrompt d
chooseActionItem :: d Bool Bool (sds () [(InstanceNo,InstanceNo,ActionStatus)] ()) -> Task InstanceNo | toPrompt d & RWShared sds
workOnActionItem :: InstanceNo -> Task ()
editActionItem :: InstanceNo -> Task (Maybe ActionStatus)
deleteActionItem :: InstanceNo -> Task (Maybe ActionStatus)
......
......@@ -25,36 +25,36 @@ import Incidone.Extensions.CrewLists
derive class iTask CommunicationAttempt
derive class iTask ActionPlan
actionStatuses :: ROShared () [(InstanceNo,InstanceNo,ActionStatus)]
actionStatuses :: SDSLens () [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatuses = mapRead (map toActionStatus) detachedTaskInstances
actionStatusesByIncident :: ROShared IncidentNo [(InstanceNo,InstanceNo,ActionStatus)]
actionStatusesByIncident :: SDSLens IncidentNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesByIncident = sdsSplit "actionStatusesByIncident" (\p -> ((),p)) read write actionStatuses
where
read instanceNo is = filter (filterFun instanceNo) is
write _ _ _ = ((),const (const False))
filterFun instanceNo (_,_,{ActionStatus|incidents}) = isMember instanceNo incidents
actionStatusesByContact :: ROShared ContactNo [(InstanceNo,InstanceNo,ActionStatus)]
actionStatusesByContact :: SDSLens ContactNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesByContact = sdsSplit "actionStatusesByContact" (\p -> ((),p)) read write actionStatuses
where
read contactNo is = filter (filterFun contactNo) is
write _ _ _ = ((),const (const False))
filterFun contactNo (_,_,{ActionStatus|contacts}) = isMember contactNo contacts
actionStatusesOfCurrentContact :: ROShared () [(InstanceNo,InstanceNo,ActionStatus)]
actionStatusesOfCurrentContact :: SDSSequence () [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesOfCurrentContact = sdsSequence "actionStatusesOfCurrentContact" id (\_ r -> r) (\_ _ -> Right snd) writel writer currentUserContactNo actionStatusesByContact
where
writel = SDSWriteConst (\_ _ -> Ok Nothing)
writer = SDSWriteConst (\_ _ -> Ok Nothing)
actionStatusByNo :: RWShared InstanceNo ActionStatus ActionStatus
actionStatusByNo :: SDSLens InstanceNo ActionStatus ActionStatus
actionStatusByNo = sdsProject (SDSLensRead read) (SDSLensWrite write) taskInstanceByNo
where
read item = Ok (thd3 (toActionStatus item))
write {TaskInstance|attributes} status = Ok (Just (fromActionStatus status attributes))
numActionsByContact :: ROShared ContactNo Int
numActionsByContact :: SDSLens ContactNo Int ()
numActionsByContact = mapRead length actionStatusesByContact
toActionStatuses :: [TaskInstance] -> [(InstanceNo,InstanceNo,ActionStatus)]
......@@ -100,7 +100,7 @@ fromSelfActionStatus status (_,items) = case [i \\ i=:{TaskListItem|taskId,self}
[{TaskListItem|taskId,attributes}:_] = Ok (Just [(taskId,fromActionStatus status attributes)])
_ = Error (exception "Task id not found in self management share")
selfActionStatus :: (SharedTaskList a) -> Shared ActionStatus | iTask a
selfActionStatus :: (SharedTaskList a) -> SDSLens () ActionStatus ActionStatus | iTask a
selfActionStatus list = sdsFocus taskListFilter (mapReadWriteError (toSelfActionStatus,fromSelfActionStatus) list)
where
taskListFilter = {TaskListFilter|onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False
......@@ -118,18 +118,18 @@ where
ActionCanceled = {numPlanned=pl,numActive=ac,numCompleted=co,numFailed=fa,numCanceled=ca+1}
_ = {numPlanned=pl,numActive=ac,numCompleted=co,numFailed=fa,numCanceled=ca}
toInstantAction :: c ActionProgress [ContactNo] [IncidentNo] (ActionDefinition c) -> CatalogAction | iTask c
toInstantAction :: c ActionProgress [ContactNo] [IncidentNo] (ActionDefinition c sds) -> CatalogAction | iTask c & RWShared sds
toInstantAction config progress contacts incidents {ActionDefinition|identity,meta=meta=:{ItemMeta|title,description},task}
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks configer task}
where
configer initContacts initIncidents
= return (config,{ActionStatus|title=title,description=description,progress=progress,contacts=contacts++initContacts,incidents=incidents++initIncidents})
toConfigurableAction :: ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (ActionDefinition c) -> CatalogAction | iTask c
toConfigurableAction :: ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (ActionDefinition c sds) -> CatalogAction | iTask c & RWShared sds
toConfigurableAction configer {ActionDefinition|identity,meta,task}
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks configer task}
toContactAction :: (Maybe String) (ActionDefinition ContactNo) -> CatalogAction
toContactAction :: (Maybe String) (ActionDefinition ContactNo sds) -> CatalogAction | RWShared sds
toContactAction mbGroup item=:{ActionDefinition|meta={ItemMeta|title,description}} = toConfigurableAction configer item
where
configer initContacts initIncidents
......@@ -138,7 +138,7 @@ where
@ \contactNo ->
(contactNo,{ActionStatus|title=title,description=description,progress=ActionActive,contacts=[contactNo:initContacts],incidents=initIncidents})
toIncidentAction :: (ActionDefinition IncidentNo) -> CatalogAction
toIncidentAction :: (ActionDefinition IncidentNo sds) -> CatalogAction | RWShared sds
toIncidentAction item=:{ActionDefinition|meta={ItemMeta|title,description}}
= toConfigurableAction configer item
where
......@@ -148,7 +148,7 @@ where
@ \incidentNo ->
(incidentNo,{ActionStatus|title=title,description=description,progress=ActionActive,contacts=initContacts,incidents=[incidentNo:initIncidents]})
toContactForIncidentAction :: (Maybe String) (ActionDefinition (ContactNo,IncidentNo)) -> CatalogAction
toContactForIncidentAction :: (Maybe String) (ActionDefinition (ContactNo,IncidentNo) sds) -> CatalogAction | RWShared sds
toContactForIncidentAction mbGroup item=:{ActionDefinition|meta={ItemMeta|title,description}}
= toConfigurableAction configer item
where
......@@ -163,7 +163,7 @@ where
contactOptions Nothing = allContactsShort
contactOptions (Just group) = sdsFocus group contactsWithGroupShort
forIncident :: IncidentNo (ActionDefinition (ContactNo,IncidentNo)) -> ActionDefinition ContactNo
forIncident :: IncidentNo (ActionDefinition (ContactNo,IncidentNo) sds) -> ActionDefinition ContactNo sds | RWShared sds
forIncident incidentNo item=:{ActionDefinition|task} = {ActionDefinition|item & task = task`}
where
task` contactNo status = task (contactNo,incidentNo) status
......@@ -171,30 +171,30 @@ where
addDefaultStatus :: (Task c) -> ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) | iTask c
addDefaultStatus task = \initContacts initIncidents -> task @ \c -> (c,{ActionStatus|defaultValue & contacts = initContacts, incidents = initIncidents})
predefinedInstantItem :: String ItemMeta ActionProgress ((Shared ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedInstantItem :: String ItemMeta ActionProgress ((sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
predefinedInstantItem identity meta=:{ItemMeta|title,description} progress task
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks configer itemtask}
where
configer initContacts initIncidents = return ((),{ActionStatus|title=title,description=description,progress=progress,contacts=initContacts,incidents=initIncidents})
itemtask _ status = task status @? const NoValue
predefinedConfigurableItem :: String ItemMeta ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (c (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c
predefinedConfigurableItem :: String ItemMeta ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (c (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c & RWShared sds
predefinedConfigurableItem identity meta configer task
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks configer (\c s -> task c s @? const NoValue)}
predefinedIncidentItem :: String ItemMeta (IncidentNo (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedIncidentItem :: String ItemMeta (IncidentNo (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
predefinedIncidentItem identity meta incidentTask
= toIncidentAction {ActionDefinition|identity=identity,meta=meta,task=task}
where
task status incidentNo = incidentTask status incidentNo @? const NoValue
predefinedContactItem :: String ItemMeta (Maybe String) (ContactNo (Shared ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedContactItem :: String ItemMeta (Maybe String) (ContactNo (sds () ActionStatus ActionStatus) -> Task a) -> CatalogAction | iTask a & RWShared sds
predefinedContactItem identity meta mbGroup contactTask
= toContactAction mbGroup {ActionDefinition|identity=identity,meta=meta,task=task}
where
task status contactNo = contactTask status contactNo @? const NoValue
updateSharedActionStatus :: (Shared ActionStatus) -> Task ActionStatus
updateSharedActionStatus :: (sds () ActionStatus ActionStatus) -> Task ActionStatus | RWShared sds
updateSharedActionStatus status
= watch status
>^* [OnAction (Action "Mark active") (ifValue (ifProgress ActionActive) (\_ -> setProgress ActionActive status))
......@@ -248,10 +248,10 @@ where
UAInformAction def = userInformItem identity meta def
UAActionList def = userListItem identity meta def
actionCatalog :: ReadOnlyShared [CatalogAction]
actionCatalog = mapRead (\(b,u) -> b ++ map toCatalogAction u) (builtinActionCatalog |+| userActionCatalog)
actionCatalog :: SDSLens () [CatalogAction] ()
actionCatalog = mapRead (\(b,u) -> b ++ map toCatalogAction u) (builtinActionCatalog |*| userActionCatalog)
builtinActionCatalog :: ReadOnlyShared [CatalogAction]
builtinActionCatalog :: SDSLens () [CatalogAction] ()
builtinActionCatalog = constShare
[blankTodoItem
,blankAlertItem
......@@ -261,11 +261,11 @@ builtinActionCatalog = constShare
:crewListActions
]
userActionCatalog :: Shared [UserCatalogAction]
userActionCatalog :: SDSLens () [UserCatalogAction] [UserCatalogAction]
userActionCatalog = sharedStore "UserActionCatalog" []
//Todo items
todoItemTask :: () (Shared ActionStatus) -> Task ()
todoItemTask :: () (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
todoItemTask _ status
= viewSharedInformation () [ViewAs (\{ActionStatus|description} -> description)] status @! ()
......@@ -287,7 +287,7 @@ userTodoItem :: String ItemMeta -> CatalogAction
userTodoItem identity meta = predefinedTodoItem identity meta
//Alert item
alertItemTask :: (ContactNo,Maybe P2000Message) (Shared ActionStatus) -> Task ()
alertItemTask :: (ContactNo,Maybe P2000Message) (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
alertItemTask contactNo status = communicationItemTask contactNo status
configureAlertItemTask :: [ContactNo] [IncidentNo] -> Task ((ContactNo, Maybe P2000Message),ActionStatus)
......@@ -311,7 +311,7 @@ userAlertItem identity meta def
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks (configureUserAlertItemTask meta def) alertItemTask}
//Inform items
informItemTask :: (ContactNo,Maybe P2000Message) (Shared ActionStatus) -> Task ()
informItemTask :: (ContactNo,Maybe P2000Message) (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
informItemTask contactNo status = communicationItemTask contactNo status
configureInformItemTask :: [ContactNo] [IncidentNo] -> Task ((ContactNo,Maybe P2000Message),ActionStatus)
......@@ -336,7 +336,7 @@ userInformItem identity meta def
= {CatalogAction|identity=identity,meta=meta,tasks=ActionTasks (configureUserInformItemTask meta def) informItemTask}
//List items
listItemTask :: (String,ActionPlan) (Shared ActionStatus) -> Task ()
listItemTask :: (String,ActionPlan) (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
listItemTask (title,plan) status
= upd (\s -> {ActionStatus|s & title = title}) status
>>- \{ActionStatus|contacts,incidents} ->
......@@ -427,7 +427,7 @@ configureUserCommunicationItemTask type meta {CommunicationActionDefinition|cont
configureUserCommunicationItemTask type _ _ initContacts initIncidents
= configureCommunicationItemTask type initContacts initIncidents
communicationItemTask :: (ContactNo,Maybe P2000Message) (Shared ActionStatus) -> Task ()
communicationItemTask :: (ContactNo,Maybe P2000Message) (sds () ActionStatus ActionStatus) -> Task () | RWShared sds
communicationItemTask (contactNo,mbP2000Template) status
//View action description
= viewSharedInformation () [ViewAs (\{ActionStatus|description} -> description)] status
......@@ -459,7 +459,7 @@ where
Nothing
= return ()
Just communicationNo
= upd (updateState (Just communicationNo)) (attempts >+< status) @! ()
= upd (updateState (Just communicationNo)) (attempts >*< status) @! ()
addP2000Message status attempts
= createCommunication P2000Message Out (Just contactNo)
......@@ -470,7 +470,7 @@ where
Nothing
= return ()
Just communicationNo
= upd (updateState (Just communicationNo)) (attempts >+< status) @! ()
= upd (updateState (Just communicationNo)) (attempts >*< status) @! ()
viewAttempt communicationNo
= {CommunicationAttempt|method="Phone",details= "-",success = isJust communicationNo}
......@@ -491,9 +491,9 @@ findReferencedContacts :: ContactReference -> Task [ContactShort]
findReferencedContacts (ContactByName ref) = get (sdsFocus {ContactFilter|filterByName=Just ref} filteredContactsShort)
findReferencedContacts (ContactInGroup ref) = get (sdsFocus ref contactsWithGroupShort)
chooseActionItem :: d Bool Bool (ROShared () [(InstanceNo,InstanceNo,ActionStatus)]) -> Task InstanceNo | toPrompt d
chooseActionItem :: d Bool Bool (sds () [(InstanceNo,InstanceNo,ActionStatus)] ()) -> Task InstanceNo | toPrompt d & RWShared sds
chooseActionItem d groupByIncident useMyActionsFolder list
= whileUnchanged (currentUserContactNo |+| openIncidentsShort)//Done this way, because I don't know how to combine the shares in a tree
= whileUnchanged (currentUserContactNo |*| openIncidentsShort)//Done this way, because I don't know how to combine the shares in a tree
\(me,incidents) ->
enterInformation "FIXME" []
//editChoiceWithSharedAs d
......@@ -588,7 +588,7 @@ where
//Look in action the catalog for an entry that has the identity
findReplacement taskId
= get (sdsFocus taskId (taskListEntryMeta topLevelTasks) |+| actionCatalog)
= get (sdsFocus taskId (taskListEntryMeta topLevelTasks) |*| actionCatalog)
@ \(taskListEntry,catalog) -> maybe Nothing (lookup catalog) ('DM'.get "actionitem-identity" taskListEntry.TaskListItem.attributes)
where
lookup [] match = Nothing
......@@ -631,7 +631,7 @@ where
>>- \updated ->
logActionUpdated updated @! (Just updated)
edit :: (a -> Task a) (Shared a) -> Task (Maybe a) | iTask a //TODO: Move to util
edit :: (a -> Task a) (sds () a a) -> Task (Maybe a) | iTask a & RWShared sds //TODO: Move to util
edit task sds
= get sds
>>- \current ->
......@@ -677,12 +677,12 @@ where
incidents status
= mapReadWrite (\{ActionStatus|incidents}-> incidents, \incidents status -> Just {ActionStatus|status & incidents=incidents}) status
manageSubActions :: ActionPlan (Shared ActionStatus) (SharedTaskList ()) -> Task ()
manageSubActions :: ActionPlan (sds () ActionStatus ActionStatus) (SharedTaskList ()) -> Task () | RWShared sds
manageSubActions plan status list
= (manageCurrentSubActionItems status list) -||- (addSuggestedSubActionItems plan status list) <<@ ArrangeHorizontal
@? const NoValue
manageCurrentSubActionItems :: (Shared ActionStatus) (SharedTaskList ()) -> Task ()
manageCurrentSubActionItems :: (sds () ActionStatus ActionStatus) (SharedTaskList ()) -> Task () | RWShared sds
manageCurrentSubActionItems status list
= enterChoiceWithShared (Title "Current Actions") [ChooseFromGrid (format o thd3)] (subTaskItems list)
>^* [OnAction (Action "Add action") (always (get status >>- \{ActionStatus|contacts,incidents} -> addSubAction contacts incidents list))]
......@@ -696,7 +696,7 @@ where
formatProgress p
= "<div style=\"display:inline-block; width:16px; height:16px; margin-right:10px;\" class=\"icon-action-" +++ toString p +++ "\"></div>"
addSuggestedSubActionItems :: ActionPlan (Shared ActionStatus) (SharedTaskList ()) -> Task ()
addSuggestedSubActionItems :: ActionPlan (sds () ActionStatus ActionStatus) (SharedTaskList ()) -> Task () | RWShared sds
addSuggestedSubActionItems plan status list
= plan.suggestedActions
>&> \suggestions ->
......@@ -740,7 +740,7 @@ where
= configer initContacts initIncidents <<@ Title "Configure" /* <<@ AfterLayout (uiDefSetHeight FlexSize) */
>>? \(config,initStatus) -> addAction identity initStatus list (\l -> task config l)
addAction :: String ActionStatus (SharedTaskList a) ((Shared ActionStatus) -> Task ()) -> Task TaskId | iTask a
addAction :: String ActionStatus (SharedTaskList a) ((sds () ActionStatus ActionStatus) -> Task ()) -> Task TaskId | iTask a & RWShared sds
addAction identity initStatus list task
= logActionAdded initStatus
>>| appendTask (Detached attributes True) (\l -> (task (selfActionStatus l) @? const NoValue)) list
......
......@@ -34,15 +34,15 @@ from iTasks.Extensions.Web import :: URL
derive class iTask DBConfig, AISConfig, AsteriskConfig, SMTPConfig, WebLinksConfig, WebLink
//Master configuration shares
databaseConfig :: Shared DBConfig
aisLinkConfig :: Shared AISConfig
asteriskLinkConfig :: Shared AsteriskConfig
smtpConfig :: Shared SMTPConfig
webLinksConfig :: Shared WebLinksConfig
adminPassword :: Shared Password
databaseConfig :: SDSLens () DBConfig DBConfig
aisLinkConfig :: SDSLens () AISConfig AISConfig
asteriskLinkConfig :: SDSLens () AsteriskConfig AsteriskConfig
smtpConfig :: SDSLens () SMTPConfig SMTPConfig
webLinksConfig :: SDSLens () WebLinksConfig WebLinksConfig
adminPassword :: SDSLens () Password Password
//Derived configuration shares
databaseDef :: RWShared () SQLDatabaseDef SQLDatabaseDef
databaseDef :: SDSLens () SQLDatabaseDef SQLDatabaseDef
//Conversion functions
toDatabaseDef :: DBConfig -> SQLDatabaseDef
......
......@@ -4,27 +4,27 @@ import iTasks, iTasks.Extensions.SQLDatabase, iTasks.Extensions.Web
derive class iTask DBConfig, AISConfig, AsteriskConfig, SMTPConfig, WebLinksConfig, WebLink
//Shared stores
databaseConfig :: Shared DBConfig
databaseConfig :: SDSLens () DBConfig DBConfig
databaseConfig = sharedStore "databaseConfig" InternalSQLiteDB
aisLinkConfig :: Shared AISConfig
aisLinkConfig :: SDSLens () AISConfig AISConfig
aisLinkConfig = sharedStore "aisLinkConfig" {AISConfig|host="localhost",port=2000}
asteriskLinkConfig :: Shared AsteriskConfig
asteriskLinkConfig :: SDSLens () AsteriskConfig AsteriskConfig
asteriskLinkConfig = sharedStore "asteriskLinkConfig" {AsteriskConfig|host="localhost",port=5038,username="admin",password="secret"}
smtpConfig :: Shared SMTPConfig
smtpConfig :: SDSLens () SMTPConfig SMTPConfig
smtpConfig = sharedStore "smtpConfig" {SMTPConfig|host="localhost",port=25}
webLinksConfig :: Shared WebLinksConfig
webLinksConfig :: SDSLens () WebLinksConfig WebLinksConfig
webLinksConfig = sharedStore "webLinksConfig" {WebLinksConfig|weatherWidgets=Nothing,vesselLinks=[]}
adminPassword :: Shared Password
adminPassword :: SDSLens () Password Password
adminPassword = sharedStore "adminPassword" (Password "admin")
//Derived configuration shares
databaseDef :: RWShared () SQLDatabaseDef SQLDatabaseDef
databaseDef = mapReadWrite (toDatabaseDef,\_ _ -> Nothing) (toReadOnly databaseConfig)
databaseDef :: SDSLens () SQLDatabaseDef SQLDatabaseDef
databaseDef = mapReadWrite (toDatabaseDef,\_ r -> Nothing) Nothing (toReadOnly databaseConfig)
//Conversion functions
toDatabaseDef :: DBConfig -> SQLDatabaseDef
......
......@@ -74,8 +74,8 @@ fromLeafletPerspective :: LeafletPerspective -> ContactMapPerspective
selectionFromLeafletMap :: LeafletMap -> [String]
//Standard layers available to use in all map views
standardPerspective :: Shared ContactMapPerspective
standardMapLayers :: Shared [ContactMapLayer]
standardPerspective :: SDSLens () ContactMapPerspective ContactMapPerspective
standardMapLayers :: SDSLens () [ContactMapLayer] [ContactMapLayer]
derive JSONEncode ContactPosition, ContactMapPerspective
derive JSONDecode ContactPosition, ContactMapPerspective
......
......@@ -224,9 +224,9 @@ fromLeafletLatLng {LeafletLatLng|lat,lng} = (lat,lng)
fromLeafletBounds :: !LeafletBounds -> (!(!Real,!Real),!(!Real,!Real))
fromLeafletBounds {LeafletBounds|southWest,northEast} = (fromLeafletLatLng southWest,fromLeafletLatLng northEast)
standardPerspective :: Shared ContactMapPerspective
standardPerspective :: SDSLens () ContactMapPerspective ContactMapPerspective
standardPerspective = sharedStore "standardPerspective" defaultValue
standardMapLayers :: Shared [ContactMapLayer]
standardMapLayers :: SDSLens () [ContactMapLayer] [ContactMapLayer]
standardMapLayers = sharedStore "standardMapLayers" [{ContactMapLayer|title="Local OSM tiles",def=CMTileLayer "/tiles/{z}/{x}/{y}.png"}]
......@@ -14,7 +14,7 @@ import Incidone.OP.Concepts
derive class iTask WallContent
//Current content of the video wall
wallContent :: Shared WallContent
wallContent :: SDSLens () WallContent WallContent
//View content that was selected for viewing on the video wall
viewVideoWallContent :: Task WallContent
......@@ -7,7 +7,7 @@ import Text, Text.HTML, Data.List, iTasks.Internal.HtmlUtil
derive class iTask WallContent
wallContent :: Shared WallContent
wallContent :: SDSLens () WallContent WallContent
wallContent = sharedStore "WallContent" (WallOverview defaultValue)
viewVideoWallContent :: Task WallContent
......
......@@ -5,7 +5,7 @@ import Incidone.OP.Concepts, Incidone.ActionManagementTasks
crewListActions :: [CatalogAction]
manageContactCrew :: ContactNo -> Task ()
manageContactCrewAction :: ActionDefinition ContactNo
manageContactCrewAction :: ActionDefinition ContactNo sds
manageCrewAliasList :: ContactNo -> Task ()
manageCrewAliasListAction :: ActionDefinition ContactNo
manageCrewAliasListAction :: ActionDefinition ContactNo sds
......@@ -27,7 +27,7 @@ viewContactCommunicationMeans :: ContactNo -> Task [CommunicationMean]
updateContactPosition :: ContactNo -> Task (Maybe (Maybe ContactPosition))
updateContactStatus :: ContactNo -> Task (Maybe (Maybe ContactStatus))
updateSharedContactRefList :: d (RWShared () [ContactNo] [ContactNo]) -> Task [ContactNo] | toPrompt d
updateSharedContactRefList :: d (sds () [ContactNo] [ContactNo]) -> Task [ContactNo] | toPrompt d & RWShared sds
selectKnownOrDefineNewContact :: Task (Either ContactNo NewContact)
createContactIfNew :: (Either ContactNo NewContact) -> Task ContactNo
......@@ -36,7 +36,7 @@ createContact :: NewContact -> Task ContactNo
deleteContact :: ContactNo -> Task ()
addContactPhoto :: ContactNo Document -> Task ContactPhoto
updatePosition :: ContactPosition String (Shared Contact) -> Task Contact
updatePosition :: ContactPosition String (sds () Contact Contact) -> Task Contact | RWShared sds
createCommunicationMean :: ContactNo NewCommunicationMean -> Task CommunicationMeanId
deleteCommunicationMean :: CommunicationMeanId -> Task ()
......@@ -44,4 +44,4 @@ deleteCommunicationMean :: CommunicationMeanId -> Task ()
//Check credentials for contacts that can log in
verifyContactCredentials :: Credentials -> Task (Maybe User)