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
141
Issues
141
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
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
8e0b5f8d
Commit
8e0b5f8d
authored
Oct 02, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[READING+FEAT] Forest in Graph Explorer.
parent
b7e624dc
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
192 additions
and
163 deletions
+192
-163
App.purs
src/Gargantext/Components/App.purs
+20
-17
Forest.purs
src/Gargantext/Components/Forest.purs
+9
-6
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+21
-19
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+16
-17
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+8
-8
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+3
-3
RandomText.purs
src/Gargantext/Components/RandomText.purs
+1
-1
Tree.purs
src/Gargantext/Components/Tree.purs
+23
-14
Config.purs
src/Gargantext/Config.purs
+5
-5
Ends.purs
src/Gargantext/Ends.purs
+3
-3
Loader.purs
src/Gargantext/Hooks/Loader.purs
+16
-7
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+6
-6
Document.purs
src/Gargantext/Pages/Corpus/Document.purs
+19
-19
Home.purs
src/Gargantext/Pages/Home.purs
+2
-1
Lists.purs
src/Gargantext/Pages/Lists.purs
+3
-3
Texts.purs
src/Gargantext/Pages/Texts.purs
+1
-1
Router.purs
src/Gargantext/Router.purs
+15
-12
Routes.purs
src/Gargantext/Routes.purs
+16
-16
Sessions.purs
src/Gargantext/Sessions.purs
+3
-3
Spec.purs
test/Gargantext/Components/NgramsTable/Spec.purs
+2
-2
No files found.
src/Gargantext/Components/App.purs
View file @
8e0b5f8d
...
@@ -41,13 +41,15 @@ appCpt :: R.Component ()
...
@@ -41,13 +41,15 @@ appCpt :: R.Component ()
appCpt = R.hooksComponent "G.C.App.app" cpt where
appCpt = R.hooksComponent "G.C.App.app" cpt where
frontends = defaultFrontends
frontends = defaultFrontends
cpt _ _ = do
cpt _ _ = do
sessions <- useSessions
sessions <- useSessions
route <- useHashRouter router Home
route <- useHashRouter router Home
showLogin <- R.useState' false
showLogin <- R.useState' false
showCorpus <- R.useState' false
showCorpus <- R.useState' false
let tree = forestLayout frontends (fst sessions) (fst route) (snd showLogin)
let mCurrentRoute = Just $ fst route
let tree = forestLayout frontends (fst sessions) (fst route) (snd showLogin)
let backends = fromFoldable defaultBackends
let mCurrentRoute = fst route
let backends = fromFoldable defaultBackends
pure $ case fst showLogin of
pure $ case fst showLogin of
true -> tree $ login { sessions, backends, visible: showLogin }
true -> tree $ login { sessions, backends, visible: showLogin }
false ->
false ->
...
@@ -55,15 +57,15 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -55,15 +57,15 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
Nothing -> tree $ homeLayout EN
Nothing -> tree $ homeLayout EN
Just session ->
Just session ->
case (fst route) of
case (fst route) of
Home -> tree $ homeLayout EN
Home
-> tree $ homeLayout EN
Login -> login { sessions, backends, visible: showLogin }
Login
-> login { sessions, backends, visible: showLogin }
Folder _ -> tree $ folder {}
Folder _ -> tree $ folder {}
Corpus nodeId -> tree $ corpusLayout { nodeId }
Corpus nodeId -> tree $ corpusLayout { nodeId }
Texts nodeId -> tree $ textsLayout { nodeId, session }
Texts
nodeId -> tree $ textsLayout { nodeId, session }
Lists nodeId -> tree $ listsLayout { nodeId, session }
Lists
nodeId -> tree $ listsLayout { nodeId, session }
Dashboard -> tree $ dashboardLayout {}
Dashboard
_nodeId
-> tree $ dashboardLayout {}
Annuaire
annuaireId -> tree $ annuaireLayout { annuair
eId, session }
Annuaire
nodeId -> tree $ annuaireLayout { nod
eId, session }
UserPage nodeId -> tree $ userLayout { nodeId, session }
UserPage
nodeId -> tree $ userLayout { nodeId, session }
ContactPage nodeId -> tree $ userLayout { nodeId, session }
ContactPage nodeId -> tree $ userLayout { nodeId, session }
CorpusDocument corpusId listId nodeId ->
CorpusDocument corpusId listId nodeId ->
tree $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
tree $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
...
@@ -71,7 +73,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -71,7 +73,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
tree $ documentLayout { nodeId, listId, session, corpusId: Nothing }
tree $ documentLayout { nodeId, listId, session, corpusId: Nothing }
PGraphExplorer graphId ->
PGraphExplorer graphId ->
simpleLayout (fst sessions) $
simpleLayout (fst sessions) $
explorerLayout { graphId, mCurrentRoute, session, treeId: Nothing, frontends
}
explorerLayout { graphId, mCurrentRoute, session, treeId: Nothing, frontends}
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element
forestLayout :: Frontends -> Sessions -> AppRoute -> R2.Setter Boolean -> R.Element -> R.Element
forestLayout frontends sessions route showLogin child =
forestLayout frontends sessions route showLogin child =
...
@@ -81,8 +83,9 @@ forestLayout frontends sessions route showLogin child =
...
@@ -81,8 +83,9 @@ forestLayout frontends sessions route showLogin child =
main =
main =
R.fragment
R.fragment
[ H.div {className: "col-md-2", style: {paddingTop: "60px"}}
[ H.div {className: "col-md-2", style: {paddingTop: "60px"}}
[ forest {sessions, route, frontends, showLogin} ]
[ forest {sessions, route, frontends, showLogin} ]
, mainPage child ]
, mainPage child
]
-- Simple layout does not accommodate the tree
-- Simple layout does not accommodate the tree
simpleLayout :: Sessions -> R.Element -> R.Element
simpleLayout :: Sessions -> R.Element -> R.Element
...
@@ -218,7 +221,7 @@ liNav (LiNav { title : title'
...
@@ -218,7 +221,7 @@ liNav (LiNav { title : title'
footer :: {} -> R.Element
footer :: {} -> R.Element
footer props = R.createElement footerCpt props []
footer props = R.createElement footerCpt props []
footerCpt :: R.Component ()
footerCpt :: R.Component ()
footerCpt = R.staticComponent "G.C.Layout.footer" cpt
footerCpt = R.staticComponent "G.C.Layout.footer" cpt
where
where
cpt _ _ =
cpt _ _ =
...
...
src/Gargantext/Components/Forest.purs
View file @
8e0b5f8d
module Gargantext.Components.Forest where
module Gargantext.Components.Forest where
import Prelude (const, show
, discard
)
import Prelude (const, show)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import DOM.Simple.Console (log)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
...
@@ -12,8 +11,8 @@ import Gargantext.Components.Tree (treeView)
...
@@ -12,8 +11,8 @@ import Gargantext.Components.Tree (treeView)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
type Props =
type Props =
( sessions :: Sessions
( sessions
:: Sessions
, route :: AppRoute
, route
:: AppRoute
, frontends :: Frontends
, frontends :: Frontends
, showLogin :: R2.Setter Boolean )
, showLogin :: R2.Setter Boolean )
...
@@ -31,8 +30,12 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
...
@@ -31,8 +30,12 @@ forestCpt = R.staticComponent "G.C.Forest.forest" cpt where
Just s@(Session {treeId}) ->
Just s@(Session {treeId}) ->
R.fragment
R.fragment
[ H.text (show s)
[ H.text (show s)
, treeView { root: treeId, frontends, mCurrentRoute: Just route, session: s } ]
, treeView { root: treeId
, frontends
, mCurrentRoute: Just route
, session: s }
]
plus :: R2.Setter Boolean -> R.Element
plus :: R2.Setter Boolean -> R.Element
plus showLogin = H.button {on: {click}} [ H.text "+" ]
plus showLogin = H.button {on: {click}} [ H.text "+" ]
where
where
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
8e0b5f8d
...
@@ -7,7 +7,7 @@ import Data.Foldable (foldMap)
...
@@ -7,7 +7,7 @@ import Data.Foldable (foldMap)
import Data.Int (toNumber)
import Data.Int (toNumber)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Tuple (fst)
import Data.Tuple (fst
,snd
)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
...
@@ -21,25 +21,27 @@ import Gargantext.Components.GraphExplorer.Sidebar as Sidebar
...
@@ -21,25 +21,27 @@ import Gargantext.Components.GraphExplorer.Sidebar as Sidebar
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Graph as Graph
import Gargantext.Components.Graph as Graph
import Gargantext.Components.
Tree as Tree
import Gargantext.Components.
Forest (forest)
import Gargantext.Config.REST (get)
import Gargantext.Config.REST (get)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Routes (SessionRoute(NodeAPI), AppRoute)
import Gargantext.Routes (SessionRoute(NodeAPI), AppRoute)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session
, Sessions(..)
)
import Gargantext.Types (NodeType(Graph))
import Gargantext.Types (NodeType(Graph))
type GraphId = Int
type GraphId = Int
type LayoutProps =
type LayoutProps =
( graphId :: GraphId
( graphId :: GraphId
, mCurrentRoute ::
Maybe
AppRoute
, mCurrentRoute :: AppRoute
, treeId :: Maybe Int
, treeId :: Maybe Int
, session :: Session
, session :: Session
, frontends :: Frontends )
, frontends :: Frontends
)
type Props = ( graph :: Maybe Graph.Graph | LayoutProps )
type Props = ( graph :: Maybe Graph.Graph | LayoutProps )
--------------------------------------------------------------
explorerLayout :: Record LayoutProps -> R.Element
explorerLayout :: Record LayoutProps -> R.Element
explorerLayout props = R.createElement explorerLayoutCpt props []
explorerLayout props = R.createElement explorerLayoutCpt props []
...
@@ -52,6 +54,7 @@ explorerLayoutCpt = R.hooksComponent "G.C.GraphExplorer.explorerLayout" cpt
...
@@ -52,6 +54,7 @@ explorerLayoutCpt = R.hooksComponent "G.C.GraphExplorer.explorerLayout" cpt
handler loaded = explorer {graphId, mCurrentRoute, treeId, session, graph, frontends}
handler loaded = explorer {graphId, mCurrentRoute, treeId, session, graph, frontends}
where graph = Just (convert loaded)
where graph = Just (convert loaded)
--------------------------------------------------------------
explorer :: Record Props -> R.Element
explorer :: Record Props -> R.Element
explorer props = R.createElement explorerCpt props []
explorer props = R.createElement explorerCpt props []
...
@@ -61,13 +64,12 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -61,13 +64,12 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
cpt {session, graphId, mCurrentRoute, treeId, graph, frontends} _ = do
cpt {session, graphId, mCurrentRoute, treeId, graph, frontends} _ = do
controls <- Controls.useGraphControls
controls <- Controls.useGraphControls
state <- useExplorerState
state <- useExplorerState
showLogin <- snd <$> R.useState' true
pure $
pure $
RH.div
RH.div
{ id: "graph-explorer" }
{ id: "graph-explorer" }
[
[ row
row
[ outer
[
outer
[ inner
[ inner
[ row1
[ row1
[ col [ pullLeft [ Toggle.treeToggleButton controls.showTree ] ]
[ col [ pullLeft [ Toggle.treeToggleButton controls.showTree ] ]
...
@@ -75,7 +77,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -75,7 +77,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
, col [ pullRight [ Toggle.sidebarToggleButton controls.showSidePanel ] ]
, col [ pullRight [ Toggle.sidebarToggleButton controls.showSidePanel ] ]
]
]
, row [ Controls.controls controls ]
, row [ Controls.controls controls ]
, row [ tree {mCurrentRoute, treeId} controls
, row [ tree {mCurrentRoute, treeId} controls
showLogin
, mGraph controls.sigmaRef {graphId, graph}
, mGraph controls.sigmaRef {graphId, graph}
, Sidebar.sidebar {showSidePanel: fst controls.showSidePanel} ]
, Sidebar.sidebar {showSidePanel: fst controls.showSidePanel} ]
, row [ ]
, row [ ]
...
@@ -84,17 +86,17 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -84,17 +86,17 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
]
]
]
]
where
where
tree {treeId: Nothing}
_ = RH.div { id: "tree" } []
-- tree {treeId: Nothing} _
_ = RH.div { id: "tree" } []
tree _ {showTree: false /\ _} = RH.div { id: "tree" } []
tree _ {showTree: false /\ _}
_
= RH.div { id: "tree" } []
tree {mCurrentRoute: m, treeId:
Just root} _ =
tree {mCurrentRoute: m, treeId:
root} _ showLogin=
RH.div {
id: "tree", className: "col-md-2"
}
RH.div {
className: "col-md-2", style: {paddingTop: "60px"}
}
[ Tree.treeView {frontends, root, mCurrentRoute: m, session: session}
]
[forest {sessions: Sessions (Just session), route:m, frontends, showLogin}
]
outer = RH.div { className: "col-md-12" }
outer = RH.div { className: "col-md-12" }
inner = RH.div { className: "container-fluid", style: { paddingTop: "90px" } }
inner = RH.div { className: "container-fluid", style: { paddingTop: "90px" } }
row1 = RH.div { className: "row", style: { paddingBottom: "10px", marginTop: "-24px" } }
row1
= RH.div { className: "row", style: { paddingBottom: "10px", marginTop: "-24px" } }
row = RH.div { className: "row" }
row
= RH.div { className: "row" }
col = RH.div { className: "col-md-4" }
col
= RH.div { className: "col-md-4" }
pullLeft = RH.div { className: "pull-left" }
pullLeft
= RH.div { className: "pull-left" }
pullRight = RH.div { className: "pull-right" }
pullRight = RH.div { className: "pull-right" }
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
8e0b5f8d
...
@@ -29,12 +29,12 @@ import Gargantext.Utils.Reactix as R2
...
@@ -29,12 +29,12 @@ import Gargantext.Utils.Reactix as R2
type Controls =
type Controls =
( cursorSize :: R.State Number
( cursorSize
:: R.State Number
, multiNodeSelect :: R.Ref Boolean
, multiNodeSelect :: R.Ref Boolean
, showControls :: R.State Boolean
, showControls
:: R.State Boolean
, showSidePanel :: R.State Boolean
, showSidePanel
:: R.State Boolean
, showTree :: R.State Boolean
, showTree
:: R.State Boolean
, sigmaRef :: R.Ref (Maybe Sigmax.Sigma)
, sigmaRef
:: R.Ref (Maybe Sigmax.Sigma)
)
)
controlsToSigmaSettings :: Record Controls -> Record Graph.SigmaSettings
controlsToSigmaSettings :: Record Controls -> Record Graph.SigmaSettings
...
@@ -100,21 +100,20 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
...
@@ -100,21 +100,20 @@ controlsCpt = R.hooksComponent "GraphControls" cpt
useGraphControls :: R.Hooks (Record Controls)
useGraphControls :: R.Hooks (Record Controls)
useGraphControls = do
useGraphControls = do
cursorSize <- R.useState' 10.0
cursorSize
<- R.useState' 10.0
multiNodeSelect <- R.useRef false
multiNodeSelect <- R.useRef false
showControls <- R.useState' false
showControls
<- R.useState' false
showSidePanel <- R.useState' false
showSidePanel
<- R.useState' false
showTree <- R.useState' false
showTree <- R.useState' false
sigmaRef <- R2.nothingRef
sigmaRef <- R2.nothingRef
pure {
pure { cursorSize
cursorSize
, multiNodeSelect
, multiNodeSelect
, showControls
, showControls
, showSidePanel
, showSidePanel
, showTree
, showTree
, sigmaRef
, sigmaRef
}
}
getShowControls :: Record Controls -> Boolean
getShowControls :: Record Controls -> Boolean
getShowControls { showControls: ( should /\ _ ) } = should
getShowControls { showControls: ( should /\ _ ) } = should
...
@@ -138,7 +137,7 @@ setShowSidePanel :: Record Controls -> Boolean -> Effect Unit
...
@@ -138,7 +137,7 @@ setShowSidePanel :: Record Controls -> Boolean -> Effect Unit
setShowSidePanel { showSidePanel: ( _ /\ set ) } v = set $ const v
setShowSidePanel { showSidePanel: ( _ /\ set ) } v = set $ const v
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree { showTree: ( _ /\ set ) } v = set $ const v
setShowTree { showTree: ( _ /\ set ) } v = set $
not <<<
const v
setCursorSize :: Record Controls -> Number -> Effect Unit
setCursorSize :: Record Controls -> Number -> Effect Unit
setCursorSize { cursorSize: ( _ /\ setSize ) } v = setSize $ const v
setCursorSize { cursorSize: ( _ /\ setSize ) } v = setSize $ const v
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
8e0b5f8d
...
@@ -80,12 +80,12 @@ data Action
...
@@ -80,12 +80,12 @@ data Action
type Dispatch = Action -> Effect Unit
type Dispatch = Action -> Effect Unit
tableContainer :: { pageParams :: PageParams
tableContainer :: { pageParams
:: PageParams
, dispatch :: Dispatch
, dispatch
:: Dispatch
, setPath :: R2.Setter PageParams
, setPath
:: R2.Setter PageParams
, ngramsParent :: Maybe NgramsTerm
, ngramsParent
:: Maybe NgramsTerm
, ngramsChildren :: Map NgramsTerm Boolean
, ngramsChildren :: Map NgramsTerm Boolean
, ngramsTable :: NgramsTable
, ngramsTable
:: NgramsTable
}
}
-> Record T.TableContainerProps -> R.Element
-> Record T.TableContainerProps -> R.Element
tableContainer { pageParams
tableContainer { pageParams
...
@@ -185,10 +185,10 @@ useNgramsReducer :: State -> R.Hooks (R.Reducer State Action')
...
@@ -185,10 +185,10 @@ useNgramsReducer :: State -> R.Hooks (R.Reducer State Action')
useNgramsReducer init = R.useReducer' performNgramsAction init
useNgramsReducer init = R.useReducer' performNgramsAction init
type Props =
type Props =
( session :: Session
( session
:: Session
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, path :: R.State PageParams
, path
:: R.State PageParams
, versioned :: VersionedNgramsTable )
, versioned
:: VersionedNgramsTable )
ngramsTable :: Record Props -> R.Element
ngramsTable :: Record Props -> R.Element
ngramsTable props = R.createElement ngramsTableCpt props []
ngramsTable props = R.createElement ngramsTableCpt props []
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
8e0b5f8d
...
@@ -104,11 +104,11 @@ type CoreParams s =
...
@@ -104,11 +104,11 @@ type CoreParams s =
type PageParams =
type PageParams =
CoreParams
CoreParams
( params :: T.Params
( params
:: T.Params
, searchQuery :: String
, searchQuery
:: String
, termListFilter :: Maybe TermList -- Nothing means all
, termListFilter :: Maybe TermList -- Nothing means all
, termSizeFilter :: Maybe TermSize -- Nothing means all
, termSizeFilter :: Maybe TermSize -- Nothing means all
, session :: Session
, session
:: Session
)
)
initialPageParams :: Session -> Int -> Array Int -> TabType -> PageParams
initialPageParams :: Session -> Int -> Array Int -> TabType -> PageParams
...
...
src/Gargantext/Components/RandomText.purs
View file @
8e0b5f8d
...
@@ -7,7 +7,7 @@ Maintainer : alexandre.delanoe@iscpif.fr
...
@@ -7,7 +7,7 @@ Maintainer : alexandre.delanoe@iscpif.fr
Stability : experimental
Stability : experimental
Portability : POSIX
Portability : POSIX
How semantic emerge from contextualized randomness can be experimented
How semantic emerge
s
from contextualized randomness can be experimented
with these simple functions;
with these simple functions;
randomSentences: randomizes sentences in a paragraph.
randomSentences: randomizes sentences in a paragraph.
...
...
src/Gargantext/Components/Tree.purs
View file @
8e0b5f8d
...
@@ -44,13 +44,17 @@ type Reload = Int
...
@@ -44,13 +44,17 @@ type Reload = Int
data NodePopup = CreatePopup | NodePopup
data NodePopup = CreatePopup | NodePopup
type Props = ( root :: ID, mCurrentRoute :: Maybe AppRoute, session :: Session, frontends :: Frontends )
type Props = ( root :: ID
, mCurrentRoute :: Maybe AppRoute
type TreeViewProps =
, session :: Session
( tree :: FTree
, frontends :: Frontends
, mCurrentRoute :: Maybe AppRoute
)
, frontends :: Frontends
, session :: Session )
type TreeViewProps = ( tree :: FTree
, mCurrentRoute :: Maybe AppRoute
, frontends :: Frontends
, session :: Session
)
data NTree a = NTree a (Array (NTree a))
data NTree a = NTree a (Array (NTree a))
...
@@ -203,7 +207,8 @@ type NodeMainSpanProps =
...
@@ -203,7 +207,8 @@ type NodeMainSpanProps =
( id :: ID
( id :: ID
, name :: Name
, name :: Name
, nodeType :: NodeType
, nodeType :: NodeType
, mCurrentRoute :: Maybe AppRoute)
, mCurrentRoute :: Maybe AppRoute
)
nodeMainSpan :: (Action -> Aff Unit)
nodeMainSpan :: (Action -> Aff Unit)
-> Record NodeMainSpanProps
-> Record NodeMainSpanProps
...
@@ -216,9 +221,9 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
...
@@ -216,9 +221,9 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
el = R.hooksComponent "NodeMainSpan" cpt
el = R.hooksComponent "NodeMainSpan" cpt
cpt {id, name, nodeType, mCurrentRoute} _ = do
cpt {id, name, nodeType, mCurrentRoute} _ = do
-- only 1 popup at a time is allowed to be opened
-- only 1 popup at a time is allowed to be opened
popupOpen <- R.useState' (Nothing :: Maybe NodePopup)
popupOpen
<- R.useState' (Nothing :: Maybe NodePopup)
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
droppedFile <- R.useState' (Nothing :: Maybe DroppedFile)
isDragOver <- R.useState' false
isDragOver
<- R.useState' false
pure $ H.span (dropProps droppedFile isDragOver)
pure $ H.span (dropProps droppedFile isDragOver)
[ folderIcon folderOpen
[ folderIcon folderOpen
...
@@ -270,10 +275,14 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
...
@@ -270,10 +275,14 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
fldr :: Boolean -> String
fldr :: Boolean -> String
fldr open = if open then "glyphicon glyphicon-folder-open" else "glyphicon glyphicon-folder-close"
fldr open = if open
then "glyphicon glyphicon-folder-open"
else "glyphicon glyphicon-folder-close"
childNodes :: Session -> Frontends -> R.State Reload -> R.State Boolean -> Maybe AppRoute -> Array FTree -> Array R.Element
childNodes :: Session -> Frontends
-> R.State Reload -> R.State Boolean
-> Maybe AppRoute -> Array FTree
-> Array R.Element
childNodes _ _ _ _ _ [] = []
childNodes _ _ _ _ _ [] = []
childNodes _ _ _ (false /\ _) _ _ = []
childNodes _ _ _ (false /\ _) _ _ = []
childNodes session frontends reload (true /\ _) mCurrentRoute ary = map (\ctree -> childNode {tree: ctree}) ary
childNodes session frontends reload (true /\ _) mCurrentRoute ary = map (\ctree -> childNode {tree: ctree}) ary
...
...
src/Gargantext/Config.purs
View file @
8e0b5f8d
...
@@ -5,21 +5,21 @@ import Gargantext.Ends
...
@@ -5,21 +5,21 @@ import Gargantext.Ends
import Gargantext.Types (ApiVersion(..))
import Gargantext.Types (ApiVersion(..))
defaultBackends :: NonEmpty Array Backend
defaultBackends :: NonEmpty Array Backend
defaultBackends =
prod :| [dev, demo, local
]
defaultBackends =
local :| [dev, demo
]
where
where
prod = backend V10 "/api/" "https://gargantext.org" "gargantext.org"
--
prod = backend V10 "/api/" "https://gargantext.org" "gargantext.org"
dev = backend V10 "/api/" "https://dev.gargantext.org" "dev.gargantext.org"
dev = backend V10 "/api/" "https://dev.gargantext.org" "dev.gargantext.org"
demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.gargantext.org"
demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.gargantext.org"
local = backend V10 "/api/" "http://localhost:8008" "localhost"
local = backend V10 "/api/" "http://localhost:8008" "localhost"
defaultApps :: NonEmpty Array Frontend
defaultApps :: NonEmpty Array Frontend
defaultApps = relative :| [
prod,
dev, demo, haskell, caddy]
defaultApps = relative :| [dev, demo, haskell, caddy]
where
where
relative = frontend "/#/" "" "Relative"
relative = frontend "/#/" "" "Relative"
prod = frontend "/#/" "https://gargantext.org" "gargantext.org"
--
prod = frontend "/#/" "https://gargantext.org" "gargantext.org"
dev = frontend "/#/" "https://dev.gargantext.org" "gargantext.org (dev)"
dev = frontend "/#/" "https://dev.gargantext.org" "gargantext.org (dev)"
demo = frontend "/#/" "https://demo.gargantext.org" "gargantext.org (demo)"
demo = frontend "/#/" "https://demo.gargantext.org" "gargantext.org (demo)"
haskell = frontend "/#/" "http://localhost:8008" "localhost.gargantext
)
"
haskell = frontend "/#/" "http://localhost:8008" "localhost.gargantext"
python = frontend "/#/" "http://localhost:8000" "localhost.python"
python = frontend "/#/" "http://localhost:8000" "localhost.python"
caddy = frontend "/#/" "http://localhost:2015" "localhost.caddy"
caddy = frontend "/#/" "http://localhost:2015" "localhost.caddy"
...
...
src/Gargantext/Ends.purs
View file @
8e0b5f8d
...
@@ -95,11 +95,11 @@ staticUrl :: Frontends -> String -> String
...
@@ -95,11 +95,11 @@ staticUrl :: Frontends -> String -> String
staticUrl (Frontends {static}) = frontendUrl static
staticUrl (Frontends {static}) = frontendUrl static
sessionPath :: R.SessionRoute -> String
sessionPath :: R.SessionRoute -> String
sessionPath (R.Tab t i) = sessionPath (R.NodeAPI Node i) <> "/" <> showTabType' t
sessionPath (R.Tab t i)
= sessionPath (R.NodeAPI Node i) <> "/" <> showTabType' t
sessionPath (R.Children n o l s i) = root <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
sessionPath (R.Children n o l s i) = root <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
where root = sessionPath (R.NodeAPI Node i) <> "/"
where root = sessionPath (R.NodeAPI Node i) <> "/"
sessionPath (R.NodeAPI Phylo pId) = "phyloscape?nodeId=" <> (show $ maybe 0 identity pId)
sessionPath (R.NodeAPI Phylo pId)
= "phyloscape?nodeId=" <> (show $ maybe 0 identity pId)
sessionPath (R.GetNgrams opts i) =
sessionPath (R.GetNgrams opts i)
=
base opts.tabType
base opts.tabType
<> "/ngrams?ngramsType="
<> "/ngrams?ngramsType="
<> showTabType' opts.tabType
<> showTabType' opts.tabType
...
...
src/Gargantext/Hooks/Loader.purs
View file @
8e0b5f8d
...
@@ -10,7 +10,8 @@ import Reactix as R
...
@@ -10,7 +10,8 @@ import Reactix as R
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
useAff :: forall st. Aff st -> R.Hooks (Maybe st)
useAff :: forall st.
Aff st -> R.Hooks (Maybe st)
useAff loader = do
useAff loader = do
(loaded /\ setLoaded) <- R.useState' Nothing
(loaded /\ setLoaded) <- R.useState' Nothing
R.useEffect1 loader $ do
R.useEffect1 loader $ do
...
@@ -20,36 +21,44 @@ useAff loader = do
...
@@ -20,36 +21,44 @@ useAff loader = do
else pure R.nothing
else pure R.nothing
pure loaded
pure loaded
useLoader :: forall path st. path -> (path -> Aff st) -> (st -> R.Element) -> R.Hooks R.Element
useLoader :: forall path st.
path -> (path -> Aff st) -> (st -> R.Element) -> R.Hooks R.Element
useLoader path loader render
useLoader path loader render
= maybe' (\_ -> loadingSpinner {}) render
= maybe' (\_ -> loadingSpinner {}) render
<$> (useAff =<< R.useMemo2 path loader (\_ -> loader path))
<$> (useAff =<< R.useMemo2 path loader (\_ -> loader path))
useLoader2 :: forall path st. R.State path -> (path -> Aff st) -> (st -> R.Element) -> R.Hooks R.Element
useLoader2 :: forall path st.
R.State path -> (path -> Aff st)
-> (st -> R.Element) -> R.Hooks R.Element
useLoader2 path loader render = do
useLoader2 path loader render = do
state <- R.useState' Nothing
state <- R.useState' Nothing
useLoaderEffect2 path state loader
useLoaderEffect2 path state loader
pure $ maybe (loadingSpinner {}) render (fst state)
pure $ maybe (loadingSpinner {}) render (fst state)
useLoaderEffect :: forall state. Aff state -> R.State (Maybe state) -> R.Hooks Unit
useLoaderEffect :: forall state.
Aff state -> R.State (Maybe state) -> R.Hooks Unit
useLoaderEffect loader (state /\ setState) = do
useLoaderEffect loader (state /\ setState) = do
R.useEffect2 state loader $ do
R.useEffect2 state loader $ do
if isNothing state then
if isNothing state then
R2.affEffect "G.H.Loader.useLoader" $ loader >>= (liftEffect <<< setState <<< const <<< Just)
R2.affEffect "G.H.Loader.useLoader" $ loader >>= (liftEffect <<< setState <<< const <<< Just)
else pure R.nothing
else pure R.nothing
useLoaderEffect' :: forall state. Aff state -> R.Hooks (R.State (Maybe state))
useLoaderEffect' :: forall state.
Aff state -> R.Hooks (R.State (Maybe state))
useLoaderEffect' aff = do
useLoaderEffect' aff = do
state <- R.useState' Nothing
state <- R.useState' Nothing
useLoaderEffect aff state
useLoaderEffect aff state
pure state
pure state
useLoaderEffect2 :: forall st path. R.State path -> R.State (Maybe st) -> (path -> Aff st) -> R.Hooks Unit
useLoaderEffect2 :: forall st path.
R.State path -> R.State (Maybe st)
-> (path -> Aff st) -> R.Hooks Unit
useLoaderEffect2 path state loader = do
useLoaderEffect2 path state loader = do
aff <- useRepointer path loader
aff <- useRepointer path loader
useLoaderEffect aff state
useLoaderEffect aff state
useRepointer :: forall path st. R.State path -> (path -> Aff st) -> R.Hooks (Aff st)
useRepointer :: forall path st.
R.State path -> (path -> Aff st) -> R.Hooks (Aff st)
useRepointer path@(path' /\ _) loader = R.useMemo2 loader path' (\_ -> loader path')
useRepointer path@(path' /\ _) loader = R.useMemo2 loader path' (\_ -> loader path')
src/Gargantext/Pages/Annuaire.purs
View file @
8e0b5f8d
module Gargantext.Pages.Annuaire where
module Gargantext.Pages.Annuaire where
import Prelude (bind, const, identity, pure, ($), (<$>), (<>))
import Prelude (bind, const, identity, pure, ($), (<$>), (<>))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.
?
?))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.
:
?))
import Data.Array (head)
import Data.Array (head)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
...
@@ -29,7 +29,7 @@ toRows (AnnuaireTable a) = a.annuaireTable
...
@@ -29,7 +29,7 @@ toRows (AnnuaireTable a) = a.annuaireTable
-- | Top level layout component. Loads an annuaire by id and renders
-- | Top level layout component. Loads an annuaire by id and renders
-- | the annuaire using the result
-- | the annuaire using the result
type LayoutProps = (
annuair
eId :: Int, session :: Session )
type LayoutProps = (
nod
eId :: Int, session :: Session )
annuaireLayout :: Record LayoutProps -> R.Element
annuaireLayout :: Record LayoutProps -> R.Element
annuaireLayout props = R.createElement annuaireLayoutCpt props []
annuaireLayout props = R.createElement annuaireLayoutCpt props []
...
@@ -37,8 +37,8 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props []
...
@@ -37,8 +37,8 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props []
annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt = R.hooksComponent "G.P.Annuaire.annuaireLayout" cpt
annuaireLayoutCpt = R.hooksComponent "G.P.Annuaire.annuaireLayout" cpt
where
where
cpt {
annuair
eId, session} _ = do
cpt {
nod
eId, session} _ = do
path <- R.useState'
annuair
eId
path <- R.useState'
nod
eId
useLoader (fst path) (getAnnuaireInfo session) $
useLoader (fst path) (getAnnuaireInfo session) $
\info -> annuaire {session, path, info}
\info -> annuaire {session, path, info}
...
@@ -138,8 +138,8 @@ data HyperdataAnnuaire = HyperdataAnnuaire
...
@@ -138,8 +138,8 @@ data HyperdataAnnuaire = HyperdataAnnuaire
instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where
instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
title <- obj .
?
? "title"
title <- obj .
:
? "title"
desc <- obj .
?
? "desc"
desc <- obj .
:
? "desc"
pure $ HyperdataAnnuaire { title, desc }
pure $ HyperdataAnnuaire { title, desc }
------------------------------------------------------------------------------
------------------------------------------------------------------------------
...
...
src/Gargantext/Pages/Corpus/Document.purs
View file @
8e0b5f8d
module Gargantext.Pages.Corpus.Document where
module Gargantext.Pages.Corpus.Document where
import Prelude (class Show, bind, identity, mempty, pure, ($), (<<<))
import Prelude (class Show, bind, identity, mempty, pure, ($), (<<<))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.
?
?))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.
:
?))
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), maybe)
import Data.Maybe (Maybe(..), maybe)
...
@@ -203,7 +203,7 @@ instance decodeDocumentV3 :: DecodeJson DocumentV3
...
@@ -203,7 +203,7 @@ instance decodeDocumentV3 :: DecodeJson DocumentV3
where
where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
abstract <- obj .
?
? "abstract"
abstract <- obj .
:
? "abstract"
authors <- obj .: "authors"
authors <- obj .: "authors"
--error <- obj .: "error"
--error <- obj .: "error"
language_iso2 <- obj .: "language_iso2"
language_iso2 <- obj .: "language_iso2"
...
@@ -243,23 +243,23 @@ instance decodeDocument :: DecodeJson Document
...
@@ -243,23 +243,23 @@ instance decodeDocument :: DecodeJson Document
where
where
decodeJson json = do
decodeJson json = do
obj <- decodeJson json
obj <- decodeJson json
abstract <- obj .
?
? "abstract"
abstract <- obj .
:
? "abstract"
authors <- obj .
?
? "authors"
authors <- obj .
:
? "authors"
bdd <- obj .
?
? "bdd"
bdd <- obj .
:
? "bdd"
doi <- obj .
?
? "doi"
doi <- obj .
:
? "doi"