Revert "[refactor] remove 'session' from various Props in favor of"

This reverts commit a6ec0726.
parent 10d40f6b
Pipeline #3614 failed with stage
in 0 seconds
...@@ -34,7 +34,6 @@ import Gargantext.Config.REST (AffRESTError, logRESTError) ...@@ -34,7 +34,6 @@ import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler) import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (AppRoute(Home), appPath, nodeTypeAppRoute) import Gargantext.Routes (AppRoute(Home), appPath, nodeTypeAppRoute)
import Gargantext.Sessions (Session(..), sessionId) import Gargantext.Sessions (Session(..), sessionId)
import Gargantext.Types (NodeType(..), SessionId) import Gargantext.Types (NodeType(..), SessionId)
...@@ -49,8 +48,8 @@ here :: R2.Here ...@@ -49,8 +48,8 @@ here :: R2.Here
here = R2.here "Gargantext.Components.FolderView" here = R2.here "Gargantext.Components.FolderView"
type Props = type Props =
( nodeId :: Int ( nodeId :: Int
, session :: Session , session :: Session
) )
data FolderStyle = FolderUp | FolderChild data FolderStyle = FolderUp | FolderChild
...@@ -263,35 +262,28 @@ backButtonCpt = here.component "backButton" cpt where ...@@ -263,35 +262,28 @@ backButtonCpt = here.component "backButton" cpt where
H.i { className: "fa fa-arrow-left", title: "Previous view"} [] H.i { className: "fa fa-arrow-left", title: "Previous view"} []
] ]
type BackButtonSmartProps = backButtonSmart :: R2.Component (nodeId :: Int, session :: Session)
( nodeId :: Int )
backButtonSmart :: R2.Component BackButtonSmartProps
backButtonSmart = R.createElement backButtonSmartCpt backButtonSmart = R.createElement backButtonSmartCpt
backButtonSmartCpt :: R.Component BackButtonSmartProps
backButtonSmartCpt :: R.Component (nodeId :: Int, session :: Session)
backButtonSmartCpt = here.component "backButtonSmart" cpt where backButtonSmartCpt = here.component "backButtonSmart" cpt where
cpt {nodeId} _ = do cpt {nodeId, session} _ = do
session <- useSession
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler useLoader { errorHandler
, loader: loadNode , loader: loadNode
, path: { nodeId, session, reload: reload' } , path: { nodeId, session, reload: reload' }
, render: \node -> backButtonSmartMain { node } [] , render: \node -> backButtonSmartMain { node, session } []
} }
where where
errorHandler = logRESTError here "[folderView]" errorHandler = logRESTError here "[folderView]"
type BackButtonSmartMainProps = backButtonSmartMain :: R2.Component (node :: Node, session :: Session)
( node :: Node )
backButtonSmartMain :: R2.Component BackButtonSmartMainProps
backButtonSmartMain = R.createElement backButtonSmartMainCpt backButtonSmartMain = R.createElement backButtonSmartMainCpt
backButtonSmartMainCpt :: R.Component BackButtonSmartMainProps
backButtonSmartMainCpt = here.component "backButtonSmartMain" cpt where
cpt { node } _ = do
session <- useSession
backButtonSmartMainCpt :: R.Component (node :: Node, session :: Session)
backButtonSmartMainCpt = here.component "backButtonSmartMain" cpt where
cpt { node, session } _ = do
handlers <- useLinkHandler handlers <- useLinkHandler
let rootId = treeId session let rootId = treeId session
......
...@@ -31,7 +31,6 @@ import Gargantext.Config.REST (AffRESTError, logRESTError) ...@@ -31,7 +31,6 @@ import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, mkNodeId) import Gargantext.Sessions (Session, get, mkNodeId)
import Gargantext.Sessions.Types (useOpenNodesMemberBox, openNodesInsert, openNodesDelete) import Gargantext.Sessions.Types (useOpenNodesMemberBox, openNodesInsert, openNodesDelete)
...@@ -64,11 +63,11 @@ type LoaderProps = ...@@ -64,11 +63,11 @@ type LoaderProps =
type NodeProps = type NodeProps =
( reloadTree :: T2.ReloadS ( reloadTree :: T2.ReloadS
, session :: Session
| Common ) | Common )
type TreeProps = type TreeProps =
( root :: ID ( root :: ID
, session :: Session
, tree :: FTree , tree :: FTree
| NodeProps ) | NodeProps )
...@@ -82,13 +81,15 @@ type ChildrenTreeProps = ...@@ -82,13 +81,15 @@ type ChildrenTreeProps =
type PACommon = type PACommon =
( boxes :: Boxes ( boxes :: Boxes
, reloadTree :: T2.ReloadS , reloadTree :: T2.ReloadS
, session :: Session
, tree :: FTree , tree :: FTree
) )
-- The properties tree shares in common with nodeSpan -- The properties tree shares in common with nodeSpan
type NSCommon = type NSCommon =
( frontends :: Frontends ( frontends :: Frontends
, handed :: Handed ) , handed :: Handed
, session :: Session )
-- The annoying 'render' here is busting a cycle in the low tech -- The annoying 'render' here is busting a cycle in the low tech
-- way. This function is only called by functions in this module, so -- way. This function is only called by functions in this module, so
...@@ -97,19 +98,18 @@ type ChildLoaderProps = ...@@ -97,19 +98,18 @@ type ChildLoaderProps =
( id :: ID ( id :: ID
, render :: R2.Leaf TreeProps , render :: R2.Leaf TreeProps
, root :: ID , root :: ID
, session :: Session
| NodeProps | NodeProps
) )
type PerformActionProps = type PerformActionProps =
( isBoxVisible :: T.Box Boolean ( isBoxVisible :: T.Box Boolean
, session :: Session
| PACommon | PACommon
) )
-- | Loads and renders the tree starting at the given root node id. -- | Loads and renders the tree starting at the given root node id.
treeLoader :: R2.Leaf ( key :: String | LoaderProps ) treeLoader :: R2.Leaf ( key :: String | LoaderProps )
treeLoader = R2.leaf treeLoaderCpt treeLoader = R2.leaf treeLoaderCpt
treeLoaderCpt :: R.Component ( key :: String | LoaderProps ) treeLoaderCpt :: R.Component ( key :: String | LoaderProps )
treeLoaderCpt = here.component "treeLoader" cpt where treeLoaderCpt = here.component "treeLoader" cpt where
-- treeLoaderCpt :: R.Memo LoaderProps -- treeLoaderCpt :: R.Memo LoaderProps
...@@ -163,7 +163,6 @@ treeCpt = here.component "tree" cpt where ...@@ -163,7 +163,6 @@ treeCpt = here.component "tree" cpt where
, root , root
, session , session
, tree: NTree (LNode { id, name, nodeType }) children } _ = do , tree: NTree (LNode { id, name, nodeType }) children } _ = do
let nodeId = mkNodeId session id
isBoxVisible <- T.useBox false isBoxVisible <- T.useBox false
folderOpen <- useOpenNodesMemberBox nodeId forestOpen folderOpen <- useOpenNodesMemberBox nodeId forestOpen
...@@ -185,7 +184,7 @@ treeCpt = here.component "tree" cpt where ...@@ -185,7 +184,7 @@ treeCpt = here.component "tree" cpt where
[ [
nodeSpan nodeSpan
{ boxes { boxes
, dispatch: dispatch' isBoxVisible session , dispatch: dispatch' isBoxVisible
, folderOpen , folderOpen
, frontends , frontends
, id , id
...@@ -194,8 +193,8 @@ treeCpt = here.component "tree" cpt where ...@@ -194,8 +193,8 @@ treeCpt = here.component "tree" cpt where
, nodeType , nodeType
, reload , reload
, root , root
, isBoxVisible
, session , session
, isBoxVisible
} }
<> <>
R2.when (folderOpen') R2.when (folderOpen')
...@@ -212,11 +211,12 @@ treeCpt = here.component "tree" cpt where ...@@ -212,11 +211,12 @@ treeCpt = here.component "tree" cpt where
] ]
where where
isLeaf = A.null children isLeaf = A.null children
nodeId = mkNodeId session id
children' = A.sortWith fTreeID pubChildren children' = A.sortWith fTreeID pubChildren
pubChildren = if isPublic nodeType then map (map pub) children else children pubChildren = if isPublic nodeType then map (map pub) children else children
dispatch' isBoxVisible session a = performAction a (Record.merge common' extra) where dispatch' isBoxVisible a = performAction a (Record.merge common' extra) where
common' = RecordE.pick p :: Record PACommon common' = RecordE.pick p :: Record PACommon
extra = { isBoxVisible, session } extra = { isBoxVisible }
pub (LNode n@{ nodeType: t }) = LNode (n { nodeType = publicize t }) pub (LNode n@{ nodeType: t }) = LNode (n { nodeType = publicize t })
...@@ -245,14 +245,13 @@ renderTreeChildrenCpt :: R.Component ChildrenTreeProps ...@@ -245,14 +245,13 @@ renderTreeChildrenCpt :: R.Component ChildrenTreeProps
renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
cpt p@{ childProps: { children' cpt p@{ childProps: { children'
, render } , render }
, root , root } _ = do
, session } _ = do
pure $ R.fragment (map renderChild children') pure $ R.fragment (map renderChild children')
where where
nodeProps = RecordE.pick p :: Record NodeProps nodeProps = RecordE.pick p :: Record NodeProps
renderChild (NTree (LNode {id: cId}) _) = childLoader props [] where renderChild (NTree (LNode {id: cId}) _) = childLoader props [] where
props = Record.merge nodeProps { id: cId, render, root, session } props = Record.merge nodeProps { id: cId, render, root }
childLoader :: R2.Component ChildLoaderProps childLoader :: R2.Component ChildLoaderProps
...@@ -262,10 +261,7 @@ childLoaderCpt = here.component "childLoader" cpt where ...@@ -262,10 +261,7 @@ childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ boxes: { reloadRoot } cpt p@{ boxes: { reloadRoot }
, reloadTree , reloadTree
, render , render
, root , root } _ = do
, session } _ = do
let fetch _ = getNodeTreeFirstLevel session p.id
-- States -- States
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
state /\ stateBox <- R2.useBox' Nothing state /\ stateBox <- R2.useBox' Nothing
...@@ -294,9 +290,10 @@ childLoaderCpt = here.component "childLoader" cpt where ...@@ -294,9 +290,10 @@ childLoaderCpt = here.component "childLoader" cpt where
where where
errorHandler = logRESTError here "[childLoader]" errorHandler = logRESTError here "[childLoader]"
fetch _ = getNodeTreeFirstLevel p.session p.id
paint reload tree' = render (Record.merge base extra) where paint reload tree' = render (Record.merge base extra) where
base = nodeProps { reload = reload } base = nodeProps { reload = reload }
extra = { root, session, tree: tree' } extra = { root, tree: tree' }
nodeProps = RecordE.pick p :: Record NodeProps nodeProps = RecordE.pick p :: Record NodeProps
closeBox { isBoxVisible } = closeBox { isBoxVisible } =
......
...@@ -30,7 +30,6 @@ import Gargantext.Config.REST (logRESTError) ...@@ -30,7 +30,6 @@ import Gargantext.Config.REST (logRESTError)
import Gargantext.Context.Progress (asyncContext, asyncProgress) import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url) import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Version (Version, useVersion) import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId) import Gargantext.Sessions (Session, sessionId)
...@@ -64,8 +63,8 @@ type NodeSpanProps = ...@@ -64,8 +63,8 @@ type NodeSpanProps =
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, reload :: T2.ReloadS , reload :: T2.ReloadS
, root :: ID , root :: ID
, isBoxVisible :: T.Box Boolean
, session :: Session , session :: Session
, isBoxVisible :: T.Box Boolean
) )
type IsLeaf = Boolean type IsLeaf = Boolean
...@@ -88,10 +87,10 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -88,10 +87,10 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, isLeaf , isLeaf
, nodeType , nodeType
, reload , reload
, isBoxVisible
, session , session
, isBoxVisible
} _ = do } _ = do
-- States -- States
route' <- T.useLive T.unequal route route' <- T.useLive T.unequal route
-- only 1 popup at a time is allowed to be opened -- only 1 popup at a time is allowed to be opened
...@@ -324,6 +323,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt ...@@ -324,6 +323,7 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, errors , errors
, nodeId: id , nodeId: id
, onFinish: onTaskFinish id task , onFinish: onTaskFinish id task
, session
} }
[ [
taskProgress taskProgress
...@@ -555,6 +555,7 @@ type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon ) ...@@ -555,6 +555,7 @@ type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon )
nodeActions :: R2.Component NodeActionsProps nodeActions :: R2.Component NodeActionsProps
nodeActions = R.createElement nodeActionsCpt nodeActions = R.createElement nodeActionsCpt
nodeActionsCpt :: R.Component NodeActionsProps nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = here.component "nodeActions" cpt where nodeActionsCpt = here.component "nodeActions" cpt where
cpt props _ = pure (child props.nodeType) cpt props _ = pure (child props.nodeType)
...@@ -571,7 +572,7 @@ graphNodeActions :: R2.Leaf NodeActionsCommon ...@@ -571,7 +572,7 @@ graphNodeActions :: R2.Leaf NodeActionsCommon
graphNodeActions = R2.leafComponent graphNodeActionsCpt graphNodeActions = R2.leafComponent graphNodeActionsCpt
graphNodeActionsCpt :: R.Component NodeActionsCommon graphNodeActionsCpt :: R.Component NodeActionsCommon
graphNodeActionsCpt = here.component "graphNodeActions" cpt where graphNodeActionsCpt = here.component "graphNodeActions" cpt where
cpt { id, refresh, session } _ = do cpt { id, session, refresh } _ = do
-- States -- States
state /\ stateBox <- R2.useBox' Nothing state /\ stateBox <- R2.useBox' Nothing
...@@ -587,7 +588,7 @@ graphNodeActionsCpt = here.component "graphNodeActions" cpt where ...@@ -587,7 +588,7 @@ graphNodeActionsCpt = here.component "graphNodeActions" cpt where
pure $ R2.fromMaybe state \gv -> pure $ R2.fromMaybe state \gv ->
nodeActionsGraph nodeActionsGraph
{ graphVersions: gv, id, refresh, session } { graphVersions: gv, session, id, refresh }
[] []
graphVersions session graphId = GraphAPI.graphVersions { graphId, session } graphVersions session graphId = GraphAPI.graphVersions { graphId, session }
...@@ -598,7 +599,7 @@ listNodeActions :: R2.Leaf NodeActionsCommon ...@@ -598,7 +599,7 @@ listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions = R2.leafComponent listNodeActionsCpt listNodeActions = R2.leafComponent listNodeActionsCpt
listNodeActionsCpt :: R.Component NodeActionsCommon listNodeActionsCpt :: R.Component NodeActionsCommon
listNodeActionsCpt = here.component "listNodeActions" cpt where listNodeActionsCpt = here.component "listNodeActions" cpt where
cpt { id, refresh, session } _ = do cpt { id, session, refresh } _ = do
-- States -- States
state /\ stateBox <- R2.useBox' Nothing state /\ stateBox <- R2.useBox' Nothing
...@@ -616,6 +617,7 @@ listNodeActionsCpt = here.component "listNodeActions" cpt where ...@@ -616,6 +617,7 @@ listNodeActionsCpt = here.component "listNodeActions" cpt where
nodeActionsNodeList nodeActionsNodeList
{ listId: id { listId: id
, nodeId: corpusId , nodeId: corpusId
, session
, refresh: refresh , refresh: refresh
, nodeType: GT.TabNgramType GT.CTabTerms , nodeType: GT.TabNgramType GT.CTabTerms
} }
......
...@@ -8,12 +8,14 @@ import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..)) ...@@ -8,12 +8,14 @@ import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), glyphiconNodeAction) import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), glyphiconNodeAction)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (ID) import Gargantext.Components.Forest.Tree.Node.Tools.FTree (ID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut, SubTreeParams(..)) import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut, SubTreeParams(..))
import Gargantext.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
type Props = type Props =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, id :: ID , id :: ID
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, session :: Session
) )
subTreeOut :: Action -> Maybe SubTreeOut subTreeOut :: Action -> Maybe SubTreeOut
......
...@@ -7,7 +7,6 @@ import Data.String.Common (toLower) ...@@ -7,7 +7,6 @@ import Data.String.Common (toLower)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode)) import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode))
import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, panel, submitButtonHref) import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, panel, submitButtonHref)
import Gargantext.Ends (url) import Gargantext.Ends (url)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
...@@ -24,7 +23,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download" ...@@ -24,7 +23,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
-- | Action : Download -- | Action : Download
type ActionDownload = type ActionDownload =
( id :: ID ( id :: ID
, nodeType :: GT.NodeType ) , nodeType :: GT.NodeType
, session :: Session )
actionDownload :: R2.Component ActionDownload actionDownload :: R2.Component ActionDownload
actionDownload = R.createElement actionDownloadCpt actionDownload = R.createElement actionDownloadCpt
...@@ -40,24 +40,22 @@ actionDownloadCorpus :: R2.Component ActionDownload ...@@ -40,24 +40,22 @@ actionDownloadCorpus :: R2.Component ActionDownload
actionDownloadCorpus = R.createElement actionDownloadCorpusCpt actionDownloadCorpus = R.createElement actionDownloadCorpusCpt
actionDownloadCorpusCpt :: R.Component ActionDownload actionDownloadCorpusCpt :: R.Component ActionDownload
actionDownloadCorpusCpt = here.component "actionDownloadCorpus" cpt where actionDownloadCorpusCpt = here.component "actionDownloadCorpus" cpt where
cpt { id } _ = do cpt { id, session } _ = do
session <- useSession
pure $ panel [H.div {} [H.text info]] pure $ panel [H.div {} [H.text info]]
(submitButtonHref DownloadNode (href session)) (submitButtonHref DownloadNode href)
where where
href session = url session $ Routes.NodeAPI GT.Corpus (Just id) "export" href = url session $ Routes.NodeAPI GT.Corpus (Just id) "export"
info = "Download as JSON" info = "Download as JSON"
actionDownloadGraph :: R2.Component ActionDownload actionDownloadGraph :: R2.Component ActionDownload
actionDownloadGraph = R.createElement actionDownloadGraphCpt actionDownloadGraph = R.createElement actionDownloadGraphCpt
actionDownloadGraphCpt :: R.Component ActionDownload actionDownloadGraphCpt :: R.Component ActionDownload
actionDownloadGraphCpt = here.component "actionDownloadGraph" cpt where actionDownloadGraphCpt = here.component "actionDownloadGraph" cpt where
cpt { id } _ = do cpt { id, session } _ = do
session <- useSession
pure $ panel [H.div {} [H.text info]] pure $ panel [H.div {} [H.text info]]
(submitButtonHref DownloadNode (href session)) (submitButtonHref DownloadNode href)
where where
href session = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf" href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
info = "Info about the Graph as GEXF format" info = "Info about the Graph as GEXF format"
data NodeListDownloadFormat = NL_CSV | NL_JSON data NodeListDownloadFormat = NL_CSV | NL_JSON
...@@ -77,9 +75,7 @@ actionDownloadNodeList :: R2.Component ActionDownload ...@@ -77,9 +75,7 @@ actionDownloadNodeList :: R2.Component ActionDownload
actionDownloadNodeList = R.createElement actionDownloadNodeListCpt actionDownloadNodeList = R.createElement actionDownloadNodeListCpt
actionDownloadNodeListCpt :: R.Component ActionDownload actionDownloadNodeListCpt :: R.Component ActionDownload
actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
cpt { id } _ = do cpt { id, session } _ = do
session <- useSession
downloadFormat <- T.useBox NL_JSON downloadFormat <- T.useBox NL_JSON
downloadFormat' <- T.useLive T.unequal downloadFormat downloadFormat' <- T.useLive T.unequal downloadFormat
...@@ -91,14 +87,14 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where ...@@ -91,14 +87,14 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
, opt NL_JSON downloadFormat ] , opt NL_JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ] , H.div {} [ H.text $ info downloadFormat' ]
] ]
(submitButtonHref DownloadNode $ href downloadFormat' session) (submitButtonHref DownloadNode $ href downloadFormat')
where where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ] opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where where
onClick _ = T.write_ t downloadFormat onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readNodeListDownloadFormat $ R.unsafeEventValue e) downloadFormat onChange downloadFormat e = T.write_ (readNodeListDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeListDownloadFormat -> Session -> String href :: NodeListDownloadFormat -> String
href t session = url session $ Routes.NodeAPI GT.NodeList (Just id) (toLower $ show t) href t = url session $ Routes.NodeAPI GT.NodeList (Just id) (toLower $ show t)
info :: NodeListDownloadFormat -> String info :: NodeListDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format" info t = "Info about the Documents as " <> show t <> " format"
...@@ -122,9 +118,7 @@ actionDownloadNodeTexts :: R2.Component ActionDownload ...@@ -122,9 +118,7 @@ actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTextsCpt :: R.Component ActionDownload actionDownloadNodeTextsCpt :: R.Component ActionDownload
actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
cpt { id } _ = do cpt { id, session } _ = do
session <- useSession
downloadFormat <- T.useBox NT_JSON downloadFormat <- T.useBox NT_JSON
downloadFormat' <- T.useLive T.unequal downloadFormat downloadFormat' <- T.useLive T.unequal downloadFormat
...@@ -136,14 +130,14 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where ...@@ -136,14 +130,14 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
, opt NT_JSON downloadFormat ] , opt NT_JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ] , H.div {} [ H.text $ info downloadFormat' ]
] ]
(submitButtonHref DownloadNode $ href downloadFormat' session) (submitButtonHref DownloadNode $ href downloadFormat')
where where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ] opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where where
onClick _ = T.write_ t downloadFormat onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readNodeTextsDownloadFormat $ R.unsafeEventValue e) downloadFormat onChange downloadFormat e = T.write_ (readNodeTextsDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeTextsDownloadFormat -> Session -> String href :: NodeTextsDownloadFormat -> String
href t session = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t) href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t)
info :: NodeTextsDownloadFormat -> String info :: NodeTextsDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format" info t = "Info about the Documents as " <> show t <> " format"
......
...@@ -37,7 +37,7 @@ linkNode = R.createElement linkNodeCpt ...@@ -37,7 +37,7 @@ linkNode = R.createElement linkNodeCpt
linkNodeCpt :: R.Component SubTreeParamsIn linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = here.component "linkNode" cpt linkNodeCpt = here.component "linkNode" cpt
where where
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams } _ = do
action <- T.useBox (LinkNode { nodeType: Nothing, params: Nothing}) action <- T.useBox (LinkNode { nodeType: Nothing, params: Nothing})
pure $ pure $
...@@ -47,6 +47,7 @@ linkNodeCpt = here.component "linkNode" cpt ...@@ -47,6 +47,7 @@ linkNodeCpt = here.component "linkNode" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
...@@ -61,7 +62,7 @@ linkNode' = R.createElement linkNodeCpt' ...@@ -61,7 +62,7 @@ linkNode' = R.createElement linkNodeCpt'
linkNodeCpt' :: R.Component Props linkNodeCpt' :: R.Component Props
linkNodeCpt' = here.component "__clone__" cpt linkNodeCpt' = here.component "__clone__" cpt
where where
cpt { boxes, dispatch, id, nodeType, subTreeParams, action } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams, action } _ = do
action' <- T.useLive T.unequal action action' <- T.useLive T.unequal action
...@@ -81,6 +82,7 @@ linkNodeCpt' = here.component "__clone__" cpt ...@@ -81,6 +82,7 @@ linkNodeCpt' = here.component "__clone__" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
] button ] button
......
...@@ -11,7 +11,6 @@ import Gargantext.Components.GraphQL.Endpoints (deleteTeamMembership, getTeam) ...@@ -11,7 +11,6 @@ import Gargantext.Components.GraphQL.Endpoints (deleteTeamMembership, getTeam)
import Gargantext.Components.GraphQL.Team (Team, TeamMember) import Gargantext.Components.GraphQL.Team (Team, TeamMember)
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (ID, NodeType) import Gargantext.Types (ID, NodeType)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -25,19 +24,21 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.ManageTeam" ...@@ -25,19 +24,21 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.ManageTeam"
type ActionManageTeam = ( type ActionManageTeam = (
id :: ID id :: ID
, nodeType :: NodeType , nodeType :: NodeType
, session :: Session
) )
actionManageTeam :: R2.Component ActionManageTeam actionManageTeam :: R2.Component ActionManageTeam
actionManageTeam = R.createElement actionManageTeamCpt actionManageTeam = R.createElement actionManageTeamCpt
actionManageTeamCpt :: R.Component ActionManageTeam actionManageTeamCpt :: R.Component ActionManageTeam
actionManageTeamCpt = here.component "actionManageTeam" cpt where actionManageTeamCpt = here.component "actionManageTeam" cpt where
cpt {id} _ = do cpt {id, session} _ = do
session <- useSession
useLoader { errorHandler useLoader { errorHandler
, loader: loadTeam , loader: loadTeam
, path: { nodeId: id, session } , path: { nodeId: id, session }
, render: \team -> teamLayoutWrapper { team , render: \team -> teamLayoutWrapper { team
, nodeId: id , nodeId: id
, session
} [] } []
} }
where where
...@@ -45,25 +46,28 @@ actionManageTeamCpt = here.component "actionManageTeam" cpt where ...@@ -45,25 +46,28 @@ actionManageTeamCpt = here.component "actionManageTeam" cpt where
type TeamProps = type TeamProps =
( nodeId :: ID ( nodeId :: ID
, session :: Session
, team :: Team , team :: Team
) )
teamLayoutWrapper :: R2.Component TeamProps teamLayoutWrapper :: R2.Component TeamProps
teamLayoutWrapper = R.createElement teamLayoutWrapperCpt teamLayoutWrapper = R.createElement teamLayoutWrapperCpt
teamLayoutWrapperCpt :: R.Component TeamProps teamLayoutWrapperCpt :: R.Component TeamProps
teamLayoutWrapperCpt = here.component "teamLayoutWrapper" cpt where teamLayoutWrapperCpt = here.component "teamLayoutWrapper" cpt where
cpt {nodeId, team: {team_owner_username, team_members}} _ = do cpt {nodeId, session, team: {team_owner_username, team_members}} _ = do
teamS <- T.useBox team_members teamS <- T.useBox team_members
team' <- T.useLive T.unequal teamS team' <- T.useLive T.unequal teamS
error <- T.useBox "" error <- T.useBox ""
error' <- T.useLive T.unequal error error' <- T.useLive T.unequal error
pure $ teamLayoutRows {nodeId, team: teamS, team', error, error', team_owner_username} pure $ teamLayoutRows {nodeId, session, team: teamS, team', error, error', team_owner_username}
type TeamRowProps = type TeamRowProps =
( nodeId :: ID ( nodeId :: ID
, session :: Session
, team :: T.Box (Array TeamMember) , team :: T.Box (Array TeamMember)
, error :: T.Box String , error :: T.Box String
, team' :: Array TeamMember , team' :: Array TeamMember
, error' :: String , error' :: String
, team_owner_username :: String , team_owner_username :: String
...@@ -71,23 +75,10 @@ type TeamRowProps = ...@@ -71,23 +75,10 @@ type TeamRowProps =
teamLayoutRows :: R2.Leaf TeamRowProps teamLayoutRows :: R2.Leaf TeamRowProps
teamLayoutRows = R2.leafComponent teamLayoutRowsCpt teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamRowProps teamLayoutRowsCpt :: R.Component TeamRowProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
cpt { team, nodeId, error, team', error', team_owner_username} _ = do cpt { team, nodeId, session, error, team', error', team_owner_username} _ = do
session <- useSession
let submit sharedFolderId _ = do
runAff_ callback $ saveDeleteTeam { session, nodeId, sharedFolderId }
makeTeam :: TeamMember -> R.Element
makeTeam { username, shared_folder_id } =
H.div {className: "from-group row"} [ H.div { className: "col-8" } [ H.text username ]
, H.a { className: "text-danger col-2 fa fa-times"
, title: "Remove user from team"
, type: "button"
, on: {click: submit shared_folder_id }
} []
]
case null team' of case null team' of
true -> pure $ H.div { style: {margin: "10px"}} true -> pure $ H.div { style: {margin: "10px"}}
...@@ -95,11 +86,22 @@ teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where ...@@ -95,11 +86,22 @@ teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
false -> pure $ Tools.panel (makeLeader team_owner_username : (map makeTeam team')) (H.div {} [H.text error']) false -> pure $ Tools.panel (makeLeader team_owner_username : (map makeTeam team')) (H.div {} [H.text error'])
where where
makeTeam :: TeamMember -> R.Element
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ] makeTeam { username, shared_folder_id } = H.div {className: "from-group row"} [ H.div { className: "col-8" } [ H.text username ]
, H.a { className: "text-danger col-2 fa fa-times"
, title: "Remove user from team"
, type: "button"
, on: {click: submit shared_folder_id }
} []
]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
, H.p { className: "col-2"} [ H.text "owner"] , H.p { className: "col-2"} [ H.text "owner"]
] ]
submit sharedFolderId _ = do
runAff_ callback $ saveDeleteTeam { session, nodeId, sharedFolderId }
callback res = callback res =
case res of case res of
Left _ -> do Left _ -> do
......
...@@ -28,7 +28,7 @@ mergeNode = R.createElement mergeNodeCpt ...@@ -28,7 +28,7 @@ mergeNode = R.createElement mergeNodeCpt
mergeNodeCpt :: R.Component SubTreeParamsIn mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt = here.component "mergeNode" cpt mergeNodeCpt = here.component "mergeNode" cpt
where where
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams } _ = do
action <- T.useBox (MergeNode { params: Nothing }) action <- T.useBox (MergeNode { params: Nothing })
action' <- T.useLive T.unequal action action' <- T.useLive T.unequal action
...@@ -47,6 +47,7 @@ mergeNodeCpt = here.component "mergeNode" cpt ...@@ -47,6 +47,7 @@ mergeNodeCpt = here.component "mergeNode" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
, H.ul { className:"merge mx-auto list-group"} , H.ul { className:"merge mx-auto list-group"}
......
...@@ -30,7 +30,7 @@ moveNode = R.createElement moveNodeCpt ...@@ -30,7 +30,7 @@ moveNode = R.createElement moveNodeCpt
moveNodeCpt :: R.Component SubTreeParamsIn moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = here.component "moveNode" cpt moveNodeCpt = here.component "moveNode" cpt
where where
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams } _ = do
action :: T.Box Action <- T.useBox (MoveNode {params: Nothing}) action :: T.Box Action <- T.useBox (MoveNode {params: Nothing})
pure $ pure $
...@@ -40,6 +40,7 @@ moveNodeCpt = here.component "moveNode" cpt ...@@ -40,6 +40,7 @@ moveNodeCpt = here.component "moveNode" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
...@@ -53,7 +54,7 @@ moveNode' :: R2.Component Props ...@@ -53,7 +54,7 @@ moveNode' :: R2.Component Props
moveNode' = R.createElement moveNodeCpt' moveNode' = R.createElement moveNodeCpt'
moveNodeCpt' :: R.Component Props moveNodeCpt' :: R.Component Props
moveNodeCpt' = here.component "__clone__" cpt where moveNodeCpt' = here.component "__clone__" cpt where
cpt { boxes, dispatch, id, nodeType, subTreeParams, action } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams, action } _ = do
action' <- T.useLive T.unequal action action' <- T.useLive T.unequal action
...@@ -71,6 +72,7 @@ moveNodeCpt' = here.component "__clone__" cpt where ...@@ -71,6 +72,7 @@ moveNodeCpt' = here.component "__clone__" cpt where
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
] button ] button
...@@ -73,7 +73,7 @@ searchFieldCpt = here.component "searchField" cpt ...@@ -73,7 +73,7 @@ searchFieldCpt = here.component "searchField" cpt
-- H.div {}[] -- H.div {}[]
-- else -- else
, datafieldInput { databases, langs, search, session } [] , datafieldInput { databases, langs, search, session } []
, ListSelection.selection { selection } [] , ListSelection.selection { selection, session } []
, submitButton { errors, onSearch, search, selection, session } [] , submitButton { errors, onSearch, search, selection, session } []
] ]
--pure $ panel params button --pure $ panel params button
...@@ -527,7 +527,6 @@ submitButtonComponent :: R.Component SubmitButtonProps ...@@ -527,7 +527,6 @@ submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = here.component "submitButton" cpt submitButtonComponent = here.component "submitButton" cpt
where where
cpt { errors, onSearch, search, selection, session } _ = do cpt { errors, onSearch, search, selection, session } _ = do
search' <- T.useLive T.unequal search search' <- T.useLive T.unequal search
selection' <- T.useLive T.unequal selection selection' <- T.useLive T.unequal selection
......
...@@ -20,6 +20,7 @@ import Gargantext.Utils.SimpleJSON as GUSJ ...@@ -20,6 +20,7 @@ import Gargantext.Utils.SimpleJSON as GUSJ
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Simple.JSON as JSON import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Toestand as T import Toestand as T
here :: R2.Here here :: R2.Here
...@@ -73,7 +74,7 @@ publishNode = R.createElement publishNodeCpt ...@@ -73,7 +74,7 @@ publishNode = R.createElement publishNodeCpt
publishNodeCpt :: R.Component SubTreeParamsIn publishNodeCpt :: R.Component SubTreeParamsIn
publishNodeCpt = here.component "publishNode" cpt publishNodeCpt = here.component "publishNode" cpt
where where
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do cpt { boxes, dispatch, id, nodeType, session, subTreeParams } _ = do
action <- T.useBox (Action.SharePublic { params: Nothing }) action <- T.useBox (Action.SharePublic { params: Nothing })
action' <- T.useLive T.unequal action action' <- T.useLive T.unequal action
...@@ -89,6 +90,7 @@ publishNodeCpt = here.component "publishNode" cpt ...@@ -89,6 +90,7 @@ publishNodeCpt = here.component "publishNode" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} [] } []
] button ] button
...@@ -28,7 +28,6 @@ import Gargantext.Components.ListSelection as ListSelection ...@@ -28,7 +28,6 @@ import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types (Selection(..)) import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types as ListSelection import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (AffRESTError, RESTError) import Gargantext.Config.REST (AffRESTError, RESTError)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session, postWwwUrlencoded, post) import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Types (ID, NodeType(..)) import Gargantext.Types (ID, NodeType(..))
...@@ -51,22 +50,23 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload" ...@@ -51,22 +50,23 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload"
type ActionUpload = type ActionUpload =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, id :: ID , id :: ID
, nodeType :: NodeType ) , nodeType :: NodeType
, session :: Session )
actionUpload :: R2.Component ActionUpload actionUpload :: R2.Component ActionUpload
actionUpload = R.createElement actionUploadCpt actionUpload = R.createElement actionUploadCpt
actionUploadCpt :: R.Component ActionUpload actionUploadCpt :: R.Component ActionUpload
actionUploadCpt = here.component "actionUpload" cpt where actionUploadCpt = here.component "actionUpload" cpt where
cpt { nodeType: Corpus, dispatch, id } _ = cpt { nodeType: Corpus, dispatch, id, session } _ =
pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus } pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus, session }
cpt { nodeType: NodeList, dispatch, id } _ = cpt { nodeType: NodeList, dispatch, id, session } _ =
pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList } [] pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList, session } []
cpt props@{ nodeType: NodeFrameCalc } _ = pure $ uploadFrameCalcView props [] cpt props@{ nodeType: NodeFrameCalc } _ = pure $ uploadFrameCalcView props []
cpt props@{ nodeType: Annuaire, dispatch, id } _ = cpt props@{ nodeType: Annuaire, dispatch, id, session } _ =
pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire } pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire, session }
cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props [] cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props []
...@@ -105,7 +105,7 @@ uploadFileView = R2.leafComponent uploadFileViewCpt ...@@ -105,7 +105,7 @@ uploadFileView = R2.leafComponent uploadFileViewCpt
uploadFileViewCpt :: R.Component Props uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt uploadFileViewCpt = here.component "uploadFileView" cpt
where where
cpt { dispatch, id, nodeType } _ = do cpt { dispatch, id, nodeType, session } _ = do
-- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing -- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
mFile <- T.useBox (Nothing :: Maybe UploadFile) mFile <- T.useBox (Nothing :: Maybe UploadFile)
fileType <- T.useBox CSV fileType <- T.useBox CSV
...@@ -158,7 +158,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt ...@@ -158,7 +158,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
] ]
, R2.row , R2.row
[ H.div { className: "col-6 flex-space-around" } [ H.div { className: "col-6 flex-space-around" }
[ ListSelection.selection { selection } [] ] [ ListSelection.selection { selection, session } [] ]
] ]
] ]
...@@ -200,6 +200,7 @@ type UploadButtonProps = ...@@ -200,6 +200,7 @@ type UploadButtonProps =
uploadButton :: R2.Component UploadButtonProps uploadButton :: R2.Component UploadButtonProps
uploadButton = R.createElement uploadButtonCpt uploadButton = R.createElement uploadButtonCpt
uploadButtonCpt :: R.Component UploadButtonProps uploadButtonCpt :: R.Component UploadButtonProps
uploadButtonCpt = here.component "uploadButton" cpt uploadButtonCpt = here.component "uploadButton" cpt
where where
...@@ -278,7 +279,7 @@ uploadListView :: R2.Leaf Props ...@@ -278,7 +279,7 @@ uploadListView :: R2.Leaf Props
uploadListView = R2.leafComponent uploadListViewCpt uploadListView = R2.leafComponent uploadListViewCpt
uploadListViewCpt :: R.Component Props uploadListViewCpt :: R.Component Props
uploadListViewCpt = here.component "uploadListView" cpt where uploadListViewCpt = here.component "uploadListView" cpt where
cpt { dispatch } _ = do cpt { dispatch, session } _ = do
-- States -- States
mFile mFile
<- T.useBox (Nothing :: Maybe UploadFile) <- T.useBox (Nothing :: Maybe UploadFile)
...@@ -395,6 +396,7 @@ uploadListViewCpt = here.component "uploadListView" cpt where ...@@ -395,6 +396,7 @@ uploadListViewCpt = here.component "uploadListView" cpt where
[ [
ListSelection.selection ListSelection.selection
{ selection { selection
, session
} [] } []
] ]
] ]
...@@ -711,7 +713,7 @@ uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt ...@@ -711,7 +713,7 @@ uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt
uploadFrameCalcViewCpt :: R.Component Props uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
where where
cpt { dispatch } _ = do cpt { dispatch, session } _ = do
lang' /\ langBox lang' /\ langBox
<- R2.useBox' EN <- R2.useBox' EN
selection' /\ selectionBox selection' /\ selectionBox
...@@ -763,6 +765,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt ...@@ -763,6 +765,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
[ [
ListSelection.selection ListSelection.selection
{ selection: selectionBox { selection: selectionBox
, session
} [] } []
] ]
] ]
......
...@@ -23,13 +23,14 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocument ...@@ -23,13 +23,14 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocument
type ActionWriteNodesDocuments = type ActionWriteNodesDocuments =
( boxes :: Boxes ( boxes :: Boxes
, dispatch :: Action -> Aff Unit , dispatch :: Action -> Aff Unit
, id :: GT.ID ) , id :: GT.ID
, session :: Session )
actionWriteNodesDocuments :: R2.Component ActionWriteNodesDocuments actionWriteNodesDocuments :: R2.Component ActionWriteNodesDocuments
actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where
cpt { boxes, dispatch, id } _ = do cpt { boxes, dispatch, id, session } _ = do
let bodies = let bodies =
[ R2.row [ R2.row
[ H.div { className: "col-12 flex-space-around" } [ H.div { className: "col-12 flex-space-around" }
......
...@@ -43,6 +43,7 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Box" ...@@ -43,6 +43,7 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
type CommonProps = type CommonProps =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, session :: Session
) )
nodePopupView :: R2.Leaf NodePopupProps nodePopupView :: R2.Leaf NodePopupProps
...@@ -332,28 +333,28 @@ panelActionCpt :: R.Component PanelActionProps ...@@ -332,28 +333,28 @@ panelActionCpt :: R.Component PanelActionProps
panelActionCpt = here.component "panelAction" cpt panelActionCpt = here.component "panelAction" cpt
where where
cpt { action: Documentation nodeType} _ = pure $ actionDoc { nodeType } [] cpt { action: Documentation nodeType} _ = pure $ actionDoc { nodeType } []
cpt { action: Download, id, nodeType} _ = pure $ actionDownload { id, nodeType } [] cpt { action: Download, id, nodeType, session} _ = pure $ actionDownload { id, nodeType, session } []
cpt { action: Upload, dispatch, id, nodeType} _ = pure $ actionUpload { dispatch, id, nodeType } [] cpt { action: Upload, dispatch, id, nodeType, session} _ = pure $ actionUpload { dispatch, id, nodeType, session } []
cpt { action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } [] cpt { action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } []
cpt { action: ManageTeam, nodeType, id} _ = pure $ actionManageTeam { id, nodeType } [] cpt { action: ManageTeam, nodeType, id, session} _ = pure $ actionManageTeam { id, nodeType, session } []
cpt { action: Add xs, dispatch, id, name, nodeType} _ = cpt { action: Add xs, dispatch, id, name, nodeType} _ =
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} [] pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} []
cpt { action: Refresh , dispatch, nodeType } _ = pure $ update { dispatch, nodeType } [] cpt { action: Refresh , dispatch, nodeType } _ = pure $ update { dispatch, nodeType } []
cpt { action: Config, nodeType } _ = cpt { action: Config, nodeType } _ =
pure $ fragmentPT $ "Config " <> show nodeType pure $ fragmentPT $ "Config " <> show nodeType
-- Functions using SubTree -- Functions using SubTree
cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType } _ = cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ mergeNode { boxes, dispatch, id, nodeType, subTreeParams } [] pure $ mergeNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType } _ = cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ moveNode { boxes, dispatch, id, nodeType, subTreeParams } [] pure $ moveNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: Link {subTreeParams}, boxes, dispatch, id, nodeType } _ = cpt { action: Link {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ linkNode { boxes, dispatch, id, nodeType, subTreeParams } [] pure $ linkNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action : Share, dispatch, id } _ = pure $ Share.shareNode { dispatch, id } [] cpt { action : Share, dispatch, id } _ = pure $ Share.shareNode { dispatch, id } []
cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } [] cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ = cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType, session } _ =
pure $ Share.publishNode { boxes, dispatch, id, nodeType, subTreeParams } [] pure $ Share.publishNode { boxes, dispatch, id, nodeType, session, subTreeParams } []
cpt { action: SearchBox, boxes, dispatch, id, session } _ = cpt { action: SearchBox, boxes, dispatch, id, session } _ =
pure $ actionSearch { boxes, dispatch, id: Just id, session } [] pure $ actionSearch { boxes, dispatch, id: Just id, session } []
cpt { action: WriteNodesDocuments, boxes, dispatch, id } _ = cpt { action: WriteNodesDocuments, boxes, dispatch, id, session } _ =
pure $ actionWriteNodesDocuments { boxes, dispatch, id } [] pure $ actionWriteNodesDocuments { boxes, dispatch, id, session } []
cpt _ _ = pure $ H.div {} [] cpt _ _ = pure $ H.div {} []
...@@ -13,6 +13,7 @@ import Gargantext.Types as GT ...@@ -13,6 +13,7 @@ import Gargantext.Types as GT
type CommonProps = type CommonProps =
( dispatch :: Action -> Aff Unit ( dispatch :: Action -> Aff Unit
, session :: Session
) )
type NodePopupProps = type NodePopupProps =
...@@ -21,7 +22,6 @@ type NodePopupProps = ...@@ -21,7 +22,6 @@ type NodePopupProps =
, id :: ID , id :: ID
, name :: Name , name :: Name
, nodeType :: GT.NodeType , nodeType :: GT.NodeType
, session :: Session
| CommonProps | CommonProps
) )
......
...@@ -14,7 +14,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTr ...@@ -14,7 +14,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTr
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..)) import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get) import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT import Gargantext.Types as GT
...@@ -50,10 +49,9 @@ subTreeViewCpt = here.component "subTreeView" cpt ...@@ -50,10 +49,9 @@ subTreeViewCpt = here.component "subTreeView" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
} _ = do } _ = do
session <- useSession
let let
SubTreeParams {showtypes} = subTreeParams SubTreeParams {showtypes} = subTreeParams
-- (valAction /\ setAction) = action -- (valAction /\ setAction) = action
...@@ -68,6 +66,7 @@ subTreeViewCpt = here.component "subTreeView" cpt ...@@ -68,6 +66,7 @@ subTreeViewCpt = here.component "subTreeView" cpt
, dispatch , dispatch
, id , id
, nodeType , nodeType
, session
, subTreeParams , subTreeParams
, tree , tree
} [] } } [] }
......
...@@ -8,7 +8,6 @@ import Effect.Class (liftEffect) ...@@ -8,7 +8,6 @@ import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), Variant(..)) import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), Variant(..))
import Gargantext.Components.GraphExplorer.API as GraphAPI import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils ((?)) import Gargantext.Utils ((?))
...@@ -25,27 +24,27 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.Sync" ...@@ -25,27 +24,27 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.Sync"
type NodeActionsGraphProps = type NodeActionsGraphProps =
( id :: GT.ID ( id :: GT.ID
, graphVersions :: Record GraphAPI.GraphVersions , graphVersions :: Record GraphAPI.GraphVersions
, session :: Session
, refresh :: Unit -> Aff Unit , refresh :: Unit -> Aff Unit
, session :: Session
) )
nodeActionsGraph :: R2.Component NodeActionsGraphProps nodeActionsGraph :: R2.Component NodeActionsGraphProps
nodeActionsGraph = R.createElement nodeActionsGraphCpt nodeActionsGraph = R.createElement nodeActionsGraphCpt
nodeActionsGraphCpt :: R.Component NodeActionsGraphProps nodeActionsGraphCpt :: R.Component NodeActionsGraphProps
nodeActionsGraphCpt = here.component "nodeActionsGraph" cpt where nodeActionsGraphCpt = here.component "nodeActionsGraph" cpt where
cpt { id, graphVersions, refresh, session } _ = cpt { id, graphVersions, session, refresh } _ =
let sameVersions = (graphVersions.gv_graph == Just graphVersions.gv_repo) let sameVersions = (graphVersions.gv_graph == Just graphVersions.gv_repo)
in pure $ in pure $
R2.when (not sameVersions) $ R2.when (not sameVersions) $
graphUpdateButton { id, refresh, session } graphUpdateButton { id, session, refresh }
type GraphUpdateButtonProps = type GraphUpdateButtonProps =
( id :: GT.ID ( id :: GT.ID
, refresh :: Unit -> Aff Unit
, session :: Session , session :: Session
, refresh :: Unit -> Aff Unit
) )
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
...@@ -53,7 +52,7 @@ graphUpdateButton p = R.createElement graphUpdateButtonCpt p [] ...@@ -53,7 +52,7 @@ graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = here.component "graphUpdateButton" cpt graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
where where
cpt { id, refresh, session } _ = do cpt { id, session, refresh } _ = do
enabled <- T.useBox true enabled <- T.useBox true
enabled' <- T.useLive T.unequal enabled enabled' <- T.useLive T.unequal enabled
...@@ -64,7 +63,7 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt ...@@ -64,7 +63,7 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
, variant: Secondary , variant: Secondary
, elevation: Level1 , elevation: Level1
, status: enabled' ? Enabled $ Disabled , status: enabled' ? Enabled $ Disabled
, callback: const $ onClick enabled' enabled session , callback: const $ onClick enabled' enabled
, name: "refresh" , name: "refresh"
} }
...@@ -76,8 +75,8 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt ...@@ -76,8 +75,8 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
-- , on: { click: onClick enabled' enabled } } [] -- , on: { click: onClick enabled' enabled } } []
-- ] -- ]
where where
onClick false _ _ = pure unit onClick false _ = pure unit
onClick true enabled session = do onClick true enabled = do
launchAff_ $ do launchAff_ $ do
liftEffect $ T.write_ false enabled liftEffect $ T.write_ false enabled
_g <- GraphAPI.updateGraphVersions { graphId: id, session } _g <- GraphAPI.updateGraphVersions { graphId: id, session }
...@@ -92,6 +91,7 @@ type NodeActionsNodeListProps = ...@@ -92,6 +91,7 @@ type NodeActionsNodeListProps =
listId :: GT.ListId listId :: GT.ListId
, nodeId :: GT.ID , nodeId :: GT.ID
, nodeType :: GT.TabSubType GT.CTabNgramType , nodeType :: GT.TabSubType GT.CTabNgramType
, session :: Session
, refresh :: Unit -> Aff Unit , refresh :: Unit -> Aff Unit
) )
...@@ -106,6 +106,7 @@ type NodeListUpdateButtonProps = ...@@ -106,6 +106,7 @@ type NodeListUpdateButtonProps =
( listId :: GT.ListId ( listId :: GT.ListId
, nodeId :: GT.ID , nodeId :: GT.ID
, nodeType :: GT.TabSubType GT.CTabNgramType , nodeType :: GT.TabSubType GT.CTabNgramType
, session :: Session
, refresh :: Unit -> Aff Unit , refresh :: Unit -> Aff Unit
) )
......
...@@ -15,7 +15,6 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath) ...@@ -15,7 +15,6 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath)
import Gargantext.Components.GraphExplorer.Types (GraphSideDoc(..)) import Gargantext.Components.GraphExplorer.Types (GraphSideDoc(..))
import Gargantext.Config.REST (logRESTError) import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..)) import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -28,17 +27,19 @@ here = R2.here "Gargantext.Components.GraphExplorer.Frame.DocFocus" ...@@ -28,17 +27,19 @@ here = R2.here "Gargantext.Components.GraphExplorer.Frame.DocFocus"
type Props = type Props =
( graphSideDoc :: GraphSideDoc ( graphSideDoc :: GraphSideDoc
, session :: Session
, closeCallback :: Unit -> Effect Unit , closeCallback :: Unit -> Effect Unit
) )
docFocus :: R2.Leaf ( key :: String | Props ) docFocus :: R2.Leaf ( key :: String | Props )
docFocus = R2.leaf docFocusCpt docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props ) docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where docFocusCpt = here.component "main" cpt where
cpt { graphSideDoc: GraphSideDoc { docId, listId, corpusId } cpt { graphSideDoc: GraphSideDoc { docId, listId, corpusId }
, session
, closeCallback , closeCallback
} _ = do } _ = do
session <- useSession
-- | States -- | States
-- | -- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData) state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
......
...@@ -27,6 +27,7 @@ import Gargantext.Components.GraphExplorer.Types as GET ...@@ -27,6 +27,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Config (defaultFrontends) import Gargantext.Config (defaultFrontends)
import Gargantext.Data.Louvain as DLouvain import Gargantext.Data.Louvain as DLouvain
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Louvain as Louvain import Gargantext.Hooks.Sigmax.Louvain as Louvain
import Gargantext.Hooks.Sigmax.Noverlap as Noverlap import Gargantext.Hooks.Sigmax.Noverlap as Noverlap
...@@ -72,6 +73,8 @@ layoutCpt = here.component "layout" cpt where ...@@ -72,6 +73,8 @@ layoutCpt = here.component "layout" cpt where
, graphId , graphId
} <- GraphStore.use } <- GraphStore.use
session <- useSession
showSidebar' <- R2.useLive' showSidebar showSidebar' <- R2.useLive' showSidebar
showDoc' <- R2.useLive' showDoc showDoc' <- R2.useLive' showDoc
mMetaData' <- R2.useLive' mMetaData mMetaData' <- R2.useLive' mMetaData
...@@ -147,7 +150,8 @@ layoutCpt = here.component "layout" cpt where ...@@ -147,7 +150,8 @@ layoutCpt = here.component "layout" cpt where
{ className: "graph-layout__focus__inner" } { className: "graph-layout__focus__inner" }
[ [
docFocus docFocus
{ graphSideDoc { session
, graphSideDoc
, closeCallback: closeDoc , closeCallback: closeDoc
, key: show $ getter _.docId graphSideDoc , key: show $ getter _.docId graphSideDoc
} }
...@@ -176,6 +180,7 @@ layoutCpt = here.component "layout" cpt where ...@@ -176,6 +180,7 @@ layoutCpt = here.component "layout" cpt where
GES.sidebar GES.sidebar
{ frontends: defaultFrontends { frontends: defaultFrontends
, metaData , metaData
, session
} }
] ]
] ]
...@@ -193,6 +198,7 @@ layoutCpt = here.component "layout" cpt where ...@@ -193,6 +198,7 @@ layoutCpt = here.component "layout" cpt where
{ fa2Ref { fa2Ref
, noverlapRef , noverlapRef
, reloadForest: reloadForest , reloadForest: reloadForest
, session
, sigmaRef , sigmaRef
} }
] ]
......
...@@ -37,7 +37,6 @@ import Gargantext.Core.NgramsTable.Types as CNT ...@@ -37,7 +37,6 @@ import Gargantext.Core.NgramsTable.Types as CNT
import Gargantext.Data.Array (mapMaybe) import Gargantext.Data.Array (mapMaybe)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.Types as SigmaxT import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, SidePanelState(..), TabSubType(..), TabType(..), TermList(..), modeTabType) import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, SidePanelState(..), TabSubType(..), TabType(..), TermList(..), modeTabType)
...@@ -55,6 +54,7 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar" ...@@ -55,6 +54,7 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Props = type Props =
( metaData :: GET.MetaData ( metaData :: GET.MetaData
, session :: Session
, frontends :: Frontends , frontends :: Frontends
) )
...@@ -644,6 +644,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where ...@@ -644,6 +644,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
, metaData , metaData
, nodesMap , nodesMap
, rType , rType
, session
} children = do } children = do
-- States -- States
{ errors { errors
...@@ -658,8 +659,6 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where ...@@ -658,8 +659,6 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
selectedNodeIds' <- R2.useLive' selectedNodeIds selectedNodeIds' <- R2.useLive' selectedNodeIds
graphId' <- R2.useLive' graphId graphId' <- R2.useLive' graphId
session <- useSession
-- Behaviors -- Behaviors
let let
callback _ = do callback _ = do
...@@ -669,7 +668,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where ...@@ -669,7 +668,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
, graphId: graphId' , graphId: graphId'
, metaData: metaData , metaData: metaData
, nodes , nodes
, session , session: session
, termList: rType , termList: rType
, reloadForest , reloadForest
} }
......
...@@ -46,8 +46,9 @@ type Props = ...@@ -46,8 +46,9 @@ type Props =
docListWrapper :: R2.Leaf Props docListWrapper :: R2.Leaf Props
docListWrapper = R2.leaf docListWrapperCpt docListWrapper = R2.leaf docListWrapperCpt
docListWrapperCpt :: R.Component Props docListWrapperCpt :: R.Component Props
docListWrapperCpt = here.component "docListWrapper" cpt where docListWrapperCpt = here.component "wrapper" cpt where
cpt { metaData: GET.MetaData metaData cpt { metaData: GET.MetaData metaData
} _ = do } _ = do
-- | States -- | States
...@@ -114,8 +115,9 @@ type ListProps = ...@@ -114,8 +115,9 @@ type ListProps =
docList :: R2.Leaf ListProps docList :: R2.Leaf ListProps
docList = R2.leaf docListCpt docList = R2.leaf docListCpt
docListCpt :: R.Component ListProps docListCpt :: R.Component ListProps
docListCpt = here.component "docList" cpt where docListCpt = here.component "main" cpt where
-- | Helpers -- | Helpers
-- | -- |
errorHandler err = do errorHandler err = do
...@@ -271,6 +273,7 @@ type ItemProps = ...@@ -271,6 +273,7 @@ type ItemProps =
item :: R2.Leaf ItemProps item :: R2.Leaf ItemProps
item = R2.leaf itemCpt item = R2.leaf itemCpt
itemCpt :: R.Component ItemProps itemCpt :: R.Component ItemProps
itemCpt = here.component "item" cpt where itemCpt = here.component "item" cpt where
cpt { documentView: dv@(DocumentsView { id, title, source }) cpt { documentView: dv@(DocumentsView { id, title, source })
......
...@@ -29,12 +29,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(.. ...@@ -29,12 +29,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..
import Gargantext.Components.GraphExplorer.API (cloneGraph) import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax as Sigmax import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Camera as Camera import Gargantext.Hooks.Sigmax.Camera as Camera
import Gargantext.Hooks.Sigmax.Graphology as Graphology import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Sigma as Sigma import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Sessions (Session)
import Gargantext.Utils ((?)) import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
...@@ -76,6 +76,7 @@ type CameraButtonProps = ...@@ -76,6 +76,7 @@ type CameraButtonProps =
, hyperdataGraph :: GET.HyperdataGraph , hyperdataGraph :: GET.HyperdataGraph
, forceAtlasState :: T.Box SigmaxTypes.ForceAtlasState , forceAtlasState :: T.Box SigmaxTypes.ForceAtlasState
, reloadForest :: T2.ReloadS , reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma , sigmaRef :: R.Ref Sigmax.Sigma
) )
...@@ -95,8 +96,8 @@ cameraButtonCpt = here.component "cameraButton" cpt ...@@ -95,8 +96,8 @@ cameraButtonCpt = here.component "cameraButton" cpt
, forceAtlasState , forceAtlasState
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData graphData' } , hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData graphData' }
, reloadForest , reloadForest
, session
, sigmaRef } _ = do , sigmaRef } _ = do
session <- useSession
forceAtlasState' <- R2.useLive' forceAtlasState forceAtlasState' <- R2.useLive' forceAtlasState
pure $ B.button pure $ B.button
......
...@@ -15,7 +15,6 @@ import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, center ...@@ -15,7 +15,6 @@ import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, center
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, nodeSizeControl) import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeSlider) import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeSlider)
import Gargantext.Components.GraphExplorer.Types as GET import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Noverlap as Noverlap import Gargantext.Hooks.Sigmax.Noverlap as Noverlap
import Gargantext.Hooks.Sigmax as Sigmax import Gargantext.Hooks.Sigmax as Sigmax
...@@ -36,6 +35,7 @@ type Controls = ...@@ -36,6 +35,7 @@ type Controls =
( fa2Ref :: R.Ref (Maybe ForceAtlas.FA2Layout) ( fa2Ref :: R.Ref (Maybe ForceAtlas.FA2Layout)
, noverlapRef :: R.Ref (Maybe Noverlap.NoverlapLayout) , noverlapRef :: R.Ref (Maybe Noverlap.NoverlapLayout)
, reloadForest :: T2.ReloadS , reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma , sigmaRef :: R.Ref Sigmax.Sigma
) )
...@@ -46,6 +46,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -46,6 +46,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
cpt { fa2Ref cpt { fa2Ref
, noverlapRef , noverlapRef
, reloadForest , reloadForest
, session
, sigmaRef , sigmaRef
} _ = do } _ = do
-- | States -- | States
...@@ -81,6 +82,8 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -81,6 +82,8 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange
nodeSizeRange' <- R2.useLive' nodeSizeRange nodeSizeRange' <- R2.useLive' nodeSizeRange
-- session <- useSession
-- ref to track automatic FA pausing -- ref to track automatic FA pausing
-- If user pauses FA before auto is triggered, clear the timeoutId -- If user pauses FA before auto is triggered, clear the timeoutId
mFAPauseRef <- R.useRef Nothing mFAPauseRef <- R.useRef Nothing
...@@ -179,6 +182,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -179,6 +182,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, forceAtlasState , forceAtlasState
, hyperdataGraph: hyperdataGraph' , hyperdataGraph: hyperdataGraph'
, reloadForest , reloadForest
, session
, sigmaRef: sigmaRef , sigmaRef: sigmaRef
} }
] ]
......
...@@ -10,7 +10,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe) ...@@ -10,7 +10,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe)
import Gargantext.Components.ListSelection.Types (NodeSimple(..), Selection(..), selectedListIds) import Gargantext.Components.ListSelection.Types (NodeSimple(..), Selection(..), selectedListIds)
import Gargantext.Config.REST (RESTError(..), AffRESTError) import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (SessionRoute(..)) import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session(..), get) import Gargantext.Sessions (Session(..), get)
import Gargantext.Types (ID, NodeType(..), fldr) import Gargantext.Types (ID, NodeType(..), fldr)
...@@ -24,13 +23,14 @@ here = R2.here "Gargantext.Components.ListSelection" ...@@ -24,13 +23,14 @@ here = R2.here "Gargantext.Components.ListSelection"
type Props = type Props =
( selection :: T.Box Selection ( selection :: T.Box Selection
, session :: Session
) )
selection :: R2.Component Props selection :: R2.Component Props
selection = R.createElement selectionCpt selection = R.createElement selectionCpt
selectionCpt :: R.Component Props selectionCpt :: R.Component Props
selectionCpt = here.component "selection" cpt where selectionCpt = here.component "selection" cpt where
cpt { selection } _ = do cpt { selection, session } _ = do
selection' <- R2.useLive' selection selection' <- R2.useLive' selection
pure $ H.div { className: "list-selection" } pure $ H.div { className: "list-selection" }
[ [
...@@ -44,33 +44,33 @@ selectionCpt = here.component "selection" cpt where ...@@ -44,33 +44,33 @@ selectionCpt = here.component "selection" cpt where
] ]
} }
[] []
, selectedIds { selection } [] , selectedIds { selection, session } []
] ]
selectedIds :: R2.Component Props selectedIds :: R2.Component Props
selectedIds = R.createElement selectedIdsCpt selectedIds = R.createElement selectedIdsCpt
selectedIdsCpt :: R.Component Props selectedIdsCpt :: R.Component Props
selectedIdsCpt = here.component "selectedIds" cpt where selectedIdsCpt = here.component "selectedIds" cpt where
cpt { selection } _ = do cpt { selection, session } _ = do
selection' <- T.useLive T.unequal selection selection' <- T.useLive T.unequal selection
pure $ case selection' of pure $ case selection' of
SelectedLists ids -> H.div {} [ idsSelector { selection } [] ] SelectedLists ids -> H.div {} [ idsSelector { selection, session } [] ]
_ -> H.div {} [] _ -> H.div {} []
type IdsSelectorProps = type IdsSelectorProps =
( selection :: T.Box Selection ) ( selection :: T.Box Selection
, session :: Session )
idsSelector :: R2.Component IdsSelectorProps idsSelector :: R2.Component IdsSelectorProps
idsSelector = R.createElement idsSelectorCpt idsSelector = R.createElement idsSelectorCpt
idsSelectorCpt :: R.Component IdsSelectorProps idsSelectorCpt :: R.Component IdsSelectorProps
idsSelectorCpt = here.component "idsSelector" cpt where idsSelectorCpt = here.component "idsSelector" cpt where
cpt { selection } _ = do cpt { selection, session } _ = do
session <- useSession
let Session { treeId: root } = session
pure $ H.div { className: "ids-selector" } pure $ H.div { className: "ids-selector" }
[ listTree { name: "", nodeType: NodeUser, root, selection } ] -- $ map checkbox [1, 2, 3, 4] [ listTree { name: "", nodeType: NodeUser, root, selection, session } ] -- $ map checkbox [1, 2, 3, 4]
where
Session { treeId: root } = session
listIdsRoute :: ID -> SessionRoute listIdsRoute :: ID -> SessionRoute
listIdsRoute = Children NodeList 0 1 Nothing <<< Just listIdsRoute = Children NodeList 0 1 Nothing <<< Just
...@@ -88,20 +88,22 @@ type ListTreeProps = ...@@ -88,20 +88,22 @@ type ListTreeProps =
, nodeType :: NodeType , nodeType :: NodeType
, root :: ID , root :: ID
, selection :: T.Box Selection , selection :: T.Box Selection
, session :: Session
) )
listTree :: R2.Leaf ListTreeProps listTree :: R2.Leaf ListTreeProps
listTree props = R.createElement listTreeCpt props [] listTree props = R.createElement listTreeCpt props []
listTreeCpt :: R.Component ListTreeProps listTreeCpt :: R.Component ListTreeProps
listTreeCpt = here.component "listTree" cpt where listTreeCpt = here.component "listTree" cpt where
cpt { name, nodeType, root, selection } _ = do cpt { name, nodeType, root, selection, session } _ = do
pure $ H.div { className: "tree" } pure $ H.div { className: "tree" }
[ H.div { className: "root" } [ H.div { className: "root" }
[ H.i { className: fldr nodeType true } [] [ H.i { className: fldr nodeType true } []
, H.text $ "[" <> show root <> "] " <> name ] , H.text $ "[" <> show root <> "] " <> name ]
, listTreeChildren { render: listTree , listTreeChildren { render: listTree
, root , root
, selection } [] , selection
, session } []
] ]
type Render = Record ListTreeProps -> R.Element type Render = Record ListTreeProps -> R.Element
...@@ -109,14 +111,14 @@ type ListTreeChildrenProps = ...@@ -109,14 +111,14 @@ type ListTreeChildrenProps =
( render :: Render ( render :: Render
, root :: ID , root :: ID
, selection :: T.Box Selection , selection :: T.Box Selection
, session :: Session
) )
listTreeChildren :: R2.Component ListTreeChildrenProps listTreeChildren :: R2.Component ListTreeChildrenProps
listTreeChildren = R.createElement listTreeChildrenCpt listTreeChildren = R.createElement listTreeChildrenCpt
listTreeChildrenCpt :: R.Component ListTreeChildrenProps listTreeChildrenCpt :: R.Component ListTreeChildrenProps
listTreeChildrenCpt = here.component "listTreeChildren" cpt where listTreeChildrenCpt = here.component "listTreeChildren" cpt where
cpt { render, root, selection } _ = do cpt { render, root, selection, session } _ = do
session <- useSession
useLoader { errorHandler useLoader { errorHandler
, loader: loadTreeChildren , loader: loadTreeChildren
, path: { root, session } , path: { root, session }
...@@ -124,7 +126,8 @@ listTreeChildrenCpt = here.component "listTreeChildren" cpt where ...@@ -124,7 +126,8 @@ listTreeChildrenCpt = here.component "listTreeChildren" cpt where
listTreeChildrenLoaded { loaded listTreeChildrenLoaded { loaded
, render , render
, root , root
, selection } [] } , selection
, session } [] }
where where
errorHandler err = case err of errorHandler err = case err of
ReadJSONError err' -> here.warn2 "[listTreeChildren] ReadJSONError" $ show err' ReadJSONError err' -> here.warn2 "[listTreeChildren] ReadJSONError" $ show err'
...@@ -134,29 +137,30 @@ type ListTreeChildrenLoadedProps = ...@@ -134,29 +137,30 @@ type ListTreeChildrenLoadedProps =
( loaded :: Array NodeSimple ( loaded :: Array NodeSimple
, render :: Render , render :: Render
, root :: ID , root :: ID
, selection :: T.Box Selection ) , selection :: T.Box Selection
, session :: Session )
listTreeChildrenLoaded :: R2.Component ListTreeChildrenLoadedProps listTreeChildrenLoaded :: R2.Component ListTreeChildrenLoadedProps
listTreeChildrenLoaded = R.createElement listTreeChildrenLoadedCpt listTreeChildrenLoaded = R.createElement listTreeChildrenLoadedCpt
listTreeChildrenLoadedCpt :: R.Component ListTreeChildrenLoadedProps listTreeChildrenLoadedCpt :: R.Component ListTreeChildrenLoadedProps
listTreeChildrenLoadedCpt = here.component "listTreeChildrenLoaded" cpt where listTreeChildrenLoadedCpt = here.component "listTreeChildrenLoaded" cpt where
cpt { loaded, render, root, selection } _ = do cpt { loaded, render, root, selection, session } _ = do
pure $ H.div { className: "children" } (element <$> loaded) pure $ H.div { className: "children" } (element <$> loaded)
where where
element (NodeSimple { id, name, nodeType: nodeType@Corpus }) = element (NodeSimple { id, name, nodeType: nodeType@Corpus }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element (NodeSimple { id, name, nodeType: nodeType@Folder }) = element (NodeSimple { id, name, nodeType: nodeType@Folder }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element (NodeSimple { id, name, nodeType: nodeType@FolderPrivate }) = element (NodeSimple { id, name, nodeType: nodeType@FolderPrivate }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element (NodeSimple { id, name, nodeType: nodeType@FolderPublic }) = element (NodeSimple { id, name, nodeType: nodeType@FolderPublic }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element (NodeSimple { id, name, nodeType: nodeType@FolderShared }) = element (NodeSimple { id, name, nodeType: nodeType@FolderShared }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element (NodeSimple { id, name, nodeType: NodeList}) = element (NodeSimple { id, name, nodeType: NodeList}) =
renderListElement { id, name, selection } renderListElement { id, name, selection }
element (NodeSimple { id, name, nodeType: nodeType@Team }) = element (NodeSimple { id, name, nodeType: nodeType@Team }) =
render { root: id, name, nodeType, selection } render { root: id, name, nodeType, selection, session }
element _ = H.div {} [] element _ = H.div {} []
type RenderListElementProps = type RenderListElementProps =
......
...@@ -15,7 +15,7 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath) ...@@ -15,7 +15,7 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath)
import Gargantext.Components.PhyloExplorer.Types (FrameDoc(..)) import Gargantext.Components.PhyloExplorer.Types (FrameDoc(..))
import Gargantext.Config.REST (logRESTError) import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoaderEffect) import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession) import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..)) import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
...@@ -27,6 +27,7 @@ here = R2.here "Gargantext.Components.PhyloExplorer.Frame.DocFocus" ...@@ -27,6 +27,7 @@ here = R2.here "Gargantext.Components.PhyloExplorer.Frame.DocFocus"
type Props = type Props =
( frameDoc :: FrameDoc ( frameDoc :: FrameDoc
, session :: Session
, closeCallback :: Unit -> Effect Unit , closeCallback :: Unit -> Effect Unit
) )
...@@ -36,9 +37,9 @@ docFocus = R2.leaf docFocusCpt ...@@ -36,9 +37,9 @@ docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props ) docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where docFocusCpt = here.component "main" cpt where
cpt { frameDoc: FrameDoc { docId, listId, corpusId } cpt { frameDoc: FrameDoc { docId, listId, corpusId }
, session
, closeCallback , closeCallback
} _ = do } _ = do
session <- useSession
-- | States -- | States
-- | -- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData) state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
......
...@@ -22,6 +22,7 @@ import Gargantext.Components.PhyloExplorer.ToolBar (toolBar) ...@@ -22,6 +22,7 @@ import Gargantext.Components.PhyloExplorer.ToolBar (toolBar)
import Gargantext.Components.PhyloExplorer.TopBar (topBar) import Gargantext.Components.PhyloExplorer.TopBar (topBar)
import Gargantext.Components.PhyloExplorer.Types (DisplayView, ExtractedCount, FrameDoc, PhyloData(..), TabView(..), Term, sortSources) import Gargantext.Components.PhyloExplorer.Types (DisplayView, ExtractedCount, FrameDoc, PhyloData(..), TabView(..), Term, sortSources)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1', useUpdateEffect3') import Gargantext.Hooks.UpdateEffect (useUpdateEffect1', useUpdateEffect3')
import Gargantext.Types (SidePanelState(..)) import Gargantext.Types (SidePanelState(..))
import Gargantext.Utils (getter, (?)) import Gargantext.Utils (getter, (?))
...@@ -78,6 +79,8 @@ layoutCpt = here.component "layout" cpt where ...@@ -78,6 +79,8 @@ layoutCpt = here.component "layout" cpt where
selectedSource' <- R2.useLive' selectedSource selectedSource' <- R2.useLive' selectedSource
frameDoc' <- R2.useLive' frameDoc frameDoc' <- R2.useLive' frameDoc
session <- useSession
-- | Hooks -- | Hooks
-- | -- |
let topBarPortalKey = "portal-topbar::" <> show phyloId' let topBarPortalKey = "portal-topbar::" <> show phyloId'
...@@ -269,7 +272,8 @@ layoutCpt = here.component "layout" cpt where ...@@ -269,7 +272,8 @@ layoutCpt = here.component "layout" cpt where
{ className: "phylo__focus__inner" } { className: "phylo__focus__inner" }
[ [
docFocus docFocus
{ frameDoc: frameDoc_ { session
, frameDoc: frameDoc_
, closeCallback: closeDocCallback , closeCallback: closeDocCallback
, key: show $ getter _.docId frameDoc_ , key: show $ getter _.docId frameDoc_
} }
......
...@@ -215,6 +215,7 @@ mainPageCpt = here.component "mainPage" cpt where ...@@ -215,6 +215,7 @@ mainPageCpt = here.component "mainPage" cpt where
forest :: R2.Leaf Props forest :: R2.Leaf Props
forest = R2.leaf forestCpt forest = R2.leaf forestCpt
forestCpt :: R.Memo Props forestCpt :: R.Memo Props
forestCpt = R.memo' $ here.component "forest" cpt where forestCpt = R.memo' $ here.component "forest" cpt where
cpt { boxes } _ = do cpt { boxes } _ = do
......
...@@ -15,12 +15,11 @@ import Effect.Timer (IntervalId, clearInterval, setInterval) ...@@ -15,12 +15,11 @@ import Effect.Timer (IntervalId, clearInterval, setInterval)
import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (QueryProgressData, queryProgress) import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (QueryProgressData, queryProgress)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError) import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Session (useSession) import Gargantext.Sessions (Session)
import Gargantext.Types (AsyncProgress, FrontendError) import Gargantext.Types (AsyncProgress, FrontendError)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
import Record as Record
import Record.Extra as RX import Record.Extra as RX
import Toestand as T import Toestand as T
...@@ -29,6 +28,7 @@ type AsyncProps = ...@@ -29,6 +28,7 @@ type AsyncProps =
, errors :: T.Box (Array FrontendError) , errors :: T.Box (Array FrontendError)
, nodeId :: GT.ID , nodeId :: GT.ID
, onFinish :: Unit -> Effect Unit , onFinish :: Unit -> Effect Unit
, session :: Session
) )
asyncProgress :: R2.Component AsyncProps asyncProgress :: R2.Component AsyncProps
...@@ -39,7 +39,6 @@ component = R.hooksComponent "asyncProgressContext" cpt where ...@@ -39,7 +39,6 @@ component = R.hooksComponent "asyncProgressContext" cpt where
cpt props@{ errors cpt props@{ errors
, onFinish , onFinish
} children = do } children = do
session <- useSession
-- States -- States
progress /\ progressBox <- R2.useBox' 0.0 progress /\ progressBox <- R2.useBox' 0.0
intervalIdRef <- R.useRef (Nothing :: Maybe IntervalId) intervalIdRef <- R.useRef (Nothing :: Maybe IntervalId)
...@@ -48,8 +47,7 @@ component = R.hooksComponent "asyncProgressContext" cpt where ...@@ -48,8 +47,7 @@ component = R.hooksComponent "asyncProgressContext" cpt where
let let
exec :: Unit -> Effect Unit exec :: Unit -> Effect Unit
exec _ = launchAff_ do exec _ = launchAff_ do
let rdata = (Record.merge (RX.pick props :: { asyncTask :: GT.AsyncTaskWithType let rdata = (RX.pick props :: Record QueryProgressData)
, nodeId :: GT.ID }) { session })
eAsyncProgress <- queryProgress rdata eAsyncProgress <- queryProgress rdata
handleRESTError errors eAsyncProgress onProgress handleRESTError errors eAsyncProgress onProgress
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment