Commit 1f5824f4 authored by Bas Lijnse's avatar Bas Lijnse

Added task values to task service

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1135 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent f81ad34f
......@@ -55,6 +55,9 @@ makeInformationTask question initial context actions actionStored tst=:{taskNr,
= case treeType of
SpineTree
= (TaskBusy,tst)
JSONTree
# tst = setJSONValue (toJSON ovalue) tst
= (TaskBusy,tst)
UITree
# (anyEvent,tst) = anyEvents tst
| newTask || not anyEvent
......
......@@ -9,9 +9,6 @@ import TaskPanel
derive bimap (,), Maybe
//derive JSONEncode Process, Menu, MenuItem, Hotkey, Key, Action
//Additional derives for debugging
derive JSONEncode TaskParallelInfo, TaskInfo
derive JSONEncode GroupActionsBehaviour, GroupedBehaviour
......@@ -46,10 +43,6 @@ JSONEncode{|TaskOutput|} fx (JSONOutput v) = [v]
JSONEncode{|InteractiveTask|} _ = [JSONNull]
//JSONEncode{|Timestamp|} (Timestamp x) = JSONEncode{|*|} x
//JSONDecode{|Timestamp|} [JSONInt x:c] = (Just (Timestamp x),c)
taskService :: !String !Bool ![String] !HTTPRequest *TSt -> (!HTTPResponse, !*TSt)
taskService url html path req tst
# (mbSessionErr,tst) = initSession sessionParam tst
......@@ -100,7 +93,9 @@ taskService url html path req tst
Nothing
= (notFoundResponse req, tst)
Just proc
# json = JSONObject [("success",JSONBool True),("task",toJSON (taskItem proc))]
# (tree,tst) = calculateTaskTree taskId JSONTree [] tst
# task = JSONObject (taskProperties proc ++ [("parts", JSONArray (taskParts tree))])
# json = JSONObject [("success",JSONBool True),("task",task)]
= (serviceResponse html "Task details" detailsDescription url detailsParams json, tst)
//Dump the raw tasktree datastructure
[taskId,"debug"]
......@@ -287,6 +282,17 @@ where
False
= (JSONObject [("success", JSONBool False),("error", JSONString ("Cannot update '"+++param+++"' property"))],tst)
taskProperties :: Process -> [(String,JSONNode)]
taskProperties proc = case (toJSON proc.Process.properties) of (JSONObject fields) = fields
taskParts :: TaskTree -> [JSONNode]
taskParts (TTMainTask _ _ _ _ tree) = taskParts tree
taskParts (TTSequenceTask _ trees) = flatten (map taskParts trees)
taskParts (TTParallelTask _ _ trees) = flatten (map taskParts trees)
taskParts (TTGroupedTask _ trees _ _) = flatten (map taskParts trees)
taskParts (TTInteractiveTask ti val)
= [JSONObject [("taskId",JSONString ti.TaskInfo.taskId),("type",JSONString "interactive"),("value",case val of JSONOutput json = json; _ = JSONNull)]]
taskParts _ = []
listDescription :== "This service lists all tasks for the user of the provided session."
listDebugDescription :== "This service dumps all information currently in the process database of running instances."
detailsDescription :== "This service provides all meta-properties of a running task instance."
......
......@@ -377,6 +377,8 @@ setStatus :: ![HtmlTag] !*TSt -> *TSt //Only for monitor tasks
setGroupActions :: ![(Action, (Either Bool (*TSt -> *(!Bool,!*TSt))))] !*TSt -> *TSt //Only for group tasks
setFocusCommand :: !String !*TSt -> *TSt //Only for group tasks
setJSONValue :: !JSONNode !*TSt -> *TSt
//EVENTS
/**
* Get the events (name/value pairs) for the current task
......
......@@ -831,6 +831,11 @@ setFocusCommand tag tst=:{tree}
(TTGroupedTask info tasks actions _) = {tst & tree = TTGroupedTask info tasks actions (Just tag)}
_ = tst
setJSONValue :: !JSONNode !*TSt -> *TSt
setJSONValue json tst=:{tree}
= case tree of
(TTInteractiveTask info _) = {tst & tree = TTInteractiveTask info (JSONOutput json)}
/**
* Store and load the result of a workflow instance
*/
......
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