Commit a850e699 authored by Bas Lijnse's avatar Bas Lijnse

Moved changes from tests to examples. Lots of funny behaviour to deal with still :)

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@658 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 165c02c7
......@@ -28,8 +28,8 @@ import WebShop
//Crisis response examples
import AmbulanceDispatch
//Administrative tasks
import ProcessAdmin
//Change examples
import SimpleChanges
Start :: *World -> *World
Start world = startEngine workflows world
......@@ -52,5 +52,5 @@ where
, changeHandlingExample
, webShopExample
, ambulanceDispatchExamples
, processAdmin
, changeExamples
]
\ No newline at end of file
module ChangeTest
implementation module SimpleChanges
import iTasks
from TSt import :: Change(..)
from TaskTree import :: TaskProperties(..), :: TaskProgress
from TaskTree import :: TaskProperties(..),::TaskWorkerProperties(..),::TaskManagerProperties(..), :: TaskSystemProperties(..), :: TaskProgress
import Purchase
Start :: *World -> *World
Start world = startEngine tests world
where
tests = [ { name = "Change priorities"
, label = "Change priorities"
, roles = []
, mainTask = changePrio
},
{ name = "Add warning"
, label = "Add warning"
, roles = []
, mainTask = changeWarningTask
},
{ name = "Duplicate task"
, label = "Duplicate task"
, roles = []
, mainTask = duplicateTask
},
{ name = "Do something silly"
, label = "Do something silly"
, roles = []
, mainTask = doSilly
},
{ name = "Do something silly delayed"
, label = "Do something silly delayed"
, roles = []
, mainTask = doSillyDelayed
}
:purchaseExample]
//Very simple task to experiment with changes
doSilly :: Task Void
doSilly = (0 @: ("Root should enter a number", sillyEdit)) -&&- (0 @: ("Root should enter a string", sillyEdit2)) >>= \nr -> showMessageAbout "The result is" nr
where
sillyEdit :: Task Int
sillyEdit = enterInformation "Enter a number"
sillyEdit2 :: Task String
sillyEdit2 = enterInformation "Enter a string"
doSillyDelayed :: Task Void
doSillyDelayed = requestConfirmation "Start with something silly?" >>| doSilly
changeExamples :: [Workflow]
changeExamples =
[ { name = "Examples/Changes/Change priorities"
, label = "Change priorities"
, roles = []
, mainTask = changePrio
},
{ name = "Examples/Changes/Add warning"
, label = "Add warning"
, roles = []
, mainTask = changeWarningTask
},
{ name = "Examples/Changes/Duplicate task"
, label = "Duplicate task"
, roles = []
, mainTask = duplicateTask
}
]
//Simple change which will run once and change the priority of all tasks to high
allImportant :: Dynamic
......@@ -56,15 +30,15 @@ allImportant =
dynamic change :: A.a: Change a | iTask a
where
change :: TaskProperties (Task a) (Task a) -> (Maybe TaskProperties, Maybe (Task a), Maybe Dynamic) | iTask a
change props t t0 = (Just {TaskProperties| props & priority = HighPriority},Just (enterInformation "Just edit the value"), Just allImportant)
change props t t0 = (Just {TaskProperties| props & managerProps = {props.managerProps & priority = HighPriority}},Just (enterInformation "Just edit the value"), Just allImportant)
//Add a big red warning message prompt to the running task
addWarning :: String -> Dynamic
addWarning msg =
dynamic (change msg) :: A.a: Change a | iTask a
where
change :: String TaskProperties (Task a) (Task a) -> (Maybe TaskProperties, Maybe (Task a), Maybe Dynamic) | iTask a
change msg props t t0 = (Nothing, Just (((showStickyMessage (redText msg) >>| return defaultValue) -||- t) <<@ TTVertical), Just (addWarning msg))
change msg props t t0 = (Nothing, Just (((showStickyMessage (redText msg) >>| getDefaultValue) -||- t) <<@ TTVertical), Just (addWarning msg))
redText msg = [DivTag [StyleAttr "color: red; font-size: 30px;"] [Text msg]]
......@@ -75,7 +49,7 @@ duplicate howMany =
where
change :: Int TaskProperties (Task a) (Task a) -> (Maybe TaskProperties, Maybe (Task a), Maybe Dynamic) | iTask a
change howMany p t t0 = (Nothing, Just (anyTask [t \\ i <- [1 .. howMany]]), Just (duplicate howMany) )
//Tests
changePrio :: Task Void
changePrio
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment