Commit 12167933 authored by Mart Lubbers's avatar Mart Lubbers

guard the new button so that one cannot open multiple newtask dialogs

parent 1a87c628
Pipeline #31398 passed with stage
in 6 minutes and 54 seconds
...@@ -191,16 +191,22 @@ where ...@@ -191,16 +191,22 @@ where
= get currentUser @ userRoles = get currentUser @ userRoles
>>- \roles -> >>- \roles ->
forever forever
( enterChoiceWithSharedAs [ChooseFromGrid snd] (worklist roles) (appSnd (\{WorklistRow|parentTask} -> isNothing parentTask)) ( (enterChoiceWithSharedAs [ChooseFromGrid snd] (worklist roles) (appSnd (\{WorklistRow|parentTask} -> isNothing parentTask)) @? tvToMaybe)
>>* (continuations roles taskList) -&&- watch (sdsFocus {gDefault{|*|} & includeAttributes=True} taskList)
>>* continuations roles taskList
) )
worklist roles = if (isMember "admin" roles) allWork myWork worklist roles = if (isMember "admin" roles) allWork myWork
continuations roles taskList = if (isMember "manager" roles) [new,open,delete] [open] continuations roles taskList = if (isMember "manager" roles) [new,open,delete] [open]
where where
new = OnAction (Action "New") (always (appendTask Embedded (removeWhenStable (addNewTask taskList <<@ InWindow <<@ AddCSSClass "new-work-window")) taskList @! () )) new = OnAction (Action "New")
open = OnAction (Action "Open") (hasValue (\(taskId,_) -> openTask taskList taskId @! ())) $ ifValue (\(_, (_, tlitems))->isEmpty [()\\tli<-tlitems | isJust $ 'DM'.get "manageWork:open" tli.TaskListItem.attributes])
delete = OnAction (Action "Delete") (ifValue (\x -> snd x || isMember "admin" roles) (\(taskId,_) -> removeTask taskId topLevelTasks @! ())) \_->appendTask Embedded (removeWhenStable $ addNewTask taskList <<@ InWindow <<@ AddCSSClass "new-work-window" <<@ ("manageWork:open", JSONNull)) taskList @! ()
open = OnAction (Action "Open")
$ ifValue (isJust o fst) \(Just (taskId, _), _)->openTask taskList taskId @! ()
delete = OnAction (Action "Delete")
$ ifValue (\(x, _) -> isJust x && snd (fromJust x) || isMember "admin" roles)
\(Just (taskId, _), _) -> removeTask taskId topLevelTasks @! ()
userRoles (AuthenticatedUser _ roles _) = roles userRoles (AuthenticatedUser _ roles _) = roles
userRoles _ = [] userRoles _ = []
......
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