Commit 2ba91fc2 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[REFACT] Forest.Tree.Action split delete

parent 2bd26184
...@@ -9,9 +9,10 @@ import Data.Tuple.Nested ((/\)) ...@@ -9,9 +9,10 @@ import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest.Tree.Node.Action (Action(..),deleteNode) import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode) import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
import Gargantext.Components.Forest.Tree.Node.Action.CopyFrom (loadNode) import Gargantext.Components.Forest.Tree.Node.Action.CopyFrom (loadNode)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (deleteNode)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), rename) import Gargantext.Components.Forest.Tree.Node.Action.Rename (RenameValue(..), rename)
import Gargantext.Components.Forest.Tree.Node.Action.Share (ShareValue(..), share) import Gargantext.Components.Forest.Tree.Node.Action.Share (ShareValue(..), share)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile) import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
......
...@@ -31,8 +31,8 @@ data Action = AddNode String GT.NodeType ...@@ -31,8 +31,8 @@ data Action = AddNode String GT.NodeType
| ShareNode String | ShareNode String
instance showShow :: Show Action where instance showShow :: Show Action where
show DeleteNode = "DeleteNode" show DeleteNode = "DeleteNode"
show RefreshTree = "RefreshTree" show RefreshTree = "RefreshTree"
show (ShareNode _) = "ShareNode" show (ShareNode _) = "ShareNode"
show (UpdateNode _) = "UpdateNode" show (UpdateNode _) = "UpdateNode"
show (RenameNode _) = "RenameNode" show (RenameNode _) = "RenameNode"
...@@ -42,9 +42,9 @@ instance showShow :: Show Action where ...@@ -42,9 +42,9 @@ instance showShow :: Show Action where
----------------------------------------------------------------------- -----------------------------------------------------------------------
icon :: Action -> String icon :: Action -> String
icon DeleteNode = "trash" icon DeleteNode = "trash"
icon (AddNode _ _) = "plus" icon (AddNode _ _) = "plus"
icon _ = "hand-o-right" icon _ = "hand-o-right"
text :: Action -> String text :: Action -> String
text DeleteNode = "Delete !" text DeleteNode = "Delete !"
...@@ -59,10 +59,6 @@ text (ShareNode _) = "Share !" ...@@ -59,10 +59,6 @@ text (ShareNode _) = "Share !"
-- TODO move code below elsewhere -- TODO move code below elsewhere
-- TODO Delete with asyncTaskWithType
deleteNode :: Session -> GT.ID -> Aff GT.ID
deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
data FileType = CSV | CSV_HAL | WOS | PresseRIS data FileType = CSV | CSV_HAL | WOS | PresseRIS
derive instance genericFileType :: Generic FileType _ derive instance genericFileType :: Generic FileType _
......
module Gargantext.Components.Forest.Tree.Node.Action.Delete
where
import Data.Maybe (Maybe(..))
import Gargantext.Prelude
import Effect.Aff (Aff)
import Gargantext.Types as GT
import Gargantext.Sessions (Session, delete)
import Gargantext.Routes (SessionRoute(..))
-- TODO Delete with asyncTaskWithType
deleteNode :: Session -> GT.ID -> Aff GT.ID
deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
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