Commit b82d7254 authored by Mart Lubbers's avatar Mart Lubbers

Merge branch 'master' of gitlab.science.ru.nl:clean-and-itasks/iTasks-SDK into...

Merge branch 'master' of gitlab.science.ru.nl:clean-and-itasks/iTasks-SDK into experiment-rewriting-tasks
parents dd050d50 d799ff6a
Pipeline #28794 passed with stage
in 4 minutes and 29 seconds
......@@ -193,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 (sds () [(InstanceNo,InstanceNo,ActionStatus)] ()) -> Task InstanceNo | toPrompt d & RWShared sds
chooseActionItem :: Bool Bool (sds () [(InstanceNo,InstanceNo,ActionStatus)] ()) -> Task InstanceNo | RWShared sds
workOnActionItem :: InstanceNo -> Task ()
editActionItem :: InstanceNo -> Task (Maybe ActionStatus)
deleteActionItem :: InstanceNo -> Task (Maybe ActionStatus)
......
......@@ -11,13 +11,13 @@ selectVideoWallContent
@! ()
where
header
= viewInformation () [] ("REMOTE CONTROL") //<<@ (AfterLayout (uiDefSetHalign AlignRight o uiDefSetBaseCls "wall-header")) //FIXME
= viewInformation [] ("REMOTE CONTROL") //<<@ (AfterLayout (uiDefSetHalign AlignRight o uiDefSetBaseCls "wall-header")) //FIXME
mapContacts = mapRead (\(x,y) -> x++y) (contactsOfOpenIncidentsGeo |*| contactsProvidingHelpGeo)
selectContent
= (switchContent >&> withSelection viewNoSelection configureContent) <<@ (ArrangeWithSideBar 0 LeftSide False)
switchContent = enterChoice (Title "Choose Content") [ChooseFromList bigLabel] contentOptions
switchContent = (Title "Choose Content") @>> enterChoice [ChooseFromList bigLabel] contentOptions
contentOptions
= ["Overview","Incident","Contact","Clock","Countdown"]
......@@ -30,7 +30,7 @@ where
= get (standardMapLayers |*| standardPerspective)
>>- \(baseLayers,perspective) ->
withShared perspective
\p -> updateSharedInformation (Title title) [UpdateAs (toMap baseLayers) fromMap] (p >*| mapContacts) @ fst
\p -> Title title @>> updateSharedInformation [UpdateSharedAs (toMap baseLayers) fromMap const] (p >*| mapContacts) @ fst
//<<@ AfterLayout (tweakUI fill) //FIXME
@ WallOverview
where
......@@ -39,18 +39,19 @@ where
fromMap _ {LeafletMap|perspective}
= fromLeafletPerspective perspective
configure "Incident"
= enterChoiceWithSharedAs (Title title) [ChooseFromList bigLabel] allIncidentsShort (\{IncidentShort|incidentNo} -> WallIncidentSummary (Just incidentNo))
= Title title @>> enterChoiceWithSharedAs [ChooseFromList bigLabel] allIncidentsShort (\{IncidentShort|incidentNo} -> WallIncidentSummary (Just incidentNo))
configure "Contact"
= enterChoiceWithSharedAs (Title title) [ChooseFromList bigLabel] allContactsShort (\{ContactShort|contactNo} -> WallContactSummary (Just contactNo))
= Title title @>> enterChoiceWithSharedAs [ChooseFromList bigLabel] allContactsShort (\{ContactShort|contactNo} -> WallContactSummary (Just contactNo))
configure "Clock"
= viewInformation (Title title) [] "No configuration is needed for the clock."
= Title title @>> viewInformation [] "No configuration is needed for the clock."
//<<@ AfterLayout (tweakUI fill) //FIXME
@! WallClock
configure "Countdown"
= get currentDateTime
>>- updateInformation (title,"Set the countdown date and time") []
>>- \datetime ->
Title title @>> Hint "Set the countdown date and time" @>> updateInformation [] datetime
@ WallCountDown
configure _
= viewInformation (title,"This option is not available yet...") [] () @? const NoValue
= Title title @>> Hint "This option is not available yet..." @>> viewInformation [] () @? const NoValue
bigLabel l = SpanTag [StyleAttr "font-size: 24px; font-weight: bold; margin-bottom: 5px;"] [Text (toSingleLineText l)]
......@@ -17,18 +17,18 @@ viewVideoWallContent
= (header ||- content) <<@ (ArrangeWithHeader 0) //<<@ AfterLayout plainLayoutFinal //FIXME
where
header
= viewSharedInformation () [ViewAs view] (currentTime |*| currentUTCTime) //<<@ (AfterLayout (uiDefSetHalign AlignRight o uiDefSetBaseCls "wall-header")) //FIXME
= viewSharedInformation [ViewAs view] (currentTime |*| currentUTCTime) //<<@ (AfterLayout (uiDefSetHalign AlignRight o uiDefSetBaseCls "wall-header")) //FIXME
where
view (local,utc) = "LOCAL: " + lpad (toString local.Time.hour) 2 '0' + ":" + lpad (toString local.Time.min) 2 '0' + " "
+ "UTC: " + lpad (toString utc.Time.hour) 2 '0' + ":" + lpad (toString utc.Time.min) 2 '0'
content
= whileUnchanged wallContent \content -> case content of
WallClock = (viewSharedInformation (Title "Local Time") [ViewAs formatTime] currentTime @! content)
WallClock = (Title "Local Time" @>> viewSharedInformation [ViewAs formatTime] currentTime @! content)
// WallCountDown until = (viewSharedInformation (Title "Countdown") [ViewAs (\t -> formatDateTime (until - t))] currentDateTime @! content)
WallOverview perspective = viewWallOverview perspective @! content
WallContactSummary (Just contactNo) = viewWallContactSummary contactNo @! content
WallIncidentSummary (Just incidentNo) = viewWallIncidentSummary incidentNo @! content
_ = viewInformation "Nothing selected..." [] () @! content
_ = Hint "Nothing selected..." @>> viewInformation [] () @! content
formatTime time = DivTag [StyleAttr "font-size: 80pt; text-align: center; padding-top: 200px;"] [Text (toString time)]
formatDateTime time = DivTag [StyleAttr "font-size: 80pt; text-align: center; padding-top: 200px;"] [Text (toString time)]
......@@ -36,11 +36,11 @@ formatDateTime time = DivTag [StyleAttr "font-size: 80pt; text-align: center; pa
mapContacts = mapRead (\(x,y) -> x++y) (contactsOfOpenIncidentsGeo |*| contactsProvidingHelpGeo)
viewWallOverview perspective
= ((viewSharedInformation (Title "Open Incidents") [ViewAs formatIncidents] openIncidentsDetails)
= (((Title "Open Incidents") @>> viewSharedInformation [ViewAs formatIncidents] openIncidentsDetails)
-&&-
(get standardMapLayers
>>- \baseLayers ->
viewSharedInformation () [ViewAs (toMap perspective baseLayers)] mapContacts /* <<@ AfterLayout (tweakUI (setMargins 0 0 0 0 o fill))*/ ) //FIXME
viewSharedInformation [ViewAs (toMap perspective baseLayers)] mapContacts /* <<@ AfterLayout (tweakUI (setMargins 0 0 0 0 o fill))*/ ) //FIXME
) <<@ ArrangeWithSideBar 0 LeftSide False
where
toMap perspective baseLayers contacts
......@@ -63,11 +63,11 @@ where
contact = sdsFocus contactNo contactByNo
viewContactTitle
= viewSharedInformation () [] (mapRead contactTitle contact) /* <<@ AfterLayout (uiDefSetBaseCls "wall-contact-title") */ //FIXME
= viewSharedInformation [] (mapRead contactTitle contact) /* <<@ AfterLayout (uiDefSetBaseCls "wall-contact-title") */ //FIXME
viewDetails
= (viewPhoto -&&- viewTypeDetails) <<@ (Title "Details")
viewPhoto
= viewSharedInformation () [ViewAs formatPhoto] contact
= viewSharedInformation [ViewAs formatPhoto] contact
where
formatPhoto {Contact|photos,type,notes}
= ImgTag [ClassAttr "wall-contact-details",WidthAttr "200",HeightAttr "200",SrcAttr (photoSrc photos)]
......@@ -77,14 +77,14 @@ where
viewTypeDetails = whileUnchanged contact
\{Contact|type} -> case type of
Just Vessel = viewSharedInformation () [] (sdsFocus contactNo vesselDetailsByNo) @! ()
Just Person = viewSharedInformation () [] (sdsFocus contactNo personDetailsByNo) @! ()
_ = viewInformation () [] ()
Just Vessel = viewSharedInformation [] (sdsFocus contactNo vesselDetailsByNo) @! ()
Just Person = viewSharedInformation [] (sdsFocus contactNo personDetailsByNo) @! ()
_ = viewInformation [] ()
viewPosition
= ((viewSharedInformation (Title "Position") [ViewAs formatPosition] contact /* <<@ AfterLayout (uiDefSetBaseCls "wall-contact-position") */) //FIXME
= (((Title "Position") @>> viewSharedInformation [ViewAs formatPosition] contact /* <<@ AfterLayout (uiDefSetBaseCls "wall-contact-position") */) //FIXME
-&&-
(viewSharedInformation (Title "Map") [ViewAs contactMap] contact /*<<@ AfterLayout (tweakUI (setMargins 0 0 0 0 o fill)) */) //FIXME
((Title "Map") @>> viewSharedInformation [ViewAs contactMap] contact /*<<@ AfterLayout (tweakUI (setMargins 0 0 0 0 o fill)) */) //FIXME
)
where
formatPosition {Contact|position=Just pos} = toSingleLineText pos
......@@ -101,7 +101,7 @@ where
markers c _ = []
viewCommunication
= viewSharedInformation (Title "Last communication") [ViewAs (formatComms o take 5)] (sdsFocus contactNo contactCommunications)
= (Title "Last communication") @>> viewSharedInformation [ViewAs (formatComms o take 5)] (sdsFocus contactNo contactCommunications)
where
formatComms items
= DivTag []
......@@ -118,9 +118,9 @@ where
incident = sdsFocus incidentNo incidentByNo
viewIncidentTitle
= viewSharedInformation () [] (sdsFocus incidentNo incidentTitleByNo) //<<@ AfterLayout (uiDefSetBaseCls "wall-contact-title") //FIXME
= viewSharedInformation [] (sdsFocus incidentNo incidentTitleByNo) //<<@ AfterLayout (uiDefSetBaseCls "wall-contact-title") //FIXME
viewIncidentContacts
= viewSharedInformation (Title "Involved Contacts") [ViewAs toView] (sdsFocus incidentNo contactsByIncident)
= (Title "Involved Contacts") @>> viewSharedInformation [ViewAs toView] (sdsFocus incidentNo contactsByIncident)
where
toView contacts = DivTag [ClassAttr "wall-incident-contacts"] (map formatContact contacts)
......@@ -134,14 +134,14 @@ where
photoSrc _ = "/no-photo.jpg"
viewIncidentActions
= viewSharedInformation (Title "Open Actions") [ViewAs toView] (sdsFocus incidentNo actionStatusesByIncident) /* <<@ AfterLayout (tweakUI fill) */ //FIXME
= (Title "Open Actions") @>> viewSharedInformation [ViewAs toView] (sdsFocus incidentNo actionStatusesByIncident) /* <<@ AfterLayout (tweakUI fill) */ //FIXME
where
toView actions = DivTag [] [vizAction a \\ (_,_,a) <- actions]
vizAction {ActionStatus|title}
= DivTag [ClassAttr "wall-action"] [H2Tag [ClassAttr "wall-action-title"] [Text title]]
viewIncidentLog
= viewSharedInformation (Title "Last Log Messages") [ViewAs (toView o take 5)] (sdsFocus incidentNo incidentLog)
= Title "Last Log Messages" @>> viewSharedInformation [ViewAs (toView o take 5)] (sdsFocus incidentNo incidentLog)
where
toView log = DivTag [] (flatten [[vizDate date:map vizEntry entries] \\ (date,entries) <- groupByDate log])
......
......@@ -19,7 +19,7 @@ crewAliasListsStore = indexedStore "crewAliasLists" []
//Manage the crew information for a specific contact
manageContactCrew :: ContactNo -> Task ()
manageContactCrew contactNo
= updateSharedContactRefList "Manage crew" (sdsFocus contactNo crewListsStore)
= Hint "Manage crew" @>> updateSharedContactRefList (sdsFocus contactNo crewListsStore)
//Optional Improvements
// -|| forever (addStandardCrewMembers contactNo)
-|| forever (quickAddStandardCrewMembers contactNo)
......@@ -38,7 +38,7 @@ where
quickAddStandardCrewMembers contactNo
= get (sdsFocus contactNo crewAliasListsStore)
-&&-
(enterInformation "Enter the numbers of the crew numbers you want to set (comma separated)" [] @ (map (toInt o trim) o (split ",")))
(Hint "Enter the numbers of the crew numbers you want to set (comma separated)" @>> enterInformation [] @ (map (toInt o trim) o (split ",")))
>>* [OnAction (Action "Set members") (hasValue (\(aliasList,enteredNos) ->
setCrewMembers contactNo (flatten [[cNo \\ (aNo,cNo) <- aliasList | aNo == eNo] \\ eNo <- enteredNos])))]
......@@ -55,14 +55,14 @@ where
refs = sdsFocus contactNo crewAliasListsStore
manageCurrentItems
= updateSharedInformation "Manage crew list" [UpdateAs toPrj fromPrj] items
= Hint "Manage crew list" @>> updateSharedInformation [UpdateSharedAs toPrj fromPrj const] items
where
items = sdsDeref refs snd contactsByNosShort derefAliasList
toPrj l = [(contactIdentity c, aNo, contactTitle c)\\(aNo,c) <-l]
fromPrj _ items = [(aNo,cNo) \\ (cNo,aNo,_) <- items]
addItem
= (enterInformation "Enter a number to use when refering to this contact" []
= (Hint "Enter a number to use when refering to this contact" @>> enterInformation []
-&&-
selectKnownOrDefineNewContact)
>>? (\(aliasNo,def) -> createContactIfNew def >>- \contactNo -> upd (\r -> r++[(aliasNo,contactNo)]) refs)
......
......@@ -28,7 +28,7 @@ updateCommunication communicationNo
(EmailMessage,Out) = composeEmailMessage communicationNo
(P2000Message,Out) = composeP2000Message communicationNo
_
= viewSharedInformation (Title "Communication details:") [] (sdsFocus communicationNo communicationDetailsByNo)
= (Title "Communication details:") @>> viewSharedInformation [] (sdsFocus communicationNo communicationDetailsByNo)
>>| return communicationNo
//Answer an incoming call
......@@ -121,11 +121,11 @@ composeAndSendMessage communicationNo share sendTask = forever
)
where
composeMessage
= updateSharedInformation (Title "Message") [] share // <<@ FillNotes //FIXME
= (Title "Message") @>> updateSharedInformation [] share // <<@ FillNotes //FIXME
>>* [OnAction ActionSend (hasValue (\_ -> sendTask communicationNo))]
viewMessage
= viewSharedInformation (Title "Message") [] share
= (Title "Message") @>> viewSharedInformation [] share
@! ()
relateMessageToIncidents :: CommunicationNo -> Task ()
......@@ -156,42 +156,42 @@ connectOutboundPhoneCall communicationNo
>^* [OnAction ActionDial (ifValue isNothing (\_ -> initiateAsteriskChannel communicationNo))
,OnAction ActionCancel (ifValue (maybe False ((===) Pending)) (\_ -> destroyAsteriskChannel communicationNo))
,OnAction ActionHangup (ifValue (maybe False ((===) Connected)) (\_ -> destroyAsteriskChannel communicationNo))
]) <<@ ApplyAttribute "buttonPosition" "right"
]) <<@ ("buttonPosition",JSONString "right")
@! ()
updatePhoneCallMeta :: CommunicationNo -> Task CommunicationStatus
updatePhoneCallMeta communicationNo
= ((Label "External number" @>> updateSharedInformation () [] (sdsFocus communicationNo phoneCallExternalNo))
= ((Label "External number" @>> updateSharedInformation [] (sdsFocus communicationNo phoneCallExternalNo))
-&&-
(Label "Time" @>> updateSharedInformation () [] (sdsFocus communicationNo communicationTime))
(Label "Time" @>> updateSharedInformation [] (sdsFocus communicationNo communicationTime))
)
-&&-
((Label "Status" @>> editSharedChoice () [] [Pending,Ringing,Connected,Missed,Answered] (sdsFocus communicationNo communicationStatus))
((Label "Status" @>> editSharedChoice [] [Pending,Ringing,Connected,Missed,Answered] (sdsFocus communicationNo communicationStatus))
-&&-
(Label "Handled by" @>> editSharedChoiceWithSharedAs () [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
(Label "Handled by" @>> editSharedChoiceWithSharedAs [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
) <<@ ArrangeSplit Horizontal False
@ \(_,(status,_)) -> status
updateRadioCallMeta :: CommunicationNo -> Task CommunicationStatus
updateRadioCallMeta communicationNo
= ((Label "Channel" @>> updateSharedInformation () [] (sdsFocus communicationNo radioCallChannel))
= ((Label "Channel" @>> updateSharedInformation [] (sdsFocus communicationNo radioCallChannel))
-&&-
(Label "Time" @>> updateSharedInformation () [] (sdsFocus communicationNo communicationTime))
(Label "Time" @>> updateSharedInformation [] (sdsFocus communicationNo communicationTime))
)
-&&-
((Label "Status" @>> editSharedChoice () [] [Missed,Answered] (sdsFocus communicationNo communicationStatus))
((Label "Status" @>> editSharedChoice [] [Missed,Answered] (sdsFocus communicationNo communicationStatus))
-&&-
(Label "Handled by" @>> editSharedChoiceWithSharedAs () [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
(Label "Handled by" @>> editSharedChoiceWithSharedAs [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
) <<@ ArrangeSplit Horizontal False
@ \(_,(status,_)) -> status
updateMessageMeta :: CommunicationNo -> Task CommunicationStatus
updateMessageMeta communicationNo
= ((Label "Time" @>> updateSharedInformation () [] (sdsFocus communicationNo communicationTime)))
= ((Label "Time" @>> updateSharedInformation [] (sdsFocus communicationNo communicationTime)))
-&&-
((Label "Status" @>> editSharedChoice () [] [Pending,Sent] (sdsFocus communicationNo communicationStatus))
((Label "Status" @>> editSharedChoice [] [Pending,Sent] (sdsFocus communicationNo communicationStatus))
-&&-
(Label "Handled by" @>> editSharedChoiceWithSharedAs () [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
(Label "Handled by" @>> editSharedChoiceWithSharedAs [] watchOfficers contactIdentity (sdsFocus communicationNo communicationHandledBy))
) <<@ ArrangeSplit Horizontal False
@ \(_,(status,_)) -> status
......@@ -256,12 +256,12 @@ determineContact mbPrevious
<<@ ArrangeVertical
where
createNewContact filter
= enterInformation (Title "Contact") [] // @> (mapToFilter,filter)
= Title "Contact" @>> enterInformation [] // @> (mapToFilter,filter)
>>* [OnAction ActionCreate (hasValue (createContact))]
selectExistingContact filter
= whileUnchanged filter
\curFilter ->
enterChoiceWithSharedAs (Title "Select contact") [ChooseFromList contactTitle] (sdsFocus curFilter filteredContactsShort) contactIdentity
(Title "Select contact") @>> enterChoiceWithSharedAs [ChooseFromList contactTitle] (sdsFocus curFilter filteredContactsShort) contactIdentity
>>* [OnValue (hasValue return)
:maybe [] (\contactNo -> [OnAction ActionCancel (always (return contactNo))]) mbPrevious]
......@@ -293,7 +293,7 @@ manageVoiceCallContent type communicationNo
= updateCallNotes -|| relateMessageToIncidents communicationNo <<@ ArrangeWithTabs True
where
updateCallNotes
= updateSharedInformation (Title "Notes") [] (callNotes type) //<<@ FillNotes //FIXME
= (Title "Notes") @>> updateSharedInformation [] (callNotes type) //<<@ FillNotes //FIXME
@! ()
callNotes PhoneCall = sdsFocus communicationNo (mapReadWrite (toPrj,fromPrj) Nothing phoneCallByNo)
......
......@@ -27,7 +27,7 @@ viewContactCommunicationMeans :: ContactNo -> Task [CommunicationMean]
updateContactPosition :: ContactNo -> Task (Maybe (Maybe ContactPosition))
updateContactStatus :: ContactNo -> Task (Maybe (Maybe ContactStatus))
updateSharedContactRefList :: d (Shared sds [ContactNo]) -> Task [ContactNo] | toPrompt d & RWShared sds
updateSharedContactRefList :: (Shared sds [ContactNo]) -> Task [ContactNo] | RWShared sds
selectKnownOrDefineNewContact :: Task (Either ContactNo NewContact)
createContactIfNew :: (Either ContactNo NewContact) -> Task ContactNo
......
......@@ -12,7 +12,7 @@ manageIncidentLog :: IncidentNo -> Task ()
viewIncidentDetails :: IncidentNo -> Task ()
//Reusable task fragments
updateSharedIncidentRefList :: d Bool (Shared sds [IncidentNo]) -> Task [IncidentNo] | toPrompt d & RWShared sds
updateSharedIncidentRefList :: Bool (Shared sds [IncidentNo]) -> Task [IncidentNo] | RWShared sds
selectKnownOrDefineNewIncident :: Task (Either IncidentNo NewIncident)
createIncidentIfNew :: (Either IncidentNo NewIncident) -> Task IncidentNo
......
......@@ -35,7 +35,8 @@ manageIncidentInformation ws incidentNo
//Basic incident information (title, summary, type, phase etc..)
manageIncidentSituationInfo :: IncidentNo -> Task ()
manageIncidentSituationInfo incidentNo
= viewOrEdit (Icon "basic-information","General","The following general information is known about the situation") situation log
= Icon "basic-information" @>> Title "General" @>> Hint "The following general information is known about the situation" @>>
viewOrEdit situation log
>^* [OnAction (Action "/Share to wall") (always (shareIncident incidentNo))
,OnAction (Action "/Close incident") (always (confirmCloseIncident incidentNo <<@ InWindow))
]
......@@ -51,7 +52,7 @@ where
shareIncident incidentNo = set (WallIncidentSummary (Just incidentNo)) wallContent @! ()
confirmCloseIncident incidentNo
= viewInformation ("Close incident","Are you sure you want to close this incident?") [] ()
= Title "Close incident" @>> Hint "Are you sure you want to close this incident?" @>> viewInformation [] ()
>>* [OnAction ActionYes (always (closeIncident incidentNo))
,OnAction ActionNo (always (return ()))
]
......@@ -69,15 +70,15 @@ where
,(OnAction (Action "/Update status") (ifValue (\c -> c=:(Left _)) (\(Left c) -> updateContactStatus c <<@ InWindow @! ())))
,(OnAction (Action "/Open contact") (ifValue (\c -> c=:(Left _)) (\(Left c) -> openContactInWorkspace ws c)))
]
chooseFromList sel = editSharedChoiceWithSharedAs () [ChooseFromList listView] contacts (Left o contactIdentity) sel
chooseFromList sel = editSharedChoiceWithSharedAs [ChooseFromList listView] contacts (Left o contactIdentity) sel
chooseFromMap sel = viewContactsOnMap (sdsFocus incidentNo contactsByIncidentGeo) sel
listView c=:{Contact|name,type,status,photos}
= ">" <+++ type <+++ ": " <+++ name <+++ " (" <+++ status <+++ ")"
add = oneOrAnother (Title "Add contact..")
("Known contact",enterChoiceWithSharedAs () [ChooseFromDropdown id] allContactsShort contactNo)
("Add new contact",enterInformation () [])
add = Title "Add contact..." @>> oneOrAnother
("Known contact",enterChoiceWithSharedAs [ChooseFromDropdown id] allContactsShort contactNo)
("Add new contact",enterInformation [])
>>? \contact ->
createContactIfNew contact
>>- \contactNo ->
......@@ -90,7 +91,7 @@ where
createContactIfNew (Right c) = createContact c
remove sel
= viewSharedInformation ("Remove contact from incident","Are your sure you want to remove this contact?") [] (mapRead contactTitle (sdsFocus sel contactByNo)) //TODO: Create contactTitle share
= Title "Remove contact from incident" @>> Hint "Are your sure you want to remove this contact?" @>> viewSharedInformation [] (mapRead contactTitle (sdsFocus sel contactByNo)) //TODO: Create contactTitle share
>>* [OnAction ActionNo (always (return ()))
,OnAction ActionYes (always (upd (\cs -> [c \\ c <- map contactIdentity cs | c <> sel]) contacts >>| logContactRemoved incidentNo sel))
]
......@@ -102,11 +103,11 @@ manageIncidentActions incidentNo
@! ()
where
selectAndWorkOnPlannedActions
= (feedForward (chooseActionItem (Title "Overview") False True (sdsFocus incidentNo actionStatusesByIncident) /* <<@ AfterLayout (tweakUI fill) */)
= (feedForward (Title "Overview" @>> chooseActionItem False True (sdsFocus incidentNo actionStatusesByIncident) /* <<@ AfterLayout (tweakUI fill) */)
(\s -> whileUnchanged s
(\t -> case t of
Just taskId = workOnActionItem taskId
Nothing = viewInformation () [] ()
Nothing = viewInformation [] ()
)
)) <<@ (ArrangeWithSideBar 0 LeftSide True) <<@ (Icon "actions") <<@ (Title "Incident Actions") //FIXME
......@@ -114,14 +115,14 @@ manageIncidentWeather :: IncidentNo -> Task ()
manageIncidentWeather incidentNo
= (get webLinksConfig
>>- \webConfig -> case webConfig.weatherWidgets of
Just widgets = (viewWebWeather widgets ||- viewOrEdit (Title "Weather on scene") weather log) <<@ (ArrangeWithSideBar 0 RightSide True)
Nothing = viewOrEdit (Title "Weather on scene") weather log
Just widgets = (viewWebWeather widgets ||- (Title "Weather on scene" @>> viewOrEdit weather log)) <<@ (ArrangeWithSideBar 0 RightSide True)
Nothing = Title "Weather on scene" @>> viewOrEdit weather log
) <<@ Title "Weather" <<@ Icon "weather"
where
weather = sdsFocus incidentNo incidentWeather
log = logIncidentWeatherUpdated incidentNo
viewWebWeather widgets = viewInformation (Title "Web weather info") [] (Html widgets)
viewWebWeather widgets = Title "Web weather info" @>> viewInformation [] (Html widgets)
manageIncidentLog :: IncidentNo -> Task ()
manageIncidentLog incidentNo
......@@ -130,7 +131,7 @@ manageIncidentLog incidentNo
@! ()
where
viewIncidentLog :: IncidentNo -> Task [LogEntry]
viewIncidentLog incident = viewSharedInformation () [ViewAs toView] (sdsFocus incidentNo incidentLog)
viewIncidentLog incident = viewSharedInformation [ViewAs toView] (sdsFocus incidentNo incidentLog)
where
toView log = DivTag [ClassAttr "incident-log"] (flatten [[vizDate date:map vizEntry entries] \\ (date,entries) <- groupByDate log])
......@@ -150,7 +151,7 @@ where
groupByDate log = [(toDate e.eventAt,es) \\ es=:[e:_] <- groupBy (\e1 e2 -> toDate e1.eventAt == toDate e2.eventAt) log]
addMessages incidentNo = forever
( enterInformation () [] @ string
( enterInformation [] @ string
>>* [OnAction (Action "Add log message") (hasValue (\msg -> addLogMessage msg incidentNo))]
)
......@@ -160,18 +161,18 @@ where
viewIncidentDetails :: IncidentNo -> Task ()
viewIncidentDetails incidentNo
= withHeader (viewSharedTitle (sdsFocus incidentNo incidentTitleByNo))
(viewSharedInformation () [] (mapRead incidentDetails incident)) //TODO: Create a more efficient share for the details
(viewSharedInformation [] (mapRead incidentDetails incident)) //TODO: Create a more efficient share for the details
@! ()
where
incident = sdsFocus incidentNo incidentByNo
updateSharedIncidentRefList :: d Bool (Shared sds [IncidentNo]) -> Task [IncidentNo] | toPrompt d & RWShared sds
updateSharedIncidentRefList d compact refs
updateSharedIncidentRefList :: Bool (Shared sds [IncidentNo]) -> Task [IncidentNo] | RWShared sds
updateSharedIncidentRefList compact refs
= manageCurrentItems
>^* [OnAction (Action "Add") (always (addItem <<@ InWindow))]
where
manageCurrentItems
= updateSharedInformation d [UpdateAs toPrj fromPrj] items @ map incidentIdentity
= updateSharedInformation [UpdateSharedAs toPrj fromPrj const] items @ map incidentIdentity
where
items = sdsDeref refs id incidentsByNosShort (\_ is -> is)
toPrj l = [(incidentIdentity i,incidentTitle i) \\i <-l]
......@@ -183,14 +184,14 @@ where
selectKnownOrDefineNewIncident :: Task (Either IncidentNo NewIncident)
selectKnownOrDefineNewIncident
= oneOrAnother ("Add incident...","You can either select an open incident, or define a new one.")
= Title "Add incident..." @>> Hint "You can either select an open incident, or define a new one." @>> oneOrAnother
("Known incident", chooseKnownIncident)
("Add new incident",enterNewIncident)
where
chooseKnownIncident
= enterChoiceWithSharedAs () [ChooseFromDropdown id] openIncidentsShort incidentIdentity
= enterChoiceWithSharedAs [ChooseFromDropdown id] openIncidentsShort incidentIdentity
enterNewIncident
= enterInformation () []
= enterInformation []
createIncidentIfNew :: (Either IncidentNo NewIncident) -> Task IncidentNo
createIncidentIfNew (Left no) = return no
......
......@@ -9,7 +9,7 @@ managePartnerActions :: [Workspace -> Task ()]
managePartnerActions = [welcome,myactions]
where
welcome _
= viewSharedInformation (Title "Welcome") [ViewAs (\u -> "Welcome "+++toString u)] currentUser @! ()
= Title "Welcome" @>> viewSharedInformation [ViewAs (\u -> "Welcome "+++toString u)] currentUser @! ()
myactions _
= get currentUser @ userContactNo
......