Commit 041aef52 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Types] Forest/Tree/Action

parent 36c0e206
......@@ -204,14 +204,14 @@ performAction { reload: (_ /\ setReload)
performAction p@{ reload: (_ /\ setReload)
, session
, tree: (NTree (LNode {id}) _) } (Submit name) = do
, tree: (NTree (LNode {id}) _) } (RenameNode name) = do
void $ renameNode session id $ RenameValue {name}
performAction p RefreshTree
performAction p@{ openNodes: (_ /\ setOpenNodes)
, reload: (_ /\ setReload)
, session
, tree: (NTree (LNode {id}) _) } (CreateSubmit name nodeType) = do
, tree: (NTree (LNode {id}) _) } (AddNode name nodeType) = do
task <- addNode session id $ AddNodeValue {name, nodeType}
liftEffect do
setOpenNodes (Set.insert (mkNodeId session id))
......
......@@ -15,11 +15,11 @@ import Gargantext.Sessions (Session, get, put, post, delete)
import Gargantext.Routes as GR
import Gargantext.Types as GT
data Action = CreateSubmit String GT.NodeType
data Action = AddNode String GT.NodeType
| DeleteNode
| UpdateNode GT.AsyncTaskWithType
| RenameNode String
| SearchQuery GT.AsyncTaskWithType
| Submit String
| UploadFile GT.NodeType FileType (Maybe String) UploadFileContents
| RefreshTree
......
......@@ -125,7 +125,7 @@ addNodeView p@{ dispatch, nodeType, nodeTypes } = R.createElement el p []
, onClick: mkEffectFn1 $ \_ -> do
-- TODO
--setPopupOpen $ const Nothing
launchAff $ dispatch $ CreateSubmit name' nt
launchAff $ dispatch $ AddNode name' nt
} [H.text "Add"]
]
......
......@@ -65,7 +65,7 @@ renameBox p@{ dispatch, renameBoxOpen: (true /\ setRenameBoxOpen) } = R.createEl
, type: "button"
, onClick: mkEffectFn1 $ \_ -> do
setRenameBoxOpen $ const false
launchAff $ dispatch $ Submit newName
launchAff $ dispatch $ RenameNode newName
, title: "Rename"
} []
cancelBtn =
......
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