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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
66ba4368
Commit
66ba4368
authored
Sep 30, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tree links (hopefully)
parent
a7f06511
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
26 deletions
+38
-26
App.purs
src/Gargantext/Components/App.purs
+1
-1
Forest.purs
src/Gargantext/Components/Forest.purs
+1
-1
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+7
-6
Tree.purs
src/Gargantext/Components/Tree.purs
+23
-17
Ends.purs
src/Gargantext/Ends.purs
+6
-1
No files found.
src/Gargantext/Components/App.purs
View file @
66ba4368
...
...
@@ -71,7 +71,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
tree $ documentLayout { nodeId, listId, session, corpusId: Nothing }
PGraphExplorer graphId ->
simpleLayout (fst sessions) $
explorerLayout { graphId, mCurrentRoute, session, treeId: Nothing }
explorerLayout { graphId, mCurrentRoute, session, treeId: Nothing
, frontends
}
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element
forestLayout frontends sessions route showLogin child =
...
...
src/Gargantext/Components/Forest.purs
View file @
66ba4368
...
...
@@ -31,7 +31,7 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
Just s@(Session {treeId}) ->
R.fragment
[ H.text (show s)
, treeView { root: treeId, mCurrentRoute: Just route, session: s } ]
, treeView { root: treeId,
frontends,
mCurrentRoute: Just route, session: s } ]
plus :: R2.Setter Boolean -> R.Element
plus showLogin = H.button {on: {click}} [ H.text "+" ]
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
66ba4368
...
...
@@ -23,7 +23,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Graph as Graph
import Gargantext.Components.Tree as Tree
import Gargantext.Config.REST (get)
import Gargantext.Ends (url)
import Gargantext.Ends (
Frontends,
url)
import Gargantext.Routes (SessionRoute(NodeAPI), AppRoute)
import Gargantext.Sessions (Session)
import Gargantext.Types (NodeType(Graph))
...
...
@@ -34,7 +34,8 @@ type LayoutProps =
( graphId :: GraphId
, mCurrentRoute :: Maybe AppRoute
, treeId :: Maybe Int
, session :: Session )
, session :: Session
, frontends :: Frontends )
type Props = ( graph :: Maybe Graph.Graph | LayoutProps )
...
...
@@ -45,10 +46,10 @@ explorerLayout props = R.createElement explorerLayoutCpt props []
explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = R.hooksComponent "G.C.GraphExplorer.explorerLayout" cpt
where
cpt {graphId, mCurrentRoute, treeId, session} _ =
cpt {graphId, mCurrentRoute, treeId, session
, frontends
} _ =
useLoader graphId (getNodes session) handler
where
handler loaded = explorer {graphId, mCurrentRoute, treeId, session, graph}
handler loaded = explorer {graphId, mCurrentRoute, treeId, session, graph
, frontends
}
where graph = Just (convert loaded)
explorer :: Record Props -> R.Element
...
...
@@ -57,7 +58,7 @@ explorer props = R.createElement explorerCpt props []
explorerCpt :: R.Component Props
explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
where
cpt {session, graphId, mCurrentRoute, treeId, graph} _ = do
cpt {session, graphId, mCurrentRoute, treeId, graph
, frontends
} _ = do
controls <- Controls.useGraphControls
state <- useExplorerState
pure $
...
...
@@ -87,7 +88,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
tree _ {showTree: false /\ _} = RH.div { id: "tree" } []
tree {mCurrentRoute: m, treeId: Just root} _ =
RH.div { id: "tree", className: "col-md-2" }
[ Tree.treeView {
mCurrentRoute: m, root
, session: session} ]
[ Tree.treeView {
frontends, root, mCurrentRoute: m
, session: session} ]
outer = RH.div { className: "col-md-12" }
inner = RH.div { className: "container-fluid", style: { paddingTop: "90px" } }
row1 = RH.div { className: "row", style: { paddingBottom: "10px", marginTop: "-24px" } }
...
...
src/Gargantext/Components/Tree.purs
View file @
66ba4368
...
...
@@ -27,7 +27,7 @@ import Web.File.FileList (FileList, item)
import Web.File.FileReader.Aff (readAsText)
import Gargantext.Config.REST (get, put, post, postWwwUrlencoded, delete)
import Gargantext.Ends (url)
import Gargantext.Ends (
Frontends(..),
url)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as Routes
import Gargantext.Routes (AppRoute, SessionRoute(..))
...
...
@@ -44,11 +44,12 @@ type Reload = Int
data NodePopup = CreatePopup | NodePopup
type Props = ( root :: ID, mCurrentRoute :: Maybe AppRoute, session :: Session )
type Props = ( root :: ID, mCurrentRoute :: Maybe AppRoute, session :: Session
, frontends :: Frontends
)
type TreeViewProps =
( tree :: FTree
, mCurrentRoute :: Maybe AppRoute
, frontends :: Frontends
, session :: Session )
data NTree a = NTree a (Array (NTree a))
...
...
@@ -92,11 +93,15 @@ type FTree = NTree LNode
-- file upload types
data FileType = CSV | PresseRIS
derive instance genericFileType :: Generic FileType _
instance eqFileType :: Eq FileType where
eq = genericEq
instance showFileType :: Show FileType where
show = genericShow
readFileType :: String -> Maybe FileType
readFileType "CSV" = Just CSV
readFileType "PresseRIS" = Just PresseRIS
...
...
@@ -161,24 +166,24 @@ treeLoadView :: R.State Reload -> Record Props -> R.Element
treeLoadView reload p = R.createElement el p []
where
el = R.hooksComponent "TreeLoadView" cpt
cpt {root, mCurrentRoute, session} _ = do
cpt {root, mCurrentRoute, session
, frontends
} _ = do
useLoader root (loadNode session) $ \loaded ->
loadedTreeView reload {tree: loaded, mCurrentRoute, session}
loadedTreeView reload {tree: loaded, mCurrentRoute, session
, frontends
}
loadedTreeView :: R.State Reload -> Record TreeViewProps -> R.Element
loadedTreeView reload p = R.createElement el p []
where
el = R.hooksComponent "LoadedTreeView" cpt
cpt {tree, mCurrentRoute, session} _ = do
cpt {tree, mCurrentRoute, session
, frontends
} _ = do
treeState <- R.useState' {tree}
pure $ H.div {className: "tree"}
[ toHtml reload treeState session mCurrentRoute ]
[ toHtml reload treeState session
frontends
mCurrentRoute ]
-- START toHtml
toHtml :: R.State Reload -> R.State Tree -> Session -> Maybe AppRoute -> R.Element
toHtml reload treeState@({tree: (NTree (LNode {id, name, nodeType}) ary)} /\ _) session mCurrentRoute = R.createElement el {} []
toHtml :: R.State Reload -> R.State Tree -> Session ->
Frontends ->
Maybe AppRoute -> R.Element
toHtml reload treeState@({tree: (NTree (LNode {id, name, nodeType}) ary)} /\ _) session
frontends
mCurrentRoute = R.createElement el {} []
where
el = R.hooksComponent "NodeView" cpt
pAction = performAction session reload treeState
...
...
@@ -189,8 +194,8 @@ toHtml reload treeState@({tree: (NTree (LNode {id, name, nodeType}) ary)} /\ _)
pure $ H.ul {}
[ H.li {}
( [ nodeMainSpan pAction {id, name, nodeType, mCurrentRoute} folderOpen session ]
<> childNodes session reload folderOpen mCurrentRoute ary
( [ nodeMainSpan pAction {id, name, nodeType, mCurrentRoute} folderOpen session
frontends
]
<> childNodes session
frontends
reload folderOpen mCurrentRoute ary
)
]
...
...
@@ -204,8 +209,9 @@ nodeMainSpan :: (Action -> Aff Unit)
-> Record NodeMainSpanProps
-> R.State Boolean
-> Session
-> Frontends
-> R.Element
nodeMainSpan d p folderOpen session = R.createElement el p []
nodeMainSpan d p folderOpen session
(Frontends frontends)
= R.createElement el p []
where
el = R.hooksComponent "NodeMainSpan" cpt
cpt {id, name, nodeType, mCurrentRoute} _ = do
...
...
@@ -216,7 +222,7 @@ nodeMainSpan d p folderOpen session = R.createElement el p []
pure $ H.span (dropProps droppedFile isDragOver)
[ folderIcon folderOpen
, H.a { href: (url
session
(NodePath nodeType (Just id)))
, H.a { href: (url
frontends.app
(NodePath nodeType (Just id)))
, style: {marginLeft: "22px"}
}
[ nodeText {isSelected: (mCorpusId mCurrentRoute) == (Just id), name} ]
...
...
@@ -267,17 +273,17 @@ fldr :: Boolean -> String
fldr open = if open then "glyphicon glyphicon-folder-open" else "glyphicon glyphicon-folder-close"
childNodes :: Session -> R.State Reload -> R.State Boolean -> Maybe AppRoute -> Array FTree -> Array R.Element
childNodes _ _ _ _ [] = []
childNodes _ _ (false /\ _) _ _ = []
childNodes session reload (true /\ _) mCurrentRoute ary = map (\ctree -> childNode {tree: ctree}) ary
childNodes :: Session ->
Frontends ->
R.State Reload -> R.State Boolean -> Maybe AppRoute -> Array FTree -> Array R.Element
childNodes _ _ _ _
_
[] = []
childNodes _ _
_
(false /\ _) _ _ = []
childNodes session
frontends
reload (true /\ _) mCurrentRoute ary = map (\ctree -> childNode {tree: ctree}) ary
where
childNode :: Tree -> R.Element
childNode props = R.createElement el props []
el = R.hooksComponent "ChildNodeView" cpt
cpt {tree} _ = do
treeState <- R.useState' {tree}
pure $ toHtml reload treeState session mCurrentRoute
pure $ toHtml reload treeState session
frontends
mCurrentRoute
-- END toHtml
...
...
src/Gargantext/Ends.purs
View file @
66ba4368
...
...
@@ -9,7 +9,9 @@ import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe, maybe)
import Gargantext.Routes as R
import Gargantext.Types (ApiVersion, Limit, NodeType(..), Offset, TabType(..), TermSize(..), nodeTypePath, showTabType')
import Gargantext.Types
( ApiVersion, Limit, NodePath, NodeType(..), Offset, TabType(..)
, TermSize(..), nodePath, nodeTypePath, showTabType')
-- | A means of generating a url to visit, a destination
class ToUrl conf p where
...
...
@@ -55,6 +57,9 @@ derive instance genericFrontend :: Generic Frontend _
instance eqFrontend :: Eq Frontend where
eq = genericEq
instance toUrlFrontendNodePath :: ToUrl Frontend NodePath where
toUrl front np = frontendUrl front (nodePath np)
-- | Creates a frontend
frontend :: String -> String -> String -> Frontend
frontend baseUrl prePath name = Frontend { name, baseUrl, prePath }
...
...
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