Commit 7f5bce4a authored by Alexandre Delanoë's avatar Alexandre Delanoë

[REFACT] SubTree: org of files/modules

parent 69f83025
...@@ -8,7 +8,6 @@ import Effect.Aff (Aff) ...@@ -8,7 +8,6 @@ import Effect.Aff (Aff)
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import Gargantext.Components.Forest.Tree.Node.Action (Action) import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.CopyFrom (copyFromCorpusView)
import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete) import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete)
import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc) import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload) import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload)
...@@ -21,6 +20,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload) ...@@ -21,6 +20,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS) import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox, SubTreeParams(..)) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox, SubTreeParams(..))
import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT) import Gargantext.Components.Forest.Tree.Node.Tools (textInputBox, fragmentPT)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView)
import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<)) import Gargantext.Prelude (Unit, bind, const, map, pure, show, ($), (<>), (==), (<))
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID) import Gargantext.Types (Name, ID)
...@@ -240,13 +240,13 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt ...@@ -240,13 +240,13 @@ panelActionCpt = R.hooksComponent "G.C.F.T.N.B.panelAction" cpt
----------- -----------
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams} pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do cpt {action: Move {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams} pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session} _ = do
pure $ copyFromCorpusView {dispatch, id, nodeType, session, subTreeParams} pure $ subTreeView {dispatch, id, nodeType, session, subTreeParams}
----------- -----------
cpt {action : Share, dispatch, id, name } _ = do cpt {action : Share, dispatch, id, name } _ = do
......
module Gargantext.Components.Forest.Tree.Node.Action.CopyFrom where module Gargantext.Components.Forest.Tree.Node.Tools.SubTree where
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Array as A import Data.Array as A
...@@ -24,11 +24,11 @@ type SubTreeParamsProps = ...@@ -24,11 +24,11 @@ type SubTreeParamsProps =
| Props | Props
) )
copyFromCorpusView :: Record SubTreeParamsProps -> R.Element subTreeView :: Record SubTreeParamsProps -> R.Element
copyFromCorpusView props = R.createElement copyFromCorpusViewCpt props [] subTreeView props = R.createElement subTreeViewCpt props []
copyFromCorpusViewCpt :: R.Component SubTreeParamsProps subTreeViewCpt :: R.Component SubTreeParamsProps
copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt subTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeView" cpt
where where
cpt params@{ dispatch cpt params@{ dispatch
, id , id
...@@ -41,7 +41,7 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt ...@@ -41,7 +41,7 @@ copyFromCorpusViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusView" cpt
useLoader session (loadSubTree showtypes) $ useLoader session (loadSubTree showtypes) $
\tree -> \tree ->
copyFromCorpusViewLoaded { dispatch subTreeViewLoaded { dispatch
, id , id
, nodeType , nodeType
, session , session
...@@ -65,23 +65,23 @@ type CorpusTreeProps = ...@@ -65,23 +65,23 @@ type CorpusTreeProps =
| SubTreeParamsProps | SubTreeParamsProps
) )
copyFromCorpusViewLoaded :: Record CorpusTreeProps -> R.Element subTreeViewLoaded :: Record CorpusTreeProps -> R.Element
copyFromCorpusViewLoaded props = R.createElement copyFromCorpusViewLoadedCpt props [] subTreeViewLoaded props = R.createElement subTreeViewLoadedCpt props []
copyFromCorpusViewLoadedCpt :: R.Component CorpusTreeProps subTreeViewLoadedCpt :: R.Component CorpusTreeProps
copyFromCorpusViewLoadedCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusViewLoadedCpt" cpt subTreeViewLoadedCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeViewLoadedCpt" cpt
where where
cpt p@{dispatch, id, nodeType, session, tree} _ = do cpt p@{dispatch, id, nodeType, session, tree} _ = do
pure $ H.div { className: "copy-from-corpus" } pure $ H.div { className: "copy-from-corpus" }
[ H.div { className: "tree" } [ H.div { className: "tree" }
[copyFromCorpusTreeView p] [subTreeTreeView p]
] ]
copyFromCorpusTreeView :: Record CorpusTreeProps -> R.Element subTreeTreeView :: Record CorpusTreeProps -> R.Element
copyFromCorpusTreeView props = R.createElement copyFromCorpusTreeViewCpt props [] subTreeTreeView props = R.createElement subTreeTreeViewCpt props []
copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps subTreeTreeViewCpt :: R.Component CorpusTreeProps
copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt subTreeTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.subTreeTreeViewCpt" cpt
where where
cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary, subTreeParams} _ = do cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary, subTreeParams} _ = do
pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} [] pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} []
...@@ -97,7 +97,7 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi ...@@ -97,7 +97,7 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
SubTreeParams { valitypes } = subTreeParams SubTreeParams { valitypes } = subTreeParams
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary children = map (\c -> subTreeTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType valitypes) && (id /= sourceId) validNodeType = (A.elem nodeType valitypes) && (id /= sourceId)
...@@ -106,8 +106,8 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi ...@@ -106,8 +106,8 @@ copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeVi
onClick _ = case validNodeType of onClick _ = case validNodeType of
false -> pure unit false -> pure unit
true -> do true -> do
log2 "[copyFromCorpusTreeViewCpt] issue copy into" id log2 "[subTreeTreeViewCpt] issue copy into" id
log2 "[copyFromCorpusTreeViewCpt] issue copy from" sourceId log2 "[subTreeTreeViewCpt] issue copy from" sourceId
-------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------
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