Commit 0e052718 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] List import tree (TODO: use same existing tree but filtered)

parent e56e5cce
...@@ -335,14 +335,16 @@ copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps ...@@ -335,14 +335,16 @@ copyFromCorpusTreeViewCpt :: R.Component CorpusTreeProps
copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt copyFromCorpusTreeViewCpt = R.hooksComponent "G.C.F.T.N.A.U.copyFromCorpusTreeViewCpt" cpt
where where
cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary} _ = do cpt p@{id, tree: NTree (LNode { id: sourceId, name, nodeType }) ary} _ = do
pure $ H.div { className: "node" } ([ pure $ {- H.div {} [ H.h5 { className: GT.fldr nodeType true} []
H.span { className: "name " <> clickable , -} H.div { className: "node" } ([ H.span { className: "name " <> clickable
, on: { click: onClick } , on: { click: onClick }
} [ H.text name ] } [ H.text name ]
] <> children) ] <> children)
-- ]
where where
children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary children = map (\c -> copyFromCorpusTreeView (p { tree = c })) ary
validNodeType = (A.elem nodeType [GT.Corpus, GT.NodeList]) && (id /= sourceId) validNodeType = (A.elem nodeType [GT.NodeList]) && (id /= sourceId)
clickable = if validNodeType then "clickable" else "" clickable = if validNodeType then "clickable" else ""
onClick _ = case validNodeType of onClick _ = case validNodeType of
false -> pure unit false -> pure unit
...@@ -356,4 +358,12 @@ loadCorporaTree session = getCorporaTree session treeId ...@@ -356,4 +358,12 @@ loadCorporaTree session = getCorporaTree session treeId
Session { treeId } = session Session { treeId } = session
getCorporaTree :: Session -> Int -> Aff FTree getCorporaTree :: Session -> Int -> Aff FTree
getCorporaTree session treeId = get session $ GR.NodeAPI GT.Tree (Just treeId) "?type=NodeList&type=NodeCorpus" getCorporaTree session treeId = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" [ GT.FolderPrivate
, GT.FolderShared
, GT.Team
, GT.FolderPublic
, GT.Folder
, GT.Corpus
, GT.NodeList]
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