Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
23ee97c0
Commit
23ee97c0
authored
Jul 04, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TREE] corpus is selected now from the current route
parent
cf6d459c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
15 deletions
+26
-15
Tree.purs
src/Gargantext/Components/Tree.purs
+23
-12
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+1
-1
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+2
-2
No files found.
src/Gargantext/Components/Tree.purs
View file @
23ee97c0
...
...
@@ -18,12 +18,6 @@ import Effect.Aff (Aff, runAff)
import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..))
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Config (toUrl, End(..), NodeType(..), readNodeType)
import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete)
import Gargantext.Types (class ToQuery, toQuery)
import Gargantext.Utils (id)
import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial)
import React (ReactClass, ReactElement)
import React as React
...
...
@@ -40,12 +34,20 @@ import Web.File.File (toBlob)
import Web.File.FileList (FileList, item)
import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Loader2 (useLoader)
import Gargantext.Config (toUrl, End(..), NodeType(..), readNodeType)
import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete)
import Gargantext.Router as Router
import Gargantext.Types (class ToQuery, toQuery)
import Gargantext.Utils (id)
import Gargantext.Utils.Reactix as R2
type Name = String
type Open = Boolean
type URL = String
type ID = Int
type Props = { root :: ID }
type Props = { root :: ID
, mCurrentRoute :: Maybe Router.Routes
}
data NTree a = NTree a (Array (NTree a))
...
...
@@ -185,7 +187,14 @@ nodeOptionsRename d activated id = case activated of
]
false -> []
type TreeViewProps = { tree :: FTree }
type TreeViewProps = { tree :: FTree, mCurrentRoute :: Maybe Router.Routes }
mCorpusId :: Maybe Router.Routes -> Maybe Int
mCorpusId (Just (Router.Corpus id)) = Just id
mCorpusId (Just (Router.CorpusDocument id _ _)) = Just id
mCorpusId _ = Nothing
loadedTreeview :: Spec State TreeViewProps Action
loadedTreeview = simpleSpec performAction render
...
...
@@ -198,8 +207,10 @@ loadedTreeview = simpleSpec performAction render
]
]
treeViewClass :: ReactClass { tree :: FTree, children :: React.Children }
treeViewClass = createClass "TreeView" loadedTreeview (\{tree} -> {state: tree, currentNode: Nothing})
treeViewClass :: ReactClass { tree :: FTree, mCurrentRoute :: Maybe Router.Routes, children :: React.Children }
treeViewClass = createClass "TreeView" loadedTreeview cpt
where
cpt {tree, mCurrentRoute} = {state: tree, currentNode: mCorpusId mCurrentRoute}
-- loadedTreeView p = R.createElement el p []
-- where
...
...
@@ -217,9 +228,9 @@ treeview = simpleSpec defaultPerformAction render
render _ props _ _ = [R2.scuff $ R.createElement cpt props []]
cpt =
R.hooksComponent "TreeView" \{root} _children ->
R.hooksComponent "TreeView" \{root
, mCurrentRoute
} _children ->
useLoader root loadNode \currentPath loaded ->
R2.buff $ React.createElement treeViewClass {tree: loaded} []
R2.buff $ React.createElement treeViewClass {tree: loaded
, mCurrentRoute
} []
--R2.scuff $ loadedTreeView {tree: loaded}
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
23ee97c0
...
...
@@ -419,7 +419,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
Nothing ->
simpleSpec defaultPerformAction defaultRender
Just treeId ->
(cmapProps (const {root: treeId}) (noState Tree.treeview))
(cmapProps (const {root: treeId
, mCurrentRoute: Nothing
}) (noState Tree.treeview))
render' :: Render State {} Action
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
23ee97c0
...
...
@@ -90,7 +90,7 @@ layout0 layout =
withState \st ->
case st.loginState.authData of
Just (AuthData {tree_id}) ->
ls $ cmapProps (const {root: tree_id}) as
ls $ cmapProps (const {root: tree_id
, mCurrentRoute: st.currentRoute
}) as
Nothing ->
outerLayout1
, rs bs
...
...
@@ -138,7 +138,7 @@ layout1 layout =
[ withState \st ->
case st.loginState.authData of
Just (AuthData {tree_id}) ->
ls $ cmapProps (const {root: tree_id}) as
ls $ cmapProps (const {root: tree_id
, mCurrentRoute: st.currentRoute
}) as
Nothing ->
outerLayout1
, rs bs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment