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
4a7918bf
Commit
4a7918bf
authored
Mar 30, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toestand] refactor of async tasks to toestand
parent
a702dad5
Changes
16
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
103 additions
and
118 deletions
+103
-118
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+20
-44
App.purs
src/Gargantext/Components/App.purs
+8
-6
Data.purs
src/Gargantext/Components/App/Data.purs
+5
-2
Forest.purs
src/Gargantext/Components/Forest.purs
+2
-4
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+12
-9
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+7
-3
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+2
-2
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+1
-1
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+2
-2
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+2
-2
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+1
-1
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+1
-1
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+2
-2
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+1
-1
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+1
-1
Router.purs
src/Gargantext/Components/Router.purs
+36
-37
No files found.
src/Gargantext/AsyncTasks.purs
View file @
4a7918bf
...
...
@@ -9,7 +9,6 @@ import Data.Array as A
import Data.Either (Either(..))
import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Tuple (fst)
import Effect (Effect)
import Reactix as R
import Toestand as T
...
...
@@ -24,7 +23,8 @@ localStorageKey :: String
localStorageKey = "garg-async-tasks"
type Storage = Map.Map GT.NodeID (Array GT.AsyncTaskWithType)
type TaskList = Array GT.AsyncTaskWithType
type Storage = Map.Map GT.NodeID TaskList
empty :: Storage
empty = Map.empty
...
...
@@ -42,15 +42,16 @@ getAsyncTasks = R2.getls >>= WSS.getItem localStorageKey >>= handleMaybe
parse s = GU.mapLeft (log2 "Error parsing serialised sessions:") (jsonParser s)
decode j = GU.mapLeft (log2 "Error decoding serialised sessions:") (decodeJson j)
getTasks ::
Record ReductorProps -> GT.NodeID -> Array GT.AsyncTaskWithType
getTasks
{ storage } nodeId
= fromMaybe [] $ Map.lookup nodeId storage
getTasks ::
GT.NodeID -> Storage -> TaskList
getTasks
nodeId storage
= fromMaybe [] $ Map.lookup nodeId storage
getTasksMaybe :: Maybe Reductor -> GT.NodeID -> Array GT.AsyncTaskWithType
getTasksMaybe mTasks nodeId = case mTasks of
Just tasks -> getTasks (fst tasks) nodeId
Nothing -> []
setTasks :: GT.NodeID -> TaskList -> Storage -> Storage
setTasks id tasks s = Map.insert id tasks s
removeTaskFromList :: Array GT.AsyncTaskWithType -> GT.AsyncTaskWithType -> Array GT.AsyncTaskWithType
focus :: GT.NodeID -> T.Box Storage -> R.Hooks (T.Box TaskList)
focus id tasks = T.useFocused (getTasks id) (setTasks id) tasks
removeTaskFromList :: TaskList -> GT.AsyncTaskWithType -> TaskList
removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } }) =
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
...
...
@@ -60,40 +61,15 @@ type ReductorProps = (
, storage :: Storage
)
type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit
insert :: GT.NodeID -> GT.AsyncTaskWithType -> T.Box Storage -> Effect Unit
insert id task storage = T.modify_ newStorage storage
where
newStorage s = Map.alter (maybe (Just [task]) (\ts -> Just $ A.cons task ts)) id s
finish :: GT.NodeID -> GT.AsyncTaskWithType -> T.Box Storage -> Effect Unit
finish id task storage = remove id task storage
useTasks :: T.Box T2.Reload -> T.Box T2.Reload -> R.Hooks Reductor
useTasks reloadRoot reloadForest = R2.useReductor act initializer unit
remove :: GT.NodeID -> GT.AsyncTaskWithType -> T.Box Storage -> Effect Unit
remove id task storage = T.modify_ newStorage storage
where
act :: R2.Actor (Record ReductorProps) Action
act a s = action s a
initializer _ = do
storage <- getAsyncTasks
pure { reloadRoot, reloadForest, storage }
data Action =
Insert GT.NodeID GT.AsyncTaskWithType
| Finish GT.NodeID GT.AsyncTaskWithType
| Remove GT.NodeID GT.AsyncTaskWithType
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action p@{ reloadForest, storage } (Insert nodeId t) = do
-- _ <- T2.reload reloadForest
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
pure $ p { storage = newStorage }
action p (Finish nodeId t) = do
action p (Remove nodeId t)
action p@{ reloadRoot, reloadForest, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
_ <- if GT.asyncTaskTriggersAppReload typ then
pure unit
-- T2.reload reloadRoot
else
pure unit
_ <- if GT.asyncTaskTriggersTreeReload typ then
pure unit
-- T2.reload reloadForest
else
pure unit
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
pure $ p { storage = newStorage }
newStorage s = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts task)) id s
src/Gargantext/Components/App.purs
View file @
4a7918bf
module Gargantext.Components.App (app) where
import Data.Maybe (Maybe(..))
import Reactix as R
import Toestand as T
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (emptyApp)
import Gargantext.Components.Router (router)
...
...
@@ -13,6 +10,8 @@ import Gargantext.Hooks (useHashRouter)
import Gargantext.Router as Router
import Gargantext.Sessions as Sessions
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.App"
...
...
@@ -28,11 +27,14 @@ appCpt = here.component "app" cpt where
-- tasks <- T.useBox Nothing -- storage for asynchronous tasks reductor
R.useEffectOnce' $ do
void $ Sessions.load boxes.sessions
tasks <- GAT.useTasks boxes.reloadRoot boxes.reloadForest
-- tasks <- GAT.useTasks boxes.reloadRoot boxes.reloadForest
R.useEffectOnce' $ do
tasksStorage <- GAT.getAsyncTasks
T.write_ tasksStorage boxes.tasks
-- R.useEffectOnce' $ do
-- T.write (Just tasksReductor) tasks
R.useEffectOnce' $ do
R2.loadLocalStorageState R2.openNodesKey boxes.forestOpen
T.listen (R2.listenLocalStorageState R2.openNodesKey) boxes.forestOpen
useHashRouter Router.router boxes.route -- Install router to window
pure $ router { boxes
, tasks
} -- Render router component
pure $ router { boxes } -- Render router component
src/Gargantext/Components/App/Data.purs
View file @
4a7918bf
...
...
@@ -4,10 +4,11 @@ import Data.Set as Set
import Data.Maybe (Maybe(..))
import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.Ends (Backend)
import Gargantext.Routes (AppRoute(Home))
import Gargantext.Sessions as Sessions
import Gargantext.Sessions (OpenNodes, Sessions)
import Gargantext.Routes (AppRoute(Home))
import Gargantext.Types (Handed(RightHanded))
import Gargantext.Utils.Toestand as T2
...
...
@@ -21,6 +22,7 @@ type App =
, sessions :: Sessions
, showCorpus :: Boolean
, showLogin :: Boolean
, tasks :: GAT.Storage
}
emptyApp :: App
...
...
@@ -34,6 +36,7 @@ emptyApp =
, sessions: Sessions.empty
, showCorpus: false
, showLogin: false
, tasks: GAT.empty
}
type Boxes =
...
...
@@ -46,5 +49,5 @@ type Boxes =
, sessions :: T.Box Sessions
, showCorpus :: T.Box Boolean
, showLogin :: T.Box Boolean
, tasks :: T.Box GAT.Storage
}
src/Gargantext/Components/Forest.purs
View file @
4a7918bf
...
...
@@ -37,8 +37,6 @@ type Common =
, handed :: T.Box Handed
, reloadRoot :: T.Box T2.Reload
, route :: T.Box AppRoute
-- , tasks :: T.Box (Maybe GAT.Reductor)
, tasks :: GAT.Reductor
)
type Props =
...
...
@@ -47,6 +45,7 @@ type Props =
, reloadForest :: T.Box T2.Reload
, sessions :: T.Box Sessions
, showLogin :: T.Box Boolean
, tasks :: T.Box GAT.Storage
| Common
)
...
...
@@ -86,8 +85,7 @@ forestCpt = here.component "forest" cpt where
-- R.useEffect' $ do
-- R.setRef tasks $ Just tasks'
R2.useCache
( frontends /\ route' /\ sessions' /\ handed' /\ forestOpen'
/\ reloadForest' /\ (fst tasks).storage )
( frontends /\ route' /\ sessions' /\ handed' /\ forestOpen' /\ reloadForest' )
(cp handed' sessions')
where
common = RX.pick props :: Record Common
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
4a7918bf
...
...
@@ -47,15 +47,14 @@ here = R2.here "Gargantext.Components.Forest.Tree"
-- Shared by every component here + performAction + nodeSpan
type Universal =
( reloadRoot :: T.Box T2.Reload
-- , tasks :: T.Box (Maybe GAT.Reductor) )
, tasks :: GAT.Reductor )
( reloadRoot :: T.Box T2.Reload )
-- Shared by every component here + nodeSpan
type Global =
( frontends :: Frontends
, handed :: Handed
, route :: T.Box AppRoute
, tasks :: T.Box GAT.Storage
| Universal )
-- Shared by every component here
...
...
@@ -108,7 +107,10 @@ treeCpt = here.component "tree" cpt where
[ H.div { className: divClass } -- TODO: naughty div should not be in a ul
[ H.li { className: childrenClass children }
[ nodeSpan (nsprops { folderOpen, name, id, nodeType, setPopoverRef, isLeaf })
(renderChildren open) ]]]
(renderChildren open)
]
]
]
where
isLeaf = A.null children
nodeId = mkNodeId session id
...
...
@@ -136,6 +138,7 @@ type PACommon =
( forestOpen :: T.Box OpenNodes
, reloadTree :: T.Box T2.Reload
, session :: Session
, tasks :: T.Box GAT.Storage
, tree :: FTree
| Universal )
...
...
@@ -181,13 +184,13 @@ performAction (DeleteNode nt) p@{ forestOpen
performAction RefreshTree p
performAction (DoSearch task) p@{ tasks
, tree: (NTree (LNode {id}) _) } = liftEffect $ do
snd tasks $ GAT.Insert id task
GAT.insert id task tasks
log2 "[performAction] DoSearch task:" task
performAction (UpdateNode params) p@{ tasks
, tree: (NTree (LNode {id}) _) } = do
task <- updateRequest params p.session id
liftEffect $ do
snd tasks $ GAT.Insert id task
GAT.insert id task tasks
log2 "[performAction] UpdateNode task:" task
performAction (RenameNode name) p@{ tree: (NTree (LNode {id}) _) } = do
void $ rename p.session id $ RenameValue { text: name }
...
...
@@ -210,13 +213,13 @@ performAction (UploadFile nodeType fileType mName blob) p@{ tasks
, tree: (NTree (LNode { id }) _) } = do
task <- uploadFile p.session nodeType id fileType {mName, blob}
liftEffect $ do
snd tasks $ GAT.Insert id task
GAT.insert id task tasks
log2 "[performAction] UploadFile, uploaded, task:" task
performAction (UploadArbitraryFile mName blob) p@{ tasks
, tree: (NTree (LNode { id }) _) } = do
task <- uploadArbitraryFile p.session id { blob, mName }
liftEffect $ do
snd tasks $ GAT.Insert id task
GAT.insert id task tasks
log2 "[performAction] UploadArbitraryFile, uploaded, task:" task
performAction DownloadNode _ = liftEffect $ log "[performAction] DownloadNode"
performAction (MoveNode {params}) p@{ forestOpen
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
4a7918bf
...
...
@@ -54,7 +54,7 @@ type NodeMainSpanProps =
, reloadRoot :: T.Box T2.Reload
, route :: T.Box Routes.AppRoute
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
| CommonProps
)
...
...
@@ -97,6 +97,9 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
isDragOver' <- T.useLive T.unequal isDragOver
popoverRef <- R.useRef null
currentTasks <- GAT.focus id tasks
currentTasks' <- T.useLive T.unequal currentTasks
R.useEffect' $ do
R.setRef setPopoverRef $ Just $ Popover.setOpen popoverRef
let isSelected = Just route' == Routes.nodeTypeAppRoute nodeType (sessionId session) id
...
...
@@ -117,7 +120,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, onFinish: onTaskFinish id t
, session
}
)
$ GAT.getTasks (fst tasks) id
)
currentTasks'
)
, if nodeType == GT.NodeUser
then GV.versionView {session}
...
...
@@ -142,7 +145,8 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
]
where
onTaskFinish id' t _ = do
snd tasks $ GAT.Finish id' t
GAT.finish id' t tasks
-- snd tasks $ GAT.Finish id' t
-- mT <- T.read tasks
-- case mT of
-- Just t' -> snd t' $ GAT.Finish id' t
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
4a7918bf
...
...
@@ -53,7 +53,7 @@ type BaseProps =
, route :: T.Box AppRoute
, sessions :: T.Box Sessions
, showLogin :: T.Box Boolean
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type LayoutLoaderProps = ( session :: R.Context Session | BaseProps )
...
...
@@ -277,7 +277,7 @@ type TreeProps = (
, sessions :: T.Box Sessions
, show :: Boolean
, showLogin :: T.Box Boolean
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type MSidebarProps =
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
4a7918bf
...
...
@@ -263,7 +263,7 @@ type CommonProps = (
, reloadRoot :: T.Box T2.Reload
, sidePanelTriggers :: Record NT.SidePanelTriggers
, tabNgramType :: CTabNgramType
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
, withAutoUpdate :: Boolean
)
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
4a7918bf
...
...
@@ -1185,14 +1185,14 @@ chartsAfterSync :: forall props discard.
, tabType :: TabType
| props
}
->
GAT.Reductor
->
T.Box GAT.Storage
-> discard
-> Aff Unit
chartsAfterSync path'@{ nodeId } tasks _ = do
task <- postNgramsChartsAsync path'
liftEffect $ do
log2 "[chartsAfterSync] Synchronize task" task
snd tasks $ GAT.Insert nodeId task
GAT.insert nodeId task tasks
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
4a7918bf
...
...
@@ -59,7 +59,7 @@ type TabsProps =
, reloadRoot :: T.Box T2.Reload
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
tabs :: R2.Leaf TabsProps
...
...
@@ -136,5 +136,5 @@ type NTCommon =
, reloadRoot :: T.Box T2.Reload
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
4a7918bf
...
...
@@ -155,7 +155,7 @@ type LayoutNoSessionProps =
, nodeId :: Int
, reloadForest :: T.Box T2.Reload
, reloadRoot :: T.Box T2.Reload
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type LayoutProps = WithSession LayoutNoSessionProps
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
4a7918bf
...
...
@@ -141,7 +141,7 @@ listElement = H.li { className: "list-group-item justify-content-between" }
type BasicProps =
( frontends :: Frontends
, nodeId :: Int
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type ReloadProps =
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
4a7918bf
...
...
@@ -57,7 +57,7 @@ type TabsProps = (
, reloadRoot :: T.Box T2.Reload
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
tabs :: Record TabsProps -> R.Element
...
...
@@ -139,7 +139,7 @@ type NgramsViewTabsProps = (
, reloadRoot :: T.Box T2.Reload
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
ngramsView :: R2.Component NgramsViewTabsProps
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
4a7918bf
...
...
@@ -94,7 +94,7 @@ type CommonPropsNoSession =
, reloadForest :: T.Box T2.Reload
, reloadRoot :: T.Box T2.Reload
, sessionUpdate :: Session -> Effect Unit
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type CommonProps = WithSession CommonPropsNoSession
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
4a7918bf
...
...
@@ -41,7 +41,7 @@ type Props = (
, reloadRoot :: T.Box T2.Reload
, session :: Session
, sidePanelTriggers :: Record SidePanelTriggers
, tasks ::
GAT.Reductor
, tasks ::
T.Box GAT.Storage
)
type PropsWithKey = ( key :: String | Props )
...
...
src/Gargantext/Components/Router.purs
View file @
4a7918bf
...
...
@@ -42,7 +42,7 @@ import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Router"
type Props = ( boxes :: Boxes
, tasks :: GAT.Reductor
)
type Props = ( boxes :: Boxes )
type SessionProps = ( session :: R.Context Session, sessionId :: SessionId | Props )
...
...
@@ -54,7 +54,7 @@ router props = R.createElement routerCpt props []
routerCpt :: R.Component Props
routerCpt = here.component "router" cpt where
cpt props@{ boxes
, tasks
} _ = do
cpt props@{ boxes } _ = do
let session = R.createContext (unsafeCoerce {})
let sessionProps sId = Record.merge { session, sessionId: sId } props
let sessionNodeProps sId nId = Record.merge { nodeId: nId } $ sessionProps sId
...
...
@@ -101,7 +101,8 @@ forestedCpt = here.component "forested" cpt
, reloadRoot
, route
, sessions
, showLogin }, tasks } children = do
, showLogin
, tasks } } children = do
pure $ forestLayout { backend
, forestOpen
, frontends: defaultFrontends
...
...
@@ -114,7 +115,7 @@ forestedCpt = here.component "forested" cpt
, tasks } children
authed :: Record SessionProps -> R.Element -> R.Element
authed props@{ boxes: { sessions }, session, sessionId
, tasks
} content =
authed props@{ boxes: { sessions }, session, sessionId } content =
sessionWrapper { fallback: home homeProps []
, context: session
, sessionId
...
...
@@ -127,10 +128,10 @@ annuaire = R.createElement annuaireCpt
annuaireCpt :: R.Component SessionNodeProps
annuaireCpt = here.component "annuaire" cpt where
cpt props@{ boxes, nodeId, session, sessionId
, tasks
} _ = do
cpt props@{ boxes, nodeId, session, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ annuaireLayout { frontends, nodeId, session } ]
forested { boxes } [ annuaireLayout { frontends, nodeId, session } ]
where frontends = defaultFrontends
corpus :: R2.Component SessionNodeProps
...
...
@@ -138,10 +139,10 @@ corpus = R.createElement corpusCpt
corpusCpt :: R.Component SessionNodeProps
corpusCpt = here.component "corpus" cpt where
cpt props@{ boxes, nodeId, session
, tasks
} _ = do
cpt props@{ boxes, nodeId, session } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ corpusLayout { nodeId, session } ]
forested { boxes } [ corpusLayout { nodeId, session } ]
type CorpusDocumentProps =
( corpusId :: CorpusId
...
...
@@ -155,10 +156,10 @@ corpusDocument = R.createElement corpusDocumentCpt
corpusDocumentCpt :: R.Component CorpusDocumentProps
corpusDocumentCpt = here.component "corpusDocument" cpt
where
cpt props@{ boxes, corpusId: corpusId', listId, nodeId, session, sessionId
, tasks
} _ = do
cpt props@{ boxes, corpusId: corpusId', listId, nodeId, session, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
}
forested { boxes }
[ documentMainLayout { mCorpusId: corpusId, listId: listId, nodeId, session } [] ]
where corpusId = Just corpusId'
...
...
@@ -168,10 +169,10 @@ dashboard = R.createElement dashboardCpt
dashboardCpt :: R.Component SessionNodeProps
dashboardCpt = here.component "dashboard" cpt
where
cpt props@{ boxes, nodeId, session
, tasks
} _ = do
cpt props@{ boxes, nodeId, session } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ dashboardLayout { nodeId, session } [] ]
forested { boxes } [ dashboardLayout { nodeId, session } [] ]
type DocumentProps = ( listId :: ListId | SessionNodeProps )
...
...
@@ -180,10 +181,10 @@ document = R.createElement documentCpt
documentCpt :: R.Component DocumentProps
documentCpt = here.component "document" cpt where
cpt props@{ listId, nodeId, session, sessionId,
tasks,
boxes } _ = do
cpt props@{ listId, nodeId, session, sessionId, boxes } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
}
forested { boxes }
[ documentMainLayout { listId, nodeId, mCorpusId, session } [] ]
where mCorpusId = Nothing
...
...
@@ -192,8 +193,8 @@ home = R.createElement homeCpt
homeCpt :: R.Component Props
homeCpt = here.component "home" cpt where
cpt props@{ boxes: boxes@{ sessions, showLogin }
, tasks
} _ = do
pure $ forested { boxes
, tasks
} [ homeLayout { lang: LL_EN, sessions, showLogin } ]
cpt props@{ boxes: boxes@{ sessions, showLogin } } _ = do
pure $ forested { boxes } [ homeLayout { lang: LL_EN, sessions, showLogin } ]
lists :: R2.Component SessionNodeProps
lists = R.createElement listsCpt
...
...
@@ -207,11 +208,11 @@ listsCpt = here.component "lists" cpt where
, reloadRoot
, route
, sessions
, showLogin }
, showLogin
, tasks }
, nodeId
, session
, sessionId
, tasks } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
Lists.listsWithForestSessionContext
...
...
@@ -246,10 +247,9 @@ graphExplorer = R.createElement graphExplorerCpt
graphExplorerCpt :: R.Component SessionNodeProps
graphExplorerCpt = here.component "graphExplorer" cpt where
cpt props@{ boxes: { backend, handed, route, sessions, showLogin }
cpt props@{ boxes: { backend, handed, route, sessions, showLogin
, tasks
}
, nodeId
, session
, tasks } _ = do
, session } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
simpleLayout { handed }
...
...
@@ -269,10 +269,10 @@ routeFile = R.createElement routeFileCpt
routeFileCpt :: R.Component SessionNodeProps
routeFileCpt = here.component "routeFile" cpt where
cpt props@{ nodeId, session, sessionId, boxes
, tasks
} _ = do
cpt props@{ nodeId, session, sessionId, boxes } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ fileLayout { nodeId, session } ]
forested { boxes } [ fileLayout { nodeId, session } ]
type RouteFrameProps = (
nodeType :: NodeType
...
...
@@ -284,20 +284,20 @@ routeFrame = R.createElement routeFrameCpt
routeFrameCpt :: R.Component RouteFrameProps
routeFrameCpt = here.component "routeFrame" cpt where
cpt props@{ nodeId, nodeType, session, sessionId, boxes
, tasks
} _ = do
cpt props@{ nodeId, nodeType, session, sessionId, boxes } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ frameLayout { nodeId, nodeType, session } ]
forested { boxes } [ frameLayout { nodeId, nodeType, session } ]
team :: R2.Component SessionNodeProps
team = R.createElement teamCpt
teamCpt :: R.Component SessionNodeProps
teamCpt = here.component "team" cpt where
cpt props@{ nodeId, session, sessionId, boxes
, tasks
} _ = do
cpt props@{ nodeId, session, sessionId, boxes } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
} [ corpusLayout { nodeId, session } ]
forested { boxes } [ corpusLayout { nodeId, session } ]
texts :: R2.Component SessionNodeProps
texts = R.createElement textsCpt
...
...
@@ -312,11 +312,11 @@ textsCpt = here.component "texts" cpt
, reloadRoot
, route
, sessions
, showLogin }
, showLogin
, tasks }
, nodeId
, session
, sessionId
, tasks } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
Texts.textsWithForestSessionContext
...
...
@@ -342,14 +342,13 @@ user = R.createElement userCpt
userCpt :: R.Component SessionNodeProps
userCpt = here.component "user" cpt where
cpt props@{ boxes: boxes@{ reloadForest, reloadRoot }
cpt props@{ boxes: boxes@{ reloadForest, reloadRoot
, tasks
}
, nodeId
, session
, sessionId
, tasks } _ = do
, sessionId } _ = do
let sessionProps = RE.pick props :: Record SessionProps
pure $ authed sessionProps $
forested { boxes
, tasks
}
forested { boxes }
[ userLayoutSessionContext { frontends
, nodeId
, reloadForest
...
...
@@ -365,8 +364,8 @@ contact = R.createElement contactCpt
contactCpt :: R.Component ContactProps
contactCpt = here.component "contact" cpt where
cpt props@{ annuaireId, nodeId, session, sessionId
, tasks
, boxes: { reloadForest, reloadRoot } } _ = do
cpt props@{ annuaireId, nodeId, session, sessionId
, boxes: { reloadForest, reloadRoot
, tasks
} } _ = do
let sessionProps = RE.pick props :: Record SessionProps
let forestedProps = RE.pick props :: Record Props
pure $ authed sessionProps $
...
...
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