Commit 946848f4 authored by Mart Lubbers's avatar Mart Lubbers

Merge branch 'fully-async-share-trees' into 'master'

Asynchronous share evaluation

Closes #156

See merge request !201
parents fce9cfa0 08ec2877
Pipeline #18767 passed with stage
in 5 minutes and 28 seconds
Version: 1.0
Environment
EnvironmentName: iTasks-dist
EnvironmentPaths
Path: {Application}/lib/StdEnv
Path: {Application}/lib/Dynamics
Path: {Application}/lib/TCPIP
Path: {Application}/lib/Sapl
Path: {Application}/lib/GraphCopy
Path: {Application}/lib/Platform
Path: {Application}/lib/Platform/Deprecated/Generics
Path: {Application}/lib/Platform/Deprecated/StdLib
Path: {Application}/Development/iTasks-SDK/Libraries
EnvironmentCompiler: lib/exe/cocl::-dynamics -sapl -d
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: /usr/bin/gcc::-g|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
EnvironmentDynLink: lib/exe/cclinker
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: True
\ No newline at end of file
Version: 1.0
Environment
EnvironmentName: iTasks
EnvironmentPaths
Path: {Application}/lib/StdEnv
Path: {Application}/lib/Dynamics
Path: {Application}/lib/TCPIP
Path: {Application}/lib/Platform
Path: {Application}/lib/Platform/Deprecated/Generics
Path: {Application}/lib/Platform/Deprecated/StdLib
Path: {Application}/lib/Sapl
Path: {Application}/lib/GraphCopy
Path: {Application}/lib/iTasks
EnvironmentCompiler: lib/exe/cocl:-dynamics -sapl -desc -exl -d
EnvironmentCodeGen: lib/exe/cg
EnvironmentLinker: lib/exe/cclinker|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
EnvironmentDynLink: lib/exe/cclinker
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: True
Version: 1.0
Environments
Environment
EnvironmentName: iTasks-dist
EnvironmentPaths
Path: {Application}\Libraries\StdEnv
Path: {Application}\Libraries\Dynamics
Path: {Application}\Libraries\Dynamics\extension
Path: {Application}\Libraries\Dynamics\general
Path: {Application}\Libraries\Dynamics\implementation
Path: {Application}\Libraries\Dynamics\implementation\windows
Path: {Application}\Libraries\TCPIP
Path: {Application}\Libraries\Platform
Path: {Application}\Libraries\Platform\Deprecated\Generics
Path: {Application}\Libraries\Platform\Deprecated\StdLib
Path: {Application}\Libraries\Sapl
Path: {Application}\Libraries\GraphCopy
Path: {Application}\Development\iTasks-SDK\Libraries
EnvironmentCompiler: Tools\Clean System\CleanCompiler.exe : -h 64M : -sapl -dynamics -generics -desc -exl -d
EnvironmentCodeGen: Tools\Clean System\CodeGenerator.exe
EnvironmentLinker: Tools\Clean System\StaticLinker.exe : -h 64M | Tools\Clean System\SaplCollectorLinker.exe | Tools\Clean System\WebResourceCollector.exe
EnvironmentDynLink: Tools\Clean System\DynamicLinker.exe
EnvironmentVersion: 920
EnvironmentRedirect: False
EnvironmentCompileMethod: Pers
EnvironmentProcessor: I386
Environment64BitProcessor: False
......@@ -18,8 +18,9 @@ import Incidone.OP.Concepts
:: ActionDefinition c
= { identity :: String
, meta :: ItemMeta
, task :: c (Shared ActionStatus) -> Task ()
, task :: c (SimpleSDSLens ActionStatus) -> Task ()
}
//Wrapped action for storage in the action catalog
:: CatalogAction =
{ identity :: String //Identifying string, such that you can track which actions have been done
......@@ -33,9 +34,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 (SimpleSDSLens ActionStatus) -> Task ()) & iTask c //An action item that needs to be configured before it can be deployed
:: ActionProgress
= ActionPlanned
......@@ -144,7 +145,7 @@ derive gDefault CatalogAction
derive gText CatalogAction
derive gEditor CatalogAction
toInstantAction :: c ActionProgress [ContactNo] [IncidentNo] (ActionDefinition c) -> CatalogAction | iTask c
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
......@@ -155,34 +156,34 @@ forIncident :: IncidentNo (ActionDefinition (ContactNo,IncidentN
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 :: SDSSource () [CatalogAction] ()
userActionCatalog :: SimpleSDSLens [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 :: () (Shared sds 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 ((SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction
predefinedConfigurableItem :: String ItemMeta ([ContactNo] [IncidentNo] -> Task (c,ActionStatus)) (c (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c
//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 (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a
predefinedContactItem :: String ItemMeta (Maybe String) (ContactNo (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a
//Action lists items
listItemTask :: (String,ActionPlan) (Shared ActionStatus) -> Task ()
listItemTask :: (String,ActionPlan) (Shared sds ActionStatus) -> Task () | RWShared sds
blankListItem :: CatalogAction
predefinedListItem :: String ItemMeta ActionPlan -> CatalogAction
configurableListItem :: String ItemMeta (Task c) (c -> ActionPlan) -> CatalogAction | iTask c
......@@ -192,7 +193,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 = sdsSplit "actionStatusesByIncident" (\p -> ((),p)) read write actionStatuses
actionStatusesByIncident :: SDSLens IncidentNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesByIncident = sdsSplit "actionStatusesByIncident" (\p -> ((),p)) read write (Just \p w. Ok w) 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 = sdsSplit "actionStatusesByContact" (\p -> ((),p)) read write actionStatuses
actionStatusesByContact :: SDSLens ContactNo [(InstanceNo,InstanceNo,ActionStatus)] ()
actionStatusesByContact = sdsSplit "actionStatusesByContact" (\p -> ((),p)) read write (Just \p w. Ok w) 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 = sdsProject (SDSLensRead read) (SDSLensWrite write) taskInstanceByNo
actionStatusByNo :: SDSLens InstanceNo ActionStatus ActionStatus
actionStatusByNo = sdsProject (SDSLensRead read) (SDSLensWrite write) Nothing 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,8 +100,8 @@ 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 list = sdsFocus taskListFilter (mapReadWriteError (toSelfActionStatus,fromSelfActionStatus) list)
selfActionStatus :: (SharedTaskList a) -> SimpleSDSLens ActionStatus | iTask a
selfActionStatus list = sdsFocus taskListFilter (mapReadWriteError (toSelfActionStatus,fromSelfActionStatus) Nothing list)
where
taskListFilter = {TaskListFilter|onlyIndex=Nothing,onlyTaskId=Nothing,onlySelf=False
,includeValue=False,includeAttributes=True,includeProgress=False}
......@@ -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 ((SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction
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 (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a & iTask c
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 (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a
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 (SimpleSDSLens ActionStatus) -> Task a) -> CatalogAction | iTask a
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 :: (Shared sds 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 :: SDSSource () [CatalogAction] ()
builtinActionCatalog = constShare
[blankTodoItem
,blankAlertItem
......@@ -261,11 +261,11 @@ builtinActionCatalog = constShare
:crewListActions
]
userActionCatalog :: Shared [UserCatalogAction]
userActionCatalog :: SimpleSDSLens [UserCatalogAction]
userActionCatalog = sharedStore "UserActionCatalog" []
//Todo items
todoItemTask :: () (Shared ActionStatus) -> Task ()
todoItemTask :: () (Shared sds 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) (Shared sds 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) (Shared sds 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) (Shared sds 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) (Shared sds 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
......@@ -571,7 +571,7 @@ workOnActionItem instanceNo
where
workOnTask taskId
= workOn taskId
>>* [OnValue (ifValue ((===) ASExcepted) (\_ -> viewInformation (Title "Error") [] "An exception occurred in this action" @! ()))
>>* [OnValue (ifValue (\v. case v of ASExcepted _ = True; _ =False;) (\_ -> viewInformation (Title "Error") [] "An exception occurred in this action" @! ()))
,OnValue (ifValue ((===) ASIncompatible) (\_ -> restartIncompatibleTask taskId))
]
......@@ -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) (Shared sds a) -> Task (Maybe a) | iTask a & RWShared sds //TODO: Move to util
edit task sds
= get sds
>>- \current ->
......@@ -673,16 +673,16 @@ where
fromPrj status {ItemMeta|title,description} = {ActionStatus|status & title=title,description=description}
contacts status
= mapReadWrite (\{ActionStatus|contacts}-> contacts, \contacts status -> Just {ActionStatus|status & contacts=contacts}) status
= mapReadWrite (\{ActionStatus|contacts}-> contacts, \contacts status -> Just {ActionStatus|status & contacts=contacts}) Nothing status
incidents status
= mapReadWrite (\{ActionStatus|incidents}-> incidents, \incidents status -> Just {ActionStatus|status & incidents=incidents}) status
= mapReadWrite (\{ActionStatus|incidents}-> incidents, \incidents status -> Just {ActionStatus|status & incidents=incidents}) Nothing status
manageSubActions :: ActionPlan (Shared ActionStatus) (SharedTaskList ()) -> Task ()
manageSubActions :: ActionPlan (Shared sds 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 :: (Shared sds 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 (Shared sds 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) ((SimpleSDSLens ActionStatus) -> Task ()) -> Task TaskId | iTask a
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 :: SimpleSDSLens DBConfig
aisLinkConfig :: SimpleSDSLens AISConfig
asteriskLinkConfig :: SimpleSDSLens AsteriskConfig
smtpConfig :: SimpleSDSLens SMTPConfig
webLinksConfig :: SimpleSDSLens WebLinksConfig
adminPassword :: SimpleSDSLens Password
//Derived configuration shares
databaseDef :: RWShared () SQLDatabaseDef SQLDatabaseDef
databaseDef :: SimpleSDSLens 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 :: SimpleSDSLens DBConfig
databaseConfig = sharedStore "databaseConfig" InternalSQLiteDB
aisLinkConfig :: Shared AISConfig
aisLinkConfig :: SimpleSDSLens AISConfig
aisLinkConfig = sharedStore "aisLinkConfig" {AISConfig|host="localhost",port=2000}
asteriskLinkConfig :: Shared AsteriskConfig
asteriskLinkConfig :: SimpleSDSLens AsteriskConfig
asteriskLinkConfig = sharedStore "asteriskLinkConfig" {AsteriskConfig|host="localhost",port=5038,username="admin",password="secret"}
smtpConfig :: Shared SMTPConfig
smtpConfig :: SimpleSDSLens SMTPConfig
smtpConfig = sharedStore "smtpConfig" {SMTPConfig|host="localhost",port=25}
webLinksConfig :: Shared WebLinksConfig
webLinksConfig :: SimpleSDSLens WebLinksConfig
webLinksConfig = sharedStore "webLinksConfig" {WebLinksConfig|weatherWidgets=Nothing,vesselLinks=[]}
adminPassword :: Shared Password
adminPassword :: SimpleSDSLens Password
adminPassword = sharedStore "adminPassword" (Password "admin")
//Derived configuration shares
databaseDef :: RWShared