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
cd5c85f2
Commit
cd5c85f2
authored
Mar 08, 2021
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
for seeg
parent
7ee27ee6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
66 deletions
+74
-66
Data.purs
src/Gargantext/Components/App/Data.purs
+7
-3
Forest.purs
src/Gargantext/Components/Forest.purs
+6
-7
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+4
-4
Router.purs
src/Gargantext/Components/Router.purs
+53
-48
SessionLoader.purs
src/Gargantext/Components/SessionLoader.purs
+4
-4
No files found.
src/Gargantext/Components/App/Data.purs
View file @
cd5c85f2
...
...
@@ -4,6 +4,7 @@ import Data.Set as Set
import Data.Maybe (Maybe(..))
import Toestand as T
import Gargantext.Ends (Backend)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions (OpenNodes, Sessions)
import Gargantext.Routes (AppRoute(Home))
...
...
@@ -11,7 +12,8 @@ import Gargantext.Types (Handed(RightHanded))
import Gargantext.Utils.Toestand as T2
type App =
{ handed :: Handed
{ backend :: Maybe Backend
, handed :: Handed
, forestOpen :: OpenNodes
, reloadRoot :: Int
, reloadForest :: Int
...
...
@@ -23,7 +25,8 @@ type App =
emptyApp :: App
emptyApp =
{ handed: RightHanded
{ backend: Nothing
, handed: RightHanded
, route: Home
, forestOpen: Set.empty
, reloadRoot: T2.newReload
...
...
@@ -34,7 +37,8 @@ emptyApp =
}
type Cursors =
{ handed :: T.Cursor Handed
{ backend :: T.Cursor (Maybe Backend)
, handed :: T.Cursor Handed
, forestOpen :: T.Cursor OpenNodes
, reloadRoot :: T.Cursor Int
, reloadForest :: T.Cursor Int
...
...
src/Gargantext/Components/Forest.purs
View file @
cd5c85f2
...
...
@@ -11,7 +11,7 @@ module Gargantext.Components.Forest
import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Set as Set
import Data.Tuple (fst
, snd
)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Reactix as R
import Reactix.DOM.HTML as H
...
...
@@ -25,7 +25,7 @@ import Gargantext.Ends (Frontends, Backend)
import Gargantext.Prelude
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Types (Handed
(..)
, reverseHanded, switchHanded)
import Gargantext.Types (Handed, reverseHanded, switchHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
...
...
@@ -42,7 +42,7 @@ type Common =
)
type LayoutProps =
( backend :: T.Cursor
Backend
( backend :: T.Cursor
(Maybe Backend)
, reloadForest :: T.Cursor T2.Reload
, sessions :: T.Cursor Sessions
, showLogin :: T.Cursor Boolean
...
...
@@ -75,8 +75,7 @@ forestCpt = here.component "forest" cpt where
, tasks } _ = do
-- NOTE: this is a hack to reload the forest on demand
tasks' <- GAT.useTasks reloadRoot reloadForest
R.useEffect' $ do
T2.write_ (Just tasks') tasks
R.useEffect' $ T2.write_ (Just tasks') tasks
handed' <- T.useLive T.unequal handed
reloadForest' <- T.useLive T.unequal reloadForest
reloadRoot' <- T.useLive T.unequal reloadRoot
...
...
@@ -108,7 +107,7 @@ forestCpt = here.component "forest" cpt where
, session: s
, tasks } []
plus :: Handed -> T.Cursor Boolean -> T.Cursor
Backend
-> R.Element
plus :: Handed -> T.Cursor Boolean -> T.Cursor
(Maybe Backend)
-> R.Element
plus handed showLogin backend = H.div { className: "row" }
[ H.button { className: buttonClass
, on: { click }
...
...
@@ -122,7 +121,7 @@ plus handed showLogin backend = H.div { className: "row" }
-- [ H.i { className: "material-icons md-36"} [] ]
where
click _ = do
-- _ <- T.
modify (const Nothing)
backend
-- _ <- T.
write Nothing
backend
T2.write_ true showLogin
title = "Add or remove connections to the server(s)."
divClass = "fa fa-universal-access"
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
cd5c85f2
...
...
@@ -44,8 +44,8 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer"
type LayoutProps =
(
backend :: T.Cursor Backend
type LayoutProps =
( backend :: T.Cursor (Maybe Backend)
, frontends :: Frontends
, graphId :: GET.GraphId
, handed :: T.Cursor Types.Handed
...
...
@@ -250,8 +250,8 @@ explorerCpt = here.component "explorer" cpt
Sidebar.sidebar (Record.merge props { metaData })
type TreeProps = (
backend :: T.Cursor
Backend
, forestOpen :: T.Cursor OpenNodes
backend :: T.Cursor
(Maybe Backend)
, forestOpen
:: T.Cursor OpenNodes
, frontends :: Frontends
, handed :: T.Cursor Types.Handed
, reload :: T.Cursor T2.Reload
...
...
src/Gargantext/Components/Router.purs
View file @
cd5c85f2
...
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Router (router) where
import Data.Array (fromFoldable)
import Data.Maybe (Maybe(..), maybe')
import Reactix as R
import Record as Record
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -29,6 +30,7 @@ import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.SessionLoader (sessionWrapper)
import Gargantext.Components.SimpleLayout (simpleLayout)
import Gargantext.Config (defaultFrontends, defaultBackends, publicBackend)
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(..))
import Gargantext.Routes as GR
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId(..))
...
...
@@ -43,6 +45,8 @@ type Props = (
, tasks :: T.Cursor (Maybe GAT.Reductor)
)
type Props' = ( route' :: AppRoute, backend :: Backend | Props )
router :: R2.Leaf Props
router props = R.createElement routerCpt props []
...
...
@@ -51,85 +55,86 @@ routerCpt = here.component "root" cpt where
cpt props@{ cursors, ws, tasks } _ = do
let session = R.createContext (unsafeCoerce {})
showLogin <- T.useLive T.unequal cursors.showLogin
route <- T.useLive (T.changed notEq) cursors.route
route' <- T.useLive (T.changed notEq) cursors.route
let props' = Record.merge props { route' }
if showLogin then login' cursors
else case route of
GR.Annuaire s n -> annuaire props s n
GR.Corpus s n -> corpus props s n
GR.CorpusDocument s c l n -> corpusDocument props s c l n
GR.Dashboard s n -> dashboard props s n
GR.Document s l n -> document props s l n
GR.Folder s n -> corpus props s n
GR.FolderPrivate s n -> corpus props s n
GR.FolderPublic s n -> corpus props s n
GR.FolderShared s n -> corpus props s n
GR.Home -> home props
GR.Lists s n -> lists props s n
else case route
'
of
GR.Annuaire s n -> annuaire props
'
s n
GR.Corpus s n -> corpus props
'
s n
GR.CorpusDocument s c l n -> corpusDocument props
'
s c l n
GR.Dashboard s n -> dashboard props
'
s n
GR.Document s l n -> document props
'
s l n
GR.Folder s n -> corpus props
'
s n
GR.FolderPrivate s n -> corpus props
'
s n
GR.FolderPublic s n -> corpus props
'
s n
GR.FolderShared s n -> corpus props
'
s n
GR.Home -> home props
'
GR.Lists s n -> lists props
'
s n
GR.Login -> login' cursors
GR.PGraphExplorer s g -> graphExplorer props s g
GR.RouteFile s n -> routeFile props s n
GR.RouteFrameCalc s n -> routeFrame props s n NodeFrameCalc
GR.RouteFrameCode s n -> routeFrame props s n NodeFrameNotebook
GR.RouteFrameWrite s n -> routeFrame props s n NodeFrameWrite
GR.Team s n -> team props s n
GR.Texts s n -> texts props s n
GR.UserPage s n -> user props s n
GR.ContactPage s a n -> contact props s a n
GR.PGraphExplorer s g -> graphExplorer props
'
s g
GR.RouteFile s n -> routeFile props
'
s n
GR.RouteFrameCalc s n -> routeFrame props
'
s n NodeFrameCalc
GR.RouteFrameCode s n -> routeFrame props
'
s n NodeFrameNotebook
GR.RouteFrameWrite s n -> routeFrame props
'
s n NodeFrameWrite
GR.Team s n -> team props
'
s n
GR.Texts s n -> texts props
'
s n
GR.UserPage s n -> user props
'
s n
GR.ContactPage s a n -> contact props
'
s a n
forested :: Record Props -> Array R.Element -> R.Element
forested {
tasks, cursors: { route,
handed, sessions, backend, reloadForest, reloadRoot, showLogin } } =
forested :: Record Props
'
-> Array R.Element -> R.Element
forested {
route', tasks, cursors: {
handed, sessions, backend, reloadForest, reloadRoot, showLogin } } =
forestLayout
{ tasks, frontends,
route, handed, sessions
{ tasks, frontends,
handed, sessions, route: route'
, backend, reloadForest, reloadRoot, showLogin
} where frontends = defaultFrontends
authed :: Record Props -> SessionId -> R.Element -> R.Element
authed props@{ cursors: { session
, sessions }
, tasks } sessionId content =
sessionWrapper { sessionId, session
, session
s, fallback: home props }
authed :: Record Props
'
-> SessionId -> R.Element -> R.Element
authed props@{ cursors: { session
s }
, tasks } sessionId content =
sessionWrapper { sessionId, sessions, fallback: home props }
[ content, footer { session } ]
annuaire :: Record Props -> SessionId -> NodeID -> R.Element
annuaire :: Record Props
'
-> SessionId -> NodeID -> R.Element
annuaire props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $
forested props [ annuaireLayout { nodeId, frontends, session } ]
where frontends = defaultFrontends
corpus :: Record Props -> SessionId -> NodeID -> R.Element
corpus :: Record Props
'
-> SessionId -> NodeID -> R.Element
corpus props@{ tasks, cursors: session } sessionId nodeId =
authed props sessionId $
forested props
[ corpusLayout { nodeId, session } ]
corpusDocument :: Record Props -> SessionId -> CorpusId -> ListId -> NodeID -> R.Element
corpusDocument :: Record Props
'
-> SessionId -> CorpusId -> ListId -> NodeID -> R.Element
corpusDocument props@{ tasks, cursors: session } sessionId corpusId' listId nodeId =
authed props sessionId $
forested props
[ documentMainLayout { listId, nodeId, corpusId, sessionId, session } [] ]
where corpusId = Just corpusId'
dashboard :: Record Props -> SessionId -> NodeID -> R.Element
dashboard :: Record Props
'
-> SessionId -> NodeID -> R.Element
dashboard props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $
forested props [ dashboardLayout { nodeId, session } [] ]
document :: Record Props -> SessionId -> ListId -> NodeID -> R.Element
document :: Record Props
'
-> SessionId -> ListId -> NodeID -> R.Element
document props@{ tasks, cursors: { session } } sessionId listId nodeId =
authed props sessionId $
forested props
[ documentMainLayout { listId, nodeId, corpusId, session } [] ]
where corpusId = Nothing
home :: Record Props -> R.Element
home props@{ cursors: {
backend,
showLogin, sessions } } =
forested props [ homeLayout { sessions,
backend,
showLogin, lang: LL_EN } ]
home :: Record Props
'
-> R.Element
home props@{ cursors: { showLogin, sessions } } =
forested props [ homeLayout { sessions, showLogin, lang: LL_EN } ]
lists :: Record Props -> SessionId -> NodeID -> R.Element
lists :: Record Props
'
-> SessionId -> NodeID -> R.Element
lists props@{ cursors: { backend, route, handed, sessions
, reloadForest, reloadRoot, session, showLogin }
, tasks } sessionId nodeId =
authed props sessionId $
Lists.listsWithForest
{ forestProps: { backend
{ forestProps
'
: { backend
, frontends
, handed
, reloadForest
...
...
@@ -138,7 +143,7 @@ lists props@{ cursors: { backend, route, handed, sessions
, sessions
, showLogin
, tasks }
, listsProps: { tasks, reloadRoot, reloadForest, nodeId, session }
, listsProps
'
: { tasks, reloadRoot, reloadForest, nodeId, session }
} []
where frontends = defaultFrontends
...
...
@@ -147,7 +152,7 @@ login' { backend, sessions, showLogin: visible } =
login { backend, sessions, visible
, backends: fromFoldable defaultBackends }
graphExplorer :: Record Props -> SessionId -> Int -> R.Element
graphExplorer :: Record Props
'
-> SessionId -> Int -> R.Element
graphExplorer props@{ views: { backend, route, handed, session, sessions, showLogin }
, tasks } sessionId graphId =
authed props sessionId $
...
...
@@ -156,36 +161,36 @@ graphExplorer props@{ views: { backend, route, handed, session, sessions, showLo
, handed, session, sessions, showLogin } ]
where frontends = defaultFrontends
routeFile :: Record Props -> SessionId -> NodeID -> R.Element
routeFile :: Record Props
'
-> SessionId -> NodeID -> R.Element
routeFile props@{ cursors: { session } } sessionId nodeId =
authed props sessionId $ forested props [ fileLayout { nodeId, session } ]
routeFrame :: Record Props -> SessionId -> NodeID -> NodeType -> R.Element
routeFrame :: Record Props
'
-> SessionId -> NodeID -> NodeType -> R.Element
routeFrame props@{ cursors: { session } } sessionId nodeId nodeType =
authed props sessionId $ forested props [ frameLayout { nodeId, nodeType, session } ]
team :: Record Props -> SessionId -> NodeID -> R.Element
team :: Record Props
'
-> SessionId -> NodeID -> R.Element
team props@{ tasks, cursors: { session } } sessionId nodeId =
authed props sessionId $ forested props [ corpusLayout { nodeId, session } ]
texts :: Record Props -> SessionId -> NodeID -> R.Element
texts :: Record Props
'
-> SessionId -> NodeID -> R.Element
texts props@{ cursors: { backend, reloadForest, reloadRoot, showLogin, route, handed, session, sessions }
, tasks } sessionId nodeId =
authed props sessionId $
Texts.textsWithForest
{ forestProps: { frontends, tasks, route, handed, sessions
{ forestProps
'
: { frontends, tasks, route, handed, sessions
, backend, reloadForest, reloadRoot, showLogin }
, textsProps: { frontends, nodeId, session } }
, textsProps
'
: { frontends, nodeId, session } }
[] where frontends = defaultFrontends
user :: Record Props -> SessionId -> NodeID -> R.Element
user :: Record Props
'
-> SessionId -> NodeID -> R.Element
user props@{ cursors: { reloadRoot, session }, tasks } sessionId nodeId =
authed props sessionId $
forested props
[ userLayout { tasks, nodeId, session, reloadRoot, frontends } ]
where frontends = defaultFrontends
contact :: Record Props -> SessionId -> NodeID -> R.Element
contact :: Record Props
'
-> SessionId -> NodeID -> R.Element
contact props@{ tasks, cursors: { reloadRoot } } sessionId annuaireId nodeId =
authed props sessionId $
forested props
...
...
src/Gargantext/Components/SessionLoader.purs
View file @
cd5c85f2
...
...
@@ -15,16 +15,16 @@ import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.SessionWrapper"
type Props
sessions
=
type Props =
( sessionId :: SessionId
, sessions ::
s
essions
, sessions ::
T.Cursor S
essions
, provider :: R.Provider Session
, fallback :: R.Element )
sessionWrapper ::
forall s. T.Read s Sessions => R2.Component (Props s)
sessionWrapper ::
R2.Component Props
sessionWrapper = R.createElement sessionWrapperCpt
sessionWrapperCpt ::
forall s. T.Read s Sessions => R.Component (Props s)
sessionWrapperCpt ::
R.Component Props
sessionWrapperCpt = here.component "sessionWrapper" cpt where
cpt { sessionId, sessions, provider, fallback } content =
cp <$> T.useLive T.unequal sessions where
...
...
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