Commit df85b918 authored by Mart Lubbers's avatar Mart Lubbers

improve on UI handling in steps

parent bc3b83a1
Pipeline #29673 passed with stage
in 4 minutes and 35 seconds
...@@ -119,12 +119,10 @@ where ...@@ -119,12 +119,10 @@ where
(ExceptionResult e, iworld) = (ExceptionResult e, iworld) (ExceptionResult e, iworld) = (ExceptionResult e, iworld)
(ValueResult _ _ _ _,iworld) = (ExceptionResult (exception "Failed destroying lhs in step"), iworld) (ValueResult _ _ _ _,iworld) = (ExceptionResult (exception "Failed destroying lhs in step"), iworld)
//Execute lhs //Execute lhs
evalleft (Task lhs) prevEnabledActions leftTaskId event evalOpts=:{lastEval,taskId=taskId=:(TaskId ino tano)} iworld evalleft lhs prevEnabledActions leftTaskId event evalOpts=:{lastEval,taskId=taskId=:(TaskId ino tano)} iworld
# mbAction = matchAction taskId event = case (unTask lhs) event {TaskEvalOpts|evalOpts&taskId=leftTaskId} iworld of
# (res, iworld) = lhs event {TaskEvalOpts|evalOpts&taskId=leftTaskId} iworld (ValueResult val info rep lhs, iworld)
// Right is a step # mbAction = matchAction taskId event
# (mbCont, iworld) = case res of
ValueResult val info rep lhs
= case searchContValue val mbAction conts of = case searchContValue val mbAction conts of
//No match //No match
Nothing Nothing
...@@ -133,32 +131,23 @@ where ...@@ -133,32 +131,23 @@ where
# actions = contActions taskId val conts # actions = contActions taskId val conts
# curEnabledActions = [actionId action \\ action <- actions | isEnabled action] # curEnabledActions = [actionId action \\ action <- actions | isEnabled action]
# sl = wrapStepUI taskId evalOpts event actions prevEnabledActions val rep # sl = wrapStepUI taskId evalOpts event actions prevEnabledActions val rep
= (Left (ValueResult = ( ValueResult value info sl (Task (evalleft lhs curEnabledActions leftTaskId))
value , iworld)
info
sl
(Task (evalleft lhs curEnabledActions leftTaskId))
)
, iworld)
//A match //A match
Just rewrite Just (_, rewrite, _)
//Send a destroyevent to the lhs //Send a destroyevent to the lhs
# (_, iworld) = (unTask lhs) DestroyEvent {TaskEvalOpts|evalOpts&taskId=leftTaskId} iworld # (_, iworld) = (unTask lhs) DestroyEvent {TaskEvalOpts|evalOpts&taskId=leftTaskId} iworld
= (Right (rewrite, info.TaskEvalInfo.lastEvent, info.TaskEvalInfo.removedTasks), iworld) # info = {TaskEvalInfo|lastEvent=info.TaskEvalInfo.lastEvent, removedTasks=info.TaskEvalInfo.removedTasks}
ExceptionResult e //Continue with the rhs and force the first event to be a Reset, it would've been the queued refresh
= ( ValueResult NoValue info rep (Task (\_->(unTask rewrite) ResetEvent))
, queueEvent ino (RefreshEvent ('DS'.singleton taskId) "step") iworld)
(ExceptionResult e, iworld)
= case searchContException e conts of = case searchContException e conts of
//No match //No match, re-throw exception
Nothing = (Left (ExceptionResult e), iworld) Nothing = (ExceptionResult e, iworld)
//A match //A match, rewrite
Just rewrite = (Right (rewrite, lastEval, []), iworld) Just (_, rewrite, _)
= case mbCont of = (ValueResult NoValue (mkTaskEvalInfo lastEval) NoChange rewrite, iworld)
//No match, just pass through
Left res = (res, iworld)
//A match, continue with the matched rhs
Right ((_, (Task rhs), _), lastEval, removedTasks)
# info = {TaskEvalInfo|lastEvent=lastEval, removedTasks=removedTasks}
= (ValueResult NoValue info NoChange (Task (\_->rhs ResetEvent))
, queueEvent ino (RefreshEvent ('DS'.singleton taskId) "step") iworld)
wrapStepUI taskId evalOpts event actions prevEnabled val change wrapStepUI taskId evalOpts event actions prevEnabled val change
| actionUIs =: [] | actionUIs =: []
...@@ -167,7 +156,7 @@ where ...@@ -167,7 +156,7 @@ where
= ReplaceUI (UI type (addClassAttr "step" attributes) items) = ReplaceUI (UI type (addClassAttr "step" attributes) items)
_ _
= change = change
| otherwise //Wrap in a container | otherwise //Wrap in a container
= case (event,change) of = case (event,change) of
(ResetEvent,ReplaceUI ui) //On reset generate a new step UI (ResetEvent,ReplaceUI ui) //On reset generate a new step UI
= ReplaceUI (uiac UIContainer (classAttr ["step-actions"]) [ui:actionUIs]) = ReplaceUI (uiac UIContainer (classAttr ["step-actions"]) [ui:actionUIs])
......
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