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
e984d3dc
Commit
e984d3dc
authored
Apr 26, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[router] refactoring of sessions (no more context)
parent
b27a7f6e
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
196 additions
and
242 deletions
+196
-242
Data.purs
src/Gargantext/Components/App/Data.purs
+4
-1
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+7
-6
Forest.purs
src/Gargantext/Components/Forest.purs
+0
-1
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+0
-13
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+7
-8
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+0
-12
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+3
-4
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+13
-15
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+6
-6
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+5
-4
File.purs
src/Gargantext/Components/Nodes/File.purs
+7
-7
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+6
-7
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+0
-10
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+1
-18
Router.purs
src/Gargantext/Components/Router.purs
+135
-128
SessionLoader.purs
src/Gargantext/Components/SessionLoader.purs
+2
-2
No files found.
src/Gargantext/Components/App/Data.purs
View file @
e984d3dc
...
@@ -11,7 +11,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
...
@@ -11,7 +11,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(Home))
import Gargantext.Routes (AppRoute(Home))
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Sessions (OpenNodes, Sessions)
import Gargantext.Sessions (OpenNodes, Session
, Session
s)
import Gargantext.Types (Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (Handed(RightHanded), SidePanelState(..))
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
...
@@ -24,6 +24,7 @@ type App =
...
@@ -24,6 +24,7 @@ type App =
, reloadMainPage :: T2.Reload
, reloadMainPage :: T2.Reload
, reloadRoot :: T2.Reload
, reloadRoot :: T2.Reload
, route :: AppRoute
, route :: AppRoute
, session :: Maybe Session
, sessions :: Sessions
, sessions :: Sessions
, showCorpus :: Boolean
, showCorpus :: Boolean
, showLogin :: Boolean
, showLogin :: Boolean
...
@@ -45,6 +46,7 @@ emptyApp =
...
@@ -45,6 +46,7 @@ emptyApp =
, reloadMainPage : T2.newReload
, reloadMainPage : T2.newReload
, reloadRoot : T2.newReload
, reloadRoot : T2.newReload
, route : Home
, route : Home
, session : Nothing
, sessions : Sessions.empty
, sessions : Sessions.empty
, showCorpus : false
, showCorpus : false
, showLogin : false
, showLogin : false
...
@@ -65,6 +67,7 @@ type Boxes =
...
@@ -65,6 +67,7 @@ type Boxes =
, reloadMainPage :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, route :: T.Box AppRoute
, route :: T.Box AppRoute
, session :: T.Box (Maybe Session)
, sessions :: T.Box Sessions
, sessions :: T.Box Sessions
, showCorpus :: T.Box Boolean
, showCorpus :: T.Box Boolean
, showLogin :: T.Box Boolean
, showLogin :: T.Box Boolean
...
...
src/Gargantext/Components/DocsTable.purs
View file @
e984d3dc
...
@@ -379,18 +379,19 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -379,18 +379,19 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
, totalRecords }
, totalRecords }
, localCategories
, localCategories
, params } _ = do
, params } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
localCategories' <- T.useLive T.unequal localCategories
localCategories' <- T.useLive T.unequal localCategories
sidePanel' <- T.useLive T.unequal sidePanel
mCurrentDocId <- T.useFocused
let mCurrentDocId = maybe Nothing (_.mCurrentDocId) sidePanel'
(maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
pure $ TT.table
pure $ TT.table
{ colNames
{ colNames
, container: TT.defaultContainer { title: "Documents" }
, container: TT.defaultContainer { title: "Documents" }
, params
, params
, rows: rows reload localCategories' mCurrentDocId
, rows: rows reload localCategories' mCurrentDocId
'
, syncResetButton : [ H.div {} [] ]
, syncResetButton : [ H.div {} [] ]
, totalRecords
, totalRecords
, wrapColElts
, wrapColElts
...
@@ -407,7 +408,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -407,7 +408,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
| otherwise = Routes.Document sid listId
| otherwise = Routes.Document sid listId
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
wrapColElts = const identity
wrapColElts = const identity
rows reload localCategories' mCurrentDocId = row <$> A.toUnfoldable documents
rows reload localCategories' mCurrentDocId
'
= row <$> A.toUnfoldable documents
where
where
row dv@(DocumentsView r@{ _id, category }) =
row dv@(DocumentsView r@{ _id, category }) =
{ row:
{ row:
...
@@ -444,7 +445,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -444,7 +445,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
-- checked = Star_1 == cat
-- checked = Star_1 == cat
tClassName = trashClassName cat selected
tClassName = trashClassName cat selected
className = gi cat
className = gi cat
selected = mCurrentDocId == Just r._id
selected = mCurrentDocId
'
== Just r._id
type DocChooser = (
type DocChooser = (
listId :: ListId
listId :: ListId
...
...
src/Gargantext/Components/Forest.purs
View file @
e984d3dc
...
@@ -52,7 +52,6 @@ type Props =
...
@@ -52,7 +52,6 @@ type Props =
type TreeExtra = (
type TreeExtra = (
forestOpen :: T.Box OpenNodes
forestOpen :: T.Box OpenNodes
, session :: Session
)
)
forest :: R2.Component Props
forest :: R2.Component Props
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
e984d3dc
...
@@ -55,8 +55,6 @@ type BaseProps =
...
@@ -55,8 +55,6 @@ type BaseProps =
, tasks :: T.Box GAT.Storage
, tasks :: T.Box GAT.Storage
)
)
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
type LayoutProps =
type LayoutProps =
( session :: Session
( session :: Session
| BaseProps )
| BaseProps )
...
@@ -75,17 +73,6 @@ type Props =
...
@@ -75,17 +73,6 @@ type Props =
)
)
--------------------------------------------------------------
--------------------------------------------------------------
explorerLayoutLoader :: R2.Component LayoutLoaderProps
explorerLayoutLoader = R.createElement explorerLayoutLoaderCpt
explorerLayoutLoaderCpt :: R.Component LayoutLoaderProps
explorerLayoutLoaderCpt = here.component "explorerLayoutLoader" cpt where
cpt props _ = do
session <- R.useContext props.session -- TODO: ugh, props fiddling
let base = RX.pick props :: Record BaseProps
let props' = Record.merge base { session }
pure $ explorerLayout props' []
explorerLayout :: R2.Component LayoutProps
explorerLayout :: R2.Component LayoutProps
explorerLayout = R.createElement explorerLayoutCpt
explorerLayout = R.createElement explorerLayoutCpt
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
e984d3dc
...
@@ -49,7 +49,7 @@ newtype IndividuView =
...
@@ -49,7 +49,7 @@ newtype IndividuView =
type LayoutProps =
type LayoutProps =
( frontends :: Frontends
( frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, session ::
R.Context
Session
, session :: Session
)
)
annuaireLayout :: R2.Leaf LayoutProps
annuaireLayout :: R2.Leaf LayoutProps
...
@@ -57,15 +57,14 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props []
...
@@ -57,15 +57,14 @@ annuaireLayout props = R.createElement annuaireLayoutCpt props []
annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt :: R.Component LayoutProps
annuaireLayoutCpt = here.component "annuaireLayout" cpt where
annuaireLayoutCpt = here.component "annuaireLayout" cpt where
cpt { frontends, nodeId, session } _ = cp <$> R.useContext session where
cpt { frontends, nodeId, session } _ = do
cp s = annuaireLayoutWithKey { frontends, key, nodeId, session: s } where
pure $ annuaireLayoutWithKey { frontends, key, nodeId, session }
key = show (sessionId s) <> "-" <> show nodeId
where
key = show (sessionId session) <> "-" <> show nodeId
type KeyLayoutProps =
type KeyLayoutProps =
( frontends :: Frontends
( key :: String
, nodeId :: Int
| LayoutProps
, session :: Session
, key :: String
)
)
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
...
...
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
e984d3dc
module Gargantext.Components.Nodes.Annuaire.User
module Gargantext.Components.Nodes.Annuaire.User
( module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
( module Gargantext.Components.Nodes.Annuaire.User.Contacts.Types
, userLayout
, userLayout
, userLayoutSessionContext
)
)
where
where
...
@@ -170,17 +169,6 @@ type KeyLayoutProps = (
...
@@ -170,17 +169,6 @@ type KeyLayoutProps = (
| LayoutProps
| LayoutProps
)
)
userLayoutSessionContext :: R2.Component LayoutSessionContextProps
userLayoutSessionContext = R.createElement userLayoutSessionContextCpt
userLayoutSessionContextCpt :: R.Component LayoutSessionContextProps
userLayoutSessionContextCpt = here.component "userLayoutSessionContext" cpt
where
cpt props@{ session } _ = do
session' <- R.useContext session
pure $ userLayout (Record.merge { session: session' } $ (REX.pick props :: Record LayoutNoSessionProps)) []
userLayout :: R2.Component LayoutProps
userLayout :: R2.Component LayoutProps
userLayout = R.createElement userLayoutCpt
userLayout = R.createElement userLayoutCpt
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
e984d3dc
...
@@ -160,7 +160,7 @@ type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps )
...
@@ -160,7 +160,7 @@ type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps )
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff Int
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff Int
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
type AnnuaireLayoutProps = ( annuaireId :: Int, session ::
R.Context
Session | ReloadProps )
type AnnuaireLayoutProps = ( annuaireId :: Int, session :: Session | ReloadProps )
type AnnuaireKeyLayoutProps = ( annuaireId :: Int | KeyLayoutProps )
type AnnuaireKeyLayoutProps = ( annuaireId :: Int | KeyLayoutProps )
...
@@ -178,8 +178,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
...
@@ -178,8 +178,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
, sidePanel
, sidePanel
, sidePanelState
, sidePanelState
, tasks } _ = do
, tasks } _ = do
s <- R.useContext session
let key = show (sessionId session) <> "-" <> show nodeId
let key = show (sessionId s) <> "-" <> show nodeId
pure $
pure $
contactLayoutWithKey
contactLayoutWithKey
{ annuaireId
{ annuaireId
...
@@ -188,7 +187,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
...
@@ -188,7 +187,7 @@ contactLayoutCpt = here.component "contactLayout" cpt where
, nodeId
, nodeId
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
, session
: s
, session
, sidePanel
, sidePanel
, sidePanelState
, sidePanelState
, tasks
, tasks
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
e984d3dc
module Gargantext.Components.Nodes.Corpus where
module Gargantext.Components.Nodes.Corpus where
import
Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>)
)
import
DOM.Simple.Console (log2
)
import Data.Argonaut (class DecodeJson, decodeJson, encodeJson)
import Data.Argonaut (class DecodeJson, decodeJson, encodeJson)
import Data.Argonaut.Parser (jsonParser)
import Data.Argonaut.Parser (jsonParser)
import Data.Array as A
import Data.Array as A
...
@@ -11,46 +11,44 @@ import Data.Generic.Rep.Show (genericShow)
...
@@ -11,46 +11,44 @@ import Data.Generic.Rep.Show (genericShow)
import Data.List as List
import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.FolderView as FV
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (doc)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Nodes.Types
( FTField, FTFieldWithIndex, FTFieldsWithIndex, Field(..), FieldType(..), Hash, Index
, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython' )
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata(..))
import Gargantext.Components.Nodes.Types (FTField, FTFieldWithIndex, FTFieldsWithIndex, Field(..), FieldType(..), Hash, Index, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Data.Array as GDA
import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (AffTableResult, NodeType(..))
import Gargantext.Types (AffTableResult, NodeType(..))
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus"
here = R2.here "Gargantext.Components.Nodes.Corpus"
type Props = ( nodeId :: Int, session ::
R.Context
Session )
type Props = ( nodeId :: Int, session :: Session )
corpusLayout :: R2.Leaf Props
corpusLayout :: R2.Leaf Props
corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = here.component "corpusLayout" cpt where
corpusLayoutCpt = here.component "corpusLayout" cpt where
cpt { nodeId, session } _ = cp <$> R.useContext session where
cpt { nodeId, session } _ = do
cp s = corpusLayoutMain { key, nodeId, session: s } where
pure $ corpusLayoutMain { key, nodeId, session }
key = show (sessionId s) <> "-" <> show nodeId
where
key = show (sessionId session) <> "-" <> show nodeId
type KeyProps =
type KeyProps =
( nodeId :: Int
( nodeId :: Int
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
e984d3dc
...
@@ -28,21 +28,21 @@ import Gargantext.Utils.Toestand as T2
...
@@ -28,21 +28,21 @@ import Gargantext.Utils.Toestand as T2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard"
here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard"
type Props = ( nodeId :: NodeID, session ::
R.Context
Session )
type Props = ( nodeId :: NodeID, session :: Session )
dashboardLayout :: R2.Component Props
dashboardLayout :: R2.Component Props
dashboardLayout = R.createElement dashboardLayoutCpt
dashboardLayout = R.createElement dashboardLayoutCpt
dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = here.component "dashboardLayout" cpt where
dashboardLayoutCpt = here.component "dashboardLayout" cpt where
cpt { nodeId, session } content = cp <$> R.useContext session where
cpt { nodeId, session } content = do
cp s = dashboardLayoutWithKey { key, nodeId, session: s } content where
pure $ dashboardLayoutWithKey { key, nodeId, session } content
key = show (sessionId s) <> "-" <> show nodeId
where
key = show (sessionId session) <> "-" <> show nodeId
type KeyProps =
type KeyProps =
( key :: String
( key :: String
, nodeId :: NodeID
| Props
, session :: Session
)
)
dashboardLayoutWithKey :: R2.Component KeyProps
dashboardLayoutWithKey :: R2.Component KeyProps
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
e984d3dc
...
@@ -118,7 +118,7 @@ type LayoutProps =
...
@@ -118,7 +118,7 @@ type LayoutProps =
( listId :: ListId
( listId :: ListId
, mCorpusId :: Maybe NodeID
, mCorpusId :: Maybe NodeID
, nodeId :: NodeID
, nodeId :: NodeID
, session ::
R.Context
Session
, session :: Session
)
)
documentMainLayout :: R2.Component LayoutProps
documentMainLayout :: R2.Component LayoutProps
...
@@ -133,9 +133,10 @@ documentLayout = R.createElement documentLayoutCpt
...
@@ -133,9 +133,10 @@ documentLayout = R.createElement documentLayoutCpt
documentLayoutCpt :: R.Component LayoutProps
documentLayoutCpt :: R.Component LayoutProps
documentLayoutCpt = here.component "documentLayout" cpt where
documentLayoutCpt = here.component "documentLayout" cpt where
cpt { listId, mCorpusId, nodeId, session } children = cp <$> R.useContext session where
cpt { listId, mCorpusId, nodeId, session } children = do
cp s = documentLayoutWithKey { key, listId, mCorpusId, nodeId, session: s } children where
pure $ documentLayoutWithKey { key, listId, mCorpusId, nodeId, session } children
key = show (sessionId s) <> "-" <> show nodeId
where
key = show (sessionId session) <> "-" <> show nodeId
type KeyLayoutProps =
type KeyLayoutProps =
( key :: String
( key :: String
...
...
src/Gargantext/Components/Nodes/File.purs
View file @
e984d3dc
...
@@ -55,25 +55,25 @@ instance decodeFile :: DecodeJson File where
...
@@ -55,25 +55,25 @@ instance decodeFile :: DecodeJson File where
hyperdata <- (obj .: "hyperdata") >>= decodeJson
hyperdata <- (obj .: "hyperdata") >>= decodeJson
pure $ File { id, date, hyperdata, name }
pure $ File { id, date, hyperdata, name }
type FileLayoutProps = ( nodeId :: NodeID, session ::
R.Context
Session )
type FileLayoutProps = ( nodeId :: NodeID, session :: Session )
fileLayout :: R2.Leaf FileLayoutProps
fileLayout :: R2.Leaf FileLayoutProps
fileLayout props = R.createElement fileLayoutCpt props []
fileLayout props = R.createElement fileLayoutCpt props []
fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt = here.component "fileLayout" cpt where
fileLayoutCpt = here.component "fileLayout" cpt where
cpt { nodeId, session } _ = R.useContext session >>= cp where
cpt { nodeId, session } _ = do
cp s = useLoader nodeId (loadFile s) onLoad where
useLoader nodeId (loadFile session) onLoad
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session: s } where
where
key = show (sessionId s) <> "-" <> show nodeId
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session }
key = show (sessionId session) <> "-" <> show nodeId
loadFile :: Session -> NodeID -> Aff File
loadFile :: Session -> NodeID -> Aff File
loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) ""
type FileLayoutLoadedProps =
type FileLayoutLoadedProps =
( loaded :: File
( loaded :: File
, nodeId :: Int
| FileLayoutProps
, session :: Session
)
)
fileLayoutLoaded :: Record FileLayoutLoadedProps -> R.Element
fileLayoutLoaded :: Record FileLayoutLoadedProps -> R.Element
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
e984d3dc
...
@@ -46,15 +46,13 @@ instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
...
@@ -46,15 +46,13 @@ instance encodeJsonHyperdata :: Argonaut.EncodeJson Hyperdata where
type Props =
type Props =
( nodeId :: Int
( nodeId :: Int
, session :: R.Context Session
, nodeType :: NodeType
, nodeType :: NodeType
, session :: Session
)
)
type KeyProps =
type KeyProps =
( key :: String
( key :: String
, nodeId :: Int
| Props
, session :: Session
, nodeType :: NodeType
)
)
frameLayout :: R2.Leaf Props
frameLayout :: R2.Leaf Props
...
@@ -62,9 +60,10 @@ frameLayout props = R.createElement frameLayoutCpt props []
...
@@ -62,9 +60,10 @@ frameLayout props = R.createElement frameLayoutCpt props []
frameLayoutCpt :: R.Component Props
frameLayoutCpt :: R.Component Props
frameLayoutCpt = here.component "frameLayout" cpt where
frameLayoutCpt = here.component "frameLayout" cpt where
cpt { nodeId, nodeType, session } _ = cp <$> R.useContext session where
cpt { nodeId, nodeType, session } _ = do
cp s = frameLayoutWithKey { key, nodeId, nodeType, session: s } where
pure $ frameLayoutWithKey { key, nodeId, nodeType, session }
key = show (sessionId s) <> "-" <> show nodeId
where
key = show (sessionId session) <> "-" <> show nodeId
frameLayoutWithKey :: R2.Leaf KeyProps
frameLayoutWithKey :: R2.Leaf KeyProps
frameLayoutWithKey props = R.createElement frameLayoutWithKeyCpt props []
frameLayoutWithKey props = R.createElement frameLayoutWithKeyCpt props []
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
e984d3dc
...
@@ -24,16 +24,6 @@ import Toestand as T
...
@@ -24,16 +24,6 @@ import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists"
here = R2.here "Gargantext.Components.Nodes.Lists"
listsWithSessionContext :: R2.Component CommonPropsSessionContext
listsWithSessionContext = R.createElement listsWithSessionContextCpt
listsWithSessionContextCpt :: R.Component CommonPropsSessionContext
listsWithSessionContextCpt = here.component "listsWithSessionContext" cpt where
cpt props@{ session, sidePanel, sidePanelState } _ = do
session' <- R.useContext session
pure $ listsLayout (Record.merge { session: session', sidePanel, sidePanelState } props) []
--------------------------------------------------------
--------------------------------------------------------
type CommonPropsNoSession =
type CommonPropsNoSession =
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
e984d3dc
...
@@ -33,20 +33,6 @@ here :: R2.Here
...
@@ -33,20 +33,6 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Texts"
here = R2.here "Gargantext.Components.Nodes.Texts"
--------------------------------------------------------
--------------------------------------------------------
textsWithSessionContext :: R2.Component CommonPropsSessionContext
textsWithSessionContext = R.createElement textsWithSessionContextCpt
textsWithSessionContextCpt :: R.Component CommonPropsSessionContext
textsWithSessionContextCpt = here.component "textsWithSessionContext" cpt
where
cpt props@{ session, sidePanel, sidePanelState } _ = do
session' <- R.useContext session
pure $ R.fragment
[
textsLayout (Record.merge { session: session', sidePanel, sidePanelState } props) []
-- , H.div { className: "side-panel" } [ sidePanelC { session: session', sidePanel } [] ]
]
type CommonPropsNoSession = (
type CommonPropsNoSession = (
...
@@ -57,7 +43,6 @@ type CommonPropsNoSession = (
...
@@ -57,7 +43,6 @@ type CommonPropsNoSession = (
)
)
type Props = WithSession CommonPropsNoSession
type Props = WithSession CommonPropsNoSession
type CommonPropsSessionContext = WithSessionContext CommonPropsNoSession
textsLayout :: R2.Component Props
textsLayout :: R2.Component Props
...
@@ -427,9 +412,7 @@ sidePanelDocViewCpt = here.component "sidePanelDocView" cpt
...
@@ -427,9 +412,7 @@ sidePanelDocViewCpt = here.component "sidePanelDocView" cpt
pure $ H.div {} []
pure $ H.div {} []
cpt { mSidePanel: Just { corpusId, listId, nodeId }
cpt { mSidePanel: Just { corpusId, listId, nodeId }
, session } _ = do
, session } _ = do
let session' = R.createContext session
pure $ D.documentLayout { listId
pure $ D.documentLayout { listId
, mCorpusId: Just corpusId
, mCorpusId: Just corpusId
, nodeId
, nodeId
, session
: session'
} []
, session } []
src/Gargantext/Components/Router.purs
View file @
e984d3dc
...
@@ -10,7 +10,6 @@ import Reactix.DOM.HTML as H
...
@@ -10,7 +10,6 @@ import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
import Record.Extra as RE
import Record.Extra as RE
import Toestand as T
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Footer (footer)
import Gargantext.Components.Footer (footer)
...
@@ -21,7 +20,7 @@ import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
...
@@ -21,7 +20,7 @@ import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.Lang (LandingLang(LL_EN))
import Gargantext.Components.Lang (LandingLang(LL_EN))
import Gargantext.Components.Login (login)
import Gargantext.Components.Login (login)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire (annuaireLayout)
import Gargantext.Components.Nodes.Annuaire.User (userLayout
SessionContext
)
import Gargantext.Components.Nodes.Annuaire.User (userLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contact (contactLayout)
import Gargantext.Components.Nodes.Annuaire.User.Contact (contactLayout)
import Gargantext.Components.Nodes.Corpus (corpusLayout)
import Gargantext.Components.Nodes.Corpus (corpusLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
...
@@ -31,13 +30,13 @@ import Gargantext.Components.Nodes.Frame (frameLayout)
...
@@ -31,13 +30,13 @@ import Gargantext.Components.Nodes.Frame (frameLayout)
import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Home (homeLayout)
import Gargantext.Components.Nodes.Lists as Lists
import Gargantext.Components.Nodes.Lists as Lists
import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.Nodes.Texts as Texts
import Gargantext.Components.SessionLoader (sessionWrapper)
import Gargantext.Components.TopBar as TopBar
import Gargantext.Components.TopBar as TopBar
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Ends (Backend)
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes (AppRoute)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, WithSessionContext)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions (Session, WithSession)
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId, SidePanelState(..))
import Gargantext.Types (CorpusId, ListId, NodeID, NodeType(..), SessionId, SidePanelState(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -46,10 +45,10 @@ here = R2.here "Gargantext.Components.Router"
...
@@ -46,10 +45,10 @@ here = R2.here "Gargantext.Components.Router"
type Props = ( boxes :: Boxes )
type Props = ( boxes :: Boxes )
type SessionProps = ( session
:: R.Context Session, session
Id :: SessionId | Props )
type SessionProps = ( sessionId :: SessionId | Props )
type SessionNodeProps = ( nodeId :: NodeID | SessionProps )
type SessionNodeProps = ( nodeId :: NodeID | SessionProps )
type Props' = (
route' :: AppRoute, backend :: Backend
| Props )
type Props' = (
backend :: Backend, route' :: AppRoute
| Props )
router :: R2.Leaf Props
router :: R2.Leaf Props
router props = R.createElement routerCpt props []
router props = R.createElement routerCpt props []
...
@@ -57,23 +56,20 @@ router props = R.createElement routerCpt props []
...
@@ -57,23 +56,20 @@ router props = R.createElement routerCpt props []
routerCpt :: R.Component Props
routerCpt :: R.Component Props
routerCpt = here.component "router" cpt where
routerCpt = here.component "router" cpt where
cpt props@{ boxes } _ = do
cpt props@{ boxes } _ = do
let session = R.createContext (unsafeCoerce {})
pure $ R.fragment
pure $ R.fragment
[ loginModal { boxes } []
[ loginModal { boxes } []
, topBar { boxes } []
, topBar { boxes } []
, forest { boxes
, session
} []
, forest { boxes } []
, sidePanel { boxes
, session
} []
, sidePanel { boxes } []
]
]
renderRoute :: R2.Component
(WithSessionContext Props)
renderRoute :: R2.Component
Props
renderRoute = R.createElement renderRouteCpt
renderRoute = R.createElement renderRouteCpt
renderRouteCpt :: R.Component
(WithSessionContext Props)
renderRouteCpt :: R.Component
Props
renderRouteCpt = here.component "renderRoute" cpt where
renderRouteCpt = here.component "renderRoute" cpt where
cpt props@{ boxes, session } _ = do
cpt props@{ boxes } _ = do
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
route' <- T.useLive T.unequal boxes.route
route' <- T.useLive T.unequal boxes.route
...
@@ -114,12 +110,24 @@ loginModalCpt = here.component "loginModal" cpt
...
@@ -114,12 +110,24 @@ loginModalCpt = here.component "loginModal" cpt
pure $ if showLogin' then login' boxes else H.div {} []
pure $ if showLogin' then login' boxes else H.div {} []
authed :: Record SessionProps -> R.Element -> R.Element
type AuthedProps =
authed props@{ boxes: { sessions }, session, sessionId } content =
( content :: Session -> R.Element
sessionWrapper { fallback: home homeProps []
| SessionProps )
, context: session
, sessionId
authed :: R2.Component AuthedProps
, sessions } [ content, footer {} [] ]
authed = R.createElement authedCpt
authedCpt :: R.Component AuthedProps
authedCpt = here.component "authed" cpt where
cpt props@{ boxes: { session, sessions }
, content
, sessionId } _ = do
sessions' <- T.useLive T.unequal sessions
let session' = Sessions.lookup sessionId sessions'
case session' of
Nothing -> pure $ home homeProps []
Just s -> pure $ R.fragment [ content s, footer {} [] ]
where
where
homeProps = RE.pick props :: Record Props
homeProps = RE.pick props :: Record Props
...
@@ -139,25 +147,23 @@ topBarCpt = here.component "topBar" cpt where
...
@@ -139,25 +147,23 @@ topBarCpt = here.component "topBar" cpt where
pure $ TopBar.topBar { handed } children
pure $ TopBar.topBar { handed } children
forest :: R2.Component
(WithSessionContext Props)
forest :: R2.Component
Props
forest = R.createElement forestCpt
forest = R.createElement forestCpt
forestCpt :: R.Component
(WithSessionContext Props)
forestCpt :: R.Component
Props
forestCpt = here.component "forest" cpt where
forestCpt = here.component "forest" cpt where
cpt props@{ boxes: { backend
cpt props@{ boxes: boxes@{ backend
, forestOpen
, forestOpen
, handed
, handed
, reloadForest
, reloadForest
, reloadMainPage
, reloadMainPage
, reloadRoot
, reloadRoot
, route
, route
, sessions
, sessions
, showLogin
, showLogin
, showTree
, showTree
, tasks }
, tasks }
, session } _ = do
} _ = do
session' <- R.useContext session
pure $ Forest.forestLayoutMain { backend
pure $ Forest.forestLayoutMain { backend
, forestOpen
, forestOpen
, frontends: defaultFrontends
, frontends: defaultFrontends
...
@@ -169,30 +175,34 @@ forestCpt = here.component "forest" cpt where
...
@@ -169,30 +175,34 @@ forestCpt = here.component "forest" cpt where
, sessions
, sessions
, showLogin
, showLogin
, showTree
, showTree
, tasks } [ renderRoute
(Record.merge { session } props)
[] ]
, tasks } [ renderRoute
{ boxes }
[] ]
sidePanel :: R2.Component
(WithSessionContext Props)
sidePanel :: R2.Component
Props
sidePanel = R.createElement sidePanelCpt
sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component
(WithSessionContext Props)
sidePanelCpt :: R.Component
Props
sidePanelCpt = here.component "sidePanel" cpt where
sidePanelCpt = here.component "sidePanel" cpt where
cpt props@{ boxes: boxes@{ graphVersion
cpt props@{ boxes: boxes@{ graphVersion
, reloadForest
, reloadForest
, session
, sidePanelGraph
, sidePanelGraph
, sidePanelState
, sidePanelState
, sidePanelLists
, sidePanelLists
, sidePanelTexts }
, sidePanelTexts } } _ = do
, session } _ = do
sidePanelState' <- T.useLive T.unequal sidePanelState
sidePanelState' <- T.useLive T.unequal sidePanelState
session' <- T.useLive T.unequal session
case sidePanelState' of
case session' of
Opened -> pure $ openedSidePanel props []
Nothing -> pure $ H.div {} []
_ -> pure $ H.div {} []
Just s ->
case sidePanelState' of
Opened -> pure $ openedSidePanel (Record.merge { session: s } props) []
_ -> pure $ H.div {} []
openedSidePanel :: R2.Component (WithSession
Context
Props)
openedSidePanel :: R2.Component (WithSession Props)
openedSidePanel = R.createElement openedSidePanelCpt
openedSidePanel = R.createElement openedSidePanelCpt
openedSidePanelCpt :: R.Component (WithSession
Context
Props)
openedSidePanelCpt :: R.Component (WithSession Props)
openedSidePanelCpt = here.component "openedSidePanel" cpt where
openedSidePanelCpt = here.component "openedSidePanel" cpt where
cpt props@{ boxes: boxes@{ graphVersion
cpt props@{ boxes: boxes@{ graphVersion
, reloadForest
, reloadForest
...
@@ -200,9 +210,8 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
...
@@ -200,9 +210,8 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
, sidePanelState
, sidePanelState
, sidePanelLists
, sidePanelLists
, sidePanelTexts }
, sidePanelTexts }
, session
} _ = do
, session} _ = do
route' <- T.useLive T.unequal boxes.route
route' <- T.useLive T.unequal boxes.route
session' <- R.useContext session
{ mGraph, mMetaData, removedNodeIds, selectedNodeIds, sideTab } <- GEST.focusedSidePanel sidePanelGraph
{ mGraph, mMetaData, removedNodeIds, selectedNodeIds, sideTab } <- GEST.focusedSidePanel sidePanelGraph
mGraph' <- T.useLive T.unequal mGraph
mGraph' <- T.useLive T.unequal mGraph
...
@@ -214,7 +223,7 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
...
@@ -214,7 +223,7 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
case route' of
case route' of
GR.Lists s n -> do
GR.Lists s n -> do
pure $ wrapper
pure $ wrapper
[ Lists.sidePanel { session
: session'
[ Lists.sidePanel { session
, sidePanel: sidePanelLists
, sidePanel: sidePanelLists
, sidePanelState } [] ]
, sidePanelState } [] ]
GR.PGraphExplorer s g -> do
GR.PGraphExplorer s g -> do
...
@@ -235,12 +244,12 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
...
@@ -235,12 +244,12 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
, reloadForest
, reloadForest
, removedNodeIds
, removedNodeIds
, selectedNodeIds
, selectedNodeIds
, session
: session'
, session
, sideTab
, sideTab
} [] ]
} [] ]
GR.Texts s n -> do
GR.Texts s n -> do
pure $ wrapper
pure $ wrapper
[ Texts.sidePanel { session
: session'
[ Texts.sidePanel { session
, sidePanel: sidePanelTexts
, sidePanel: sidePanelTexts
, sidePanelState } [] ]
, sidePanelState } [] ]
_ -> pure $ wrapper []
_ -> pure $ wrapper []
...
@@ -250,20 +259,22 @@ annuaire = R.createElement annuaireCpt
...
@@ -250,20 +259,22 @@ annuaire = R.createElement annuaireCpt
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt = here.component "annuaire" cpt where
annuaireCpt = here.component "annuaire" cpt where
cpt props@{ boxes, nodeId, session
, session
Id } _ = do
cpt props@{ boxes, nodeId, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ annuaireLayout { frontends: defaultFrontends
pure $ authed (Record.merge { content: \session ->
, nodeId
annuaireLayout { frontends: defaultFrontends
, session }
, nodeId
, session } } sessionProps) []
corpus :: R2.Component SessionNodeProps
corpus :: R2.Component SessionNodeProps
corpus = R.createElement corpusCpt
corpus = R.createElement corpusCpt
corpusCpt :: R.Component SessionNodeProps
corpusCpt :: R.Component SessionNodeProps
corpusCpt = here.component "corpus" cpt where
corpusCpt = here.component "corpus" cpt where
cpt props@{ boxes, nodeId
, session
} _ = do
cpt props@{ boxes, nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ corpusLayout { nodeId, session }
pure $ authed (Record.merge { content: \session ->
corpusLayout { nodeId, session } } sessionProps) []
type CorpusDocumentProps =
type CorpusDocumentProps =
( corpusId :: CorpusId
( corpusId :: CorpusId
...
@@ -277,10 +288,10 @@ corpusDocument = R.createElement corpusDocumentCpt
...
@@ -277,10 +288,10 @@ corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt
corpusDocumentCpt = here.component "corpusDocument" cpt
where
where
cpt props@{ boxes, corpusId: corpusId', listId, nodeId, session
, session
Id } _ = do
cpt props@{ boxes, corpusId: corpusId', listId, nodeId, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
documentMainLayout { mCorpusId: corpusId, listId: listId, nodeId, session }
[]
documentMainLayout { mCorpusId: corpusId, listId: listId, nodeId, session } [] } sessionProps )
[]
where corpusId = Just corpusId'
where corpusId = Just corpusId'
dashboard :: R2.Component SessionNodeProps
dashboard :: R2.Component SessionNodeProps
...
@@ -289,9 +300,10 @@ dashboard = R.createElement dashboardCpt
...
@@ -289,9 +300,10 @@ dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt
dashboardCpt = here.component "dashboard" cpt
where
where
cpt props@{ boxes, nodeId
, session
} _ = do
cpt props@{ boxes, nodeId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $ dashboardLayout { nodeId, session } []
pure $ authed (Record.merge { content: \session ->
dashboardLayout { nodeId, session } [] } sessionProps) []
type DocumentProps = ( listId :: ListId | SessionNodeProps )
type DocumentProps = ( listId :: ListId | SessionNodeProps )
...
@@ -300,10 +312,10 @@ document = R.createElement documentCpt
...
@@ -300,10 +312,10 @@ document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where
documentCpt = here.component "document" cpt where
cpt props@{ boxes, listId, nodeId, session
, session
Id } _ = do
cpt props@{ boxes, listId, nodeId, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
documentMainLayout { listId, nodeId, mCorpusId, session }
[]
documentMainLayout { listId, nodeId, mCorpusId, session } [] } sessionProps)
[]
where mCorpusId = Nothing
where mCorpusId = Nothing
graphExplorer :: R2.Component SessionNodeProps
graphExplorer :: R2.Component SessionNodeProps
...
@@ -319,21 +331,20 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
...
@@ -319,21 +331,20 @@ graphExplorerCpt = here.component "graphExplorer" cpt where
, sidePanelGraph
, sidePanelGraph
, sidePanelState
, sidePanelState
, tasks }
, tasks }
, nodeId
, nodeId } _ = do
, session } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
-- simpleLayout { handed }
-- simpleLayout { handed }
GraphExplorer.explorerLayoutLoader
{ backend
GraphExplorer.explorerLayout
{ backend
, boxes
, boxes
, frontends: defaultFrontends
, frontends: defaultFrontends
, graphId: nodeId
, graphId: nodeId
, handed
, handed
, route
, route
, session
, session
, sessions
, sessions
, showLogin
, showLogin
, tasks }
[]
, tasks } [] } sessionProps)
[]
home :: R2.Component Props
home :: R2.Component Props
home = R.createElement homeCpt
home = R.createElement homeCpt
...
@@ -361,19 +372,18 @@ listsCpt = here.component "lists" cpt where
...
@@ -361,19 +372,18 @@ listsCpt = here.component "lists" cpt where
, sidePanelLists
, sidePanelLists
, tasks }
, tasks }
, nodeId
, nodeId
, session
, sessionId } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
Lists.listsWithSessionContex
t { nodeId
Lists.listsLayou
t { nodeId
, reloadForest
, reloadForest
, reloadMainPage
, reloadMainPage
, reloadRoot
, reloadRoot
, session
, session
, sessionUpdate: \_ -> pure unit
, sessionUpdate: \_ -> pure unit
, sidePanel: sidePanelLists
, sidePanel: sidePanelLists
, sidePanelState
, sidePanelState
, tasks }
[]
, tasks } [] } sessionProps)
[]
login' :: Boxes -> R.Element
login' :: Boxes -> R.Element
login' { backend, sessions, showLogin: visible } =
login' { backend, sessions, showLogin: visible } =
...
@@ -387,10 +397,10 @@ routeFile = R.createElement routeFileCpt
...
@@ -387,10 +397,10 @@ routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt where
routeFileCpt = here.component "routeFile" cpt where
cpt props@{ boxes, nodeId, session
, session
Id } _ = do
cpt props@{ boxes, nodeId, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
fileLayout { nodeId, session }
fileLayout { nodeId, session } } sessionProps) []
type RouteFrameProps = (
type RouteFrameProps = (
nodeType :: NodeType
nodeType :: NodeType
...
@@ -402,20 +412,20 @@ routeFrame = R.createElement routeFrameCpt
...
@@ -402,20 +412,20 @@ routeFrame = R.createElement routeFrameCpt
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt = here.component "routeFrame" cpt where
routeFrameCpt = here.component "routeFrame" cpt where
cpt props@{ boxes, nodeId, nodeType, session
, session
Id } _ = do
cpt props@{ boxes, nodeId, nodeType, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
frameLayout { nodeId, nodeType, session }
frameLayout { nodeId, nodeType, session } } sessionProps) []
team :: R2.Component SessionNodeProps
team :: R2.Component SessionNodeProps
team = R.createElement teamCpt
team = R.createElement teamCpt
teamCpt :: R.Component SessionNodeProps
teamCpt :: R.Component SessionNodeProps
teamCpt = here.component "team" cpt where
teamCpt = here.component "team" cpt where
cpt props@{ boxes, nodeId, session
, session
Id } _ = do
cpt props@{ boxes, nodeId, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
corpusLayout { nodeId, session }
corpusLayout { nodeId, session } } sessionProps) []
texts :: R2.Component SessionNodeProps
texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt
texts = R.createElement textsCpt
...
@@ -435,15 +445,14 @@ textsCpt = here.component "texts" cpt
...
@@ -435,15 +445,14 @@ textsCpt = here.component "texts" cpt
, sidePanelTexts
, sidePanelTexts
, tasks }
, tasks }
, nodeId
, nodeId
, session
, sessionId } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
Texts.textsWithSessionContex
t { frontends: defaultFrontends
Texts.textsLayou
t { frontends: defaultFrontends
, nodeId
, nodeId
, session
, session
, sidePanel: sidePanelTexts
, sidePanel: sidePanelTexts
, sidePanelState }
[]
, sidePanelState } [] } sessionProps)
[]
user :: R2.Component SessionNodeProps
user :: R2.Component SessionNodeProps
user = R.createElement userCpt
user = R.createElement userCpt
...
@@ -456,18 +465,17 @@ userCpt = here.component "user" cpt where
...
@@ -456,18 +465,17 @@ userCpt = here.component "user" cpt where
, sidePanelTexts
, sidePanelTexts
, tasks }
, tasks }
, nodeId
, nodeId
, session
, sessionId } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
userLayoutSessionContex
t { frontends: defaultFrontends
userLayou
t { frontends: defaultFrontends
, nodeId
, nodeId
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
, session
, session
, sidePanel: sidePanelTexts
, sidePanel: sidePanelTexts
, sidePanelState
, sidePanelState
, tasks }
[]
, tasks } [] } sessionProps)
[]
type ContactProps = ( annuaireId :: NodeID | SessionNodeProps )
type ContactProps = ( annuaireId :: NodeID | SessionNodeProps )
...
@@ -483,17 +491,16 @@ contactCpt = here.component "contact" cpt where
...
@@ -483,17 +491,16 @@ contactCpt = here.component "contact" cpt where
, sidePanelState
, sidePanelState
, tasks }
, tasks }
, nodeId
, nodeId
, session
, sessionId } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let sessionProps = RE.pick props :: Record SessionProps
let forestedProps = RE.pick props :: Record Props
let forestedProps = RE.pick props :: Record Props
pure $ authed
sessionProps $
pure $ authed
(Record.merge { content: \session ->
contactLayout { annuaireId
contactLayout { annuaireId
, frontends: defaultFrontends
, frontends: defaultFrontends
, nodeId
, nodeId
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
, session
, session
, sidePanel: sidePanelTexts
, sidePanel: sidePanelTexts
, sidePanelState
, sidePanelState
, tasks }
[]
, tasks } [] } sessionProps)
[]
src/Gargantext/Components/SessionLoader.purs
View file @
e984d3dc
...
@@ -20,8 +20,8 @@ here = R2.here "Gargantext.Components.SessionWrapper"
...
@@ -20,8 +20,8 @@ here = R2.here "Gargantext.Components.SessionWrapper"
type Props =
type Props =
(
(
fallback :: R.Element
context :: R.Context Session
,
context :: R.Context Session
,
fallback :: R.Element
, sessionId :: SessionId
, sessionId :: SessionId
, sessions :: T.Box Sessions
, sessions :: T.Box Sessions
)
)
...
...
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