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
a6ec0726
Verified
Commit
a6ec0726
authored
Jan 13, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactor] remove 'session' from various Props in favor of
'useSession' in context
parent
a5d78f02
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
210 additions
and
246 deletions
+210
-246
FolderView.purs
src/Gargantext/Components/FolderView.purs
+20
-18
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+18
-15
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+7
-10
Action.purs
src/Gargantext/Components/Forest/Tree/Node/Action.purs
+0
-2
Download.purs
...rgantext/Components/Forest/Tree/Node/Action/Download.purs
+22
-16
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+2
-4
ManageTeam.purs
...antext/Components/Forest/Tree/Node/Action/ManageTeam.purs
+23
-25
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+1
-2
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+2
-4
Search.purs
...Gargantext/Components/Forest/Tree/Node/Action/Search.purs
+2
-5
SearchBar.purs
.../Components/Forest/Tree/Node/Action/Search/SearchBar.purs
+2
-3
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+24
-23
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+1
-3
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+12
-15
WriteNodesDocuments.purs
...mponents/Forest/Tree/Node/Action/WriteNodesDocuments.purs
+2
-3
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+16
-19
Types.purs
src/Gargantext/Components/Forest/Tree/Node/Box/Types.purs
+0
-1
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+3
-2
Sync.purs
src/Gargantext/Components/Forest/Tree/Node/Tools/Sync.purs
+9
-10
DocFocus.purs
src/Gargantext/Components/GraphExplorer/Frame/DocFocus.purs
+2
-3
Layout.purs
src/Gargantext/Components/GraphExplorer/Layout.purs
+1
-7
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+4
-3
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+2
-5
Buttons.purs
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
+2
-3
Controls.purs
...Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
+1
-5
ListSelection.purs
src/Gargantext/Components/ListSelection.purs
+24
-28
DocFocus.purs
src/Gargantext/Components/PhyloExplorer/Frame/DocFocus.purs
+2
-3
Layout.purs
src/Gargantext/Components/PhyloExplorer/Layout.purs
+1
-5
Router.purs
src/Gargantext/Components/Router.purs
+0
-1
Progress.purs
src/Gargantext/Context/Progress.purs
+5
-3
No files found.
src/Gargantext/Components/FolderView.purs
View file @
a6ec0726
...
...
@@ -34,6 +34,7 @@ import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (AppRoute(Home), appPath, nodeTypeAppRoute)
import Gargantext.Sessions (Session(..), sessionId)
import Gargantext.Types (NodeType(..), SessionId)
...
...
@@ -48,8 +49,8 @@ here :: R2.Here
here = R2.here "Gargantext.Components.FolderView"
type Props =
( nodeId
:: Int
, session
:: Session
( nodeId :: Int
, session :: Session
)
data FolderStyle = FolderUp | FolderChild
...
...
@@ -67,7 +68,6 @@ folderViewCpt = here.component "folderViewCpt" cpt where
, render: \folders -> folderViewMain { folders
, nodeId
, reload
, session
} [] }
where
errorHandler = logRESTError here "[folderView]"
...
...
@@ -76,7 +76,6 @@ type FolderViewProps =
( folders :: TreeFirstLevel
, nodeId :: Int
, reload :: T.Box T2.Reload
, session :: Session
)
folderViewMain :: R2.Component FolderViewProps
...
...
@@ -103,7 +102,6 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
, linkNodeType: node.node_type
, parentId: props.nodeId
, reload: props.reload
, session: props.session
, style: FolderChild
, text: node.name
, disabled: false
...
...
@@ -119,7 +117,6 @@ folderViewMainCpt = here.component "folderViewMainCpt" cpt where
, nodeType: root.node_type
, parentId: parent.id
, reload: props.reload
, session: props.session
, style: FolderUp
, text: "..."
, disabled: disabled parent
...
...
@@ -139,7 +136,6 @@ type FolderProps =
, nodeId :: Int
, linkNodeType :: GT.NodeType
, linkId :: Int
, session :: Session
, parentId :: Int
, reload :: T.Box T2.Reload
, disabled :: Boolean
...
...
@@ -155,11 +151,11 @@ folderCpt = here.component "folderCpt" cpt where
, linkNodeType
, parentId
, reload
, session
, style
, text
, disabled
} _ = do
session <- useSession
-- | States
-- |
...
...
@@ -229,7 +225,6 @@ folderCpt = here.component "folderCpt" cpt where
, id: props.nodeId
, nodeType: props.nodeType
, name: props.text
, session: props.session
, closeCallback: \_ -> T.write_ false isBoxVisible
}
]
...
...
@@ -262,28 +257,35 @@ backButtonCpt = here.component "backButton" cpt where
H.i { className: "fa fa-arrow-left", title: "Previous view"} []
]
backButtonSmart :: R2.Component (nodeId :: Int, session :: Session)
backButtonSmart = R.createElement backButtonSmartCpt
type BackButtonSmartProps =
( nodeId :: Int )
backButtonSmartCpt :: R.Component (nodeId :: Int, session :: Session)
backButtonSmart :: R2.Component BackButtonSmartProps
backButtonSmart = R.createElement backButtonSmartCpt
backButtonSmartCpt :: R.Component BackButtonSmartProps
backButtonSmartCpt = here.component "backButtonSmart" cpt where
cpt {nodeId, session} _ = do
cpt {nodeId} _ = do
session <- useSession
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler
, loader: loadNode
, path: { nodeId, session, reload: reload' }
, render: \node -> backButtonSmartMain { node
, session
} []
, render: \node -> backButtonSmartMain { node } []
}
where
errorHandler = logRESTError here "[folderView]"
backButtonSmartMain :: R2.Component (node :: Node, session :: Session)
backButtonSmartMain = R.createElement backButtonSmartMainCpt
type BackButtonSmartMainProps =
( node :: Node )
backButtonSmartMainCpt :: R.Component (node :: Node, session :: Session)
backButtonSmartMain :: R2.Component BackButtonSmartMainProps
backButtonSmartMain = R.createElement backButtonSmartMainCpt
backButtonSmartMainCpt :: R.Component BackButtonSmartMainProps
backButtonSmartMainCpt = here.component "backButtonSmartMain" cpt where
cpt { node, session } _ = do
cpt { node } _ = do
session <- useSession
handlers <- useLinkHandler
let rootId = treeId session
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
a6ec0726
...
...
@@ -31,6 +31,7 @@ import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, mkNodeId)
import Gargantext.Sessions.Types (useOpenNodesMemberBox, openNodesInsert, openNodesDelete)
...
...
@@ -63,11 +64,11 @@ type LoaderProps =
type NodeProps =
( reloadTree :: T2.ReloadS
, session :: Session
| Common )
type TreeProps =
( root :: ID
, session :: Session
, tree :: FTree
| NodeProps )
...
...
@@ -81,15 +82,13 @@ type ChildrenTreeProps =
type PACommon =
( boxes :: Boxes
, reloadTree :: T2.ReloadS
, session :: Session
, tree :: FTree
)
-- The properties tree shares in common with nodeSpan
type NSCommon =
( frontends :: Frontends
, handed :: Handed
, session :: Session )
, handed :: Handed )
-- The annoying 'render' here is busting a cycle in the low tech
-- way. This function is only called by functions in this module, so
...
...
@@ -98,18 +97,19 @@ type ChildLoaderProps =
( id :: ID
, render :: R2.Leaf TreeProps
, root :: ID
, session :: Session
| NodeProps
)
type PerformActionProps =
( isBoxVisible :: T.Box Boolean
, session :: Session
| PACommon
)
-- | Loads and renders the tree starting at the given root node id.
treeLoader :: R2.Leaf ( key :: String | LoaderProps )
treeLoader = R2.leaf treeLoaderCpt
treeLoaderCpt :: R.Component ( key :: String | LoaderProps )
treeLoaderCpt = here.component "treeLoader" cpt where
-- treeLoaderCpt :: R.Memo LoaderProps
...
...
@@ -163,6 +163,7 @@ treeCpt = here.component "tree" cpt where
, root
, session
, tree: NTree (LNode { id, name, nodeType }) children } _ = do
let nodeId = mkNodeId session id
isBoxVisible <- T.useBox false
folderOpen <- useOpenNodesMemberBox nodeId forestOpen
...
...
@@ -184,7 +185,7 @@ treeCpt = here.component "tree" cpt where
[
nodeSpan
{ boxes
, dispatch: dispatch' isBoxVisible
, dispatch: dispatch' isBoxVisible
session
, folderOpen
, frontends
, id
...
...
@@ -193,8 +194,8 @@ treeCpt = here.component "tree" cpt where
, nodeType
, reload
, root
, session
, isBoxVisible
, session
}
<>
R2.when (folderOpen')
...
...
@@ -211,12 +212,11 @@ treeCpt = here.component "tree" cpt where
]
where
isLeaf = A.null children
nodeId = mkNodeId session id
children' = A.sortWith fTreeID pubChildren
pubChildren = if isPublic nodeType then map (map pub) children else children
dispatch' isBoxVisible a = performAction a (Record.merge common' extra) where
dispatch' isBoxVisible
session
a = performAction a (Record.merge common' extra) where
common' = RecordE.pick p :: Record PACommon
extra = { isBoxVisible }
extra = { isBoxVisible
, session
}
pub (LNode n@{ nodeType: t }) = LNode (n { nodeType = publicize t })
...
...
@@ -245,13 +245,14 @@ renderTreeChildrenCpt :: R.Component ChildrenTreeProps
renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
cpt p@{ childProps: { children'
, render }
, root } _ = do
, root
, session } _ = do
pure $ R.fragment (map renderChild children')
where
nodeProps = RecordE.pick p :: Record NodeProps
renderChild (NTree (LNode {id: cId}) _) = childLoader props [] where
props = Record.merge nodeProps { id: cId, render, root }
props = Record.merge nodeProps { id: cId, render, root
, session
}
childLoader :: R2.Component ChildLoaderProps
...
...
@@ -261,7 +262,10 @@ childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ boxes: { reloadRoot }
, reloadTree
, render
, root } _ = do
, root
, session } _ = do
let fetch _ = getNodeTreeFirstLevel session p.id
-- States
reload <- T.useBox T2.newReload
state /\ stateBox <- R2.useBox' Nothing
...
...
@@ -290,10 +294,9 @@ childLoaderCpt = here.component "childLoader" cpt where
where
errorHandler = logRESTError here "[childLoader]"
fetch _ = getNodeTreeFirstLevel p.session p.id
paint reload tree' = render (Record.merge base extra) where
base = nodeProps { reload = reload }
extra = { root, tree: tree' }
extra = { root,
session,
tree: tree' }
nodeProps = RecordE.pick p :: Record NodeProps
closeBox { isBoxVisible } =
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
a6ec0726
...
...
@@ -30,6 +30,7 @@ import Gargantext.Config.REST (logRESTError)
import Gargantext.Context.Progress (asyncContext, asyncProgress)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Version (Version, useVersion)
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
...
...
@@ -63,8 +64,8 @@ type NodeSpanProps =
, nodeType :: GT.NodeType
, reload :: T2.ReloadS
, root :: ID
, session :: Session
, isBoxVisible :: T.Box Boolean
, session :: Session
)
type IsLeaf = Boolean
...
...
@@ -87,10 +88,10 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, isLeaf
, nodeType
, reload
, session
, isBoxVisible
, session
} _ = do
-- States
-- States
route' <- T.useLive T.unequal route
-- only 1 popup at a time is allowed to be opened
...
...
@@ -323,7 +324,6 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, errors
, nodeId: id
, onFinish: onTaskFinish id task
, session
}
[
taskProgress
...
...
@@ -347,7 +347,6 @@ nodeSpanCpt = here.component "nodeSpan" cpt
, name
, nodeType
, closeCallback: \_ -> T.write_ false isBoxVisible
, session
}
]
]
...
...
@@ -555,7 +554,6 @@ type NodeActionsProps = ( nodeType :: GT.NodeType | NodeActionsCommon )
nodeActions :: R2.Component NodeActionsProps
nodeActions = R.createElement nodeActionsCpt
nodeActionsCpt :: R.Component NodeActionsProps
nodeActionsCpt = here.component "nodeActions" cpt where
cpt props _ = pure (child props.nodeType)
...
...
@@ -572,7 +570,7 @@ graphNodeActions :: R2.Leaf NodeActionsCommon
graphNodeActions = R2.leafComponent graphNodeActionsCpt
graphNodeActionsCpt :: R.Component NodeActionsCommon
graphNodeActionsCpt = here.component "graphNodeActions" cpt where
cpt { id,
session, refresh
} _ = do
cpt { id,
refresh, session
} _ = do
-- States
state /\ stateBox <- R2.useBox' Nothing
...
...
@@ -588,7 +586,7 @@ graphNodeActionsCpt = here.component "graphNodeActions" cpt where
pure $ R2.fromMaybe state \gv ->
nodeActionsGraph
{ graphVersions: gv,
session, id, refresh
}
{ graphVersions: gv,
id, refresh, session
}
[]
graphVersions session graphId = GraphAPI.graphVersions { graphId, session }
...
...
@@ -599,7 +597,7 @@ listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions = R2.leafComponent listNodeActionsCpt
listNodeActionsCpt :: R.Component NodeActionsCommon
listNodeActionsCpt = here.component "listNodeActions" cpt where
cpt { id,
session, refresh
} _ = do
cpt { id,
refresh, session
} _ = do
-- States
state /\ stateBox <- R2.useBox' Nothing
...
...
@@ -617,7 +615,6 @@ listNodeActionsCpt = here.component "listNodeActions" cpt where
nodeActionsNodeList
{ listId: id
, nodeId: corpusId
, session
, refresh: refresh
, nodeType: GT.TabNgramType GT.CTabTerms
}
...
...
src/Gargantext/Components/Forest/Tree/Node/Action.purs
View file @
a6ec0726
...
...
@@ -8,14 +8,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
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.SubTree.Types (SubTreeOut, SubTreeParams(..))
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
type Props =
( dispatch :: Action -> Aff Unit
, id :: ID
, nodeType :: GT.NodeType
, session :: Session
)
subTreeOut :: Action -> Maybe SubTreeOut
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Download.purs
View file @
a6ec0726
...
...
@@ -7,6 +7,7 @@ import Data.String.Common (toLower)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(DownloadNode))
import Gargantext.Components.Forest.Tree.Node.Tools (fragmentPT, panel, submitButtonHref)
import Gargantext.Ends (url)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Prelude
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session)
...
...
@@ -23,8 +24,7 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Download"
-- | Action : Download
type ActionDownload =
( id :: ID
, nodeType :: GT.NodeType
, session :: Session )
, nodeType :: GT.NodeType )
actionDownload :: R2.Component ActionDownload
actionDownload = R.createElement actionDownloadCpt
...
...
@@ -40,22 +40,24 @@ actionDownloadCorpus :: R2.Component ActionDownload
actionDownloadCorpus = R.createElement actionDownloadCorpusCpt
actionDownloadCorpusCpt :: R.Component ActionDownload
actionDownloadCorpusCpt = here.component "actionDownloadCorpus" cpt where
cpt { id, session } _ = do
cpt { id } _ = do
session <- useSession
pure $ panel [H.div {} [H.text info]]
(submitButtonHref DownloadNode
href
)
(submitButtonHref DownloadNode
(href session)
)
where
href = url session $ Routes.NodeAPI GT.Corpus (Just id) "export"
href
session
= url session $ Routes.NodeAPI GT.Corpus (Just id) "export"
info = "Download as JSON"
actionDownloadGraph :: R2.Component ActionDownload
actionDownloadGraph = R.createElement actionDownloadGraphCpt
actionDownloadGraphCpt :: R.Component ActionDownload
actionDownloadGraphCpt = here.component "actionDownloadGraph" cpt where
cpt { id, session } _ = do
cpt { id } _ = do
session <- useSession
pure $ panel [H.div {} [H.text info]]
(submitButtonHref DownloadNode
href
)
(submitButtonHref DownloadNode
(href session)
)
where
href = url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
href
session
= url session $ Routes.NodeAPI GT.Graph (Just id) "gexf"
info = "Info about the Graph as GEXF format"
data NodeListDownloadFormat = NL_CSV | NL_JSON
...
...
@@ -75,7 +77,9 @@ actionDownloadNodeList :: R2.Component ActionDownload
actionDownloadNodeList = R.createElement actionDownloadNodeListCpt
actionDownloadNodeListCpt :: R.Component ActionDownload
actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
cpt { id, session } _ = do
cpt { id } _ = do
session <- useSession
downloadFormat <- T.useBox NL_JSON
downloadFormat' <- T.useLive T.unequal downloadFormat
...
...
@@ -87,14 +91,14 @@ actionDownloadNodeListCpt = here.component "actionDownloadNodeList" cpt where
, opt NL_JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ]
]
(submitButtonHref DownloadNode $ href downloadFormat')
(submitButtonHref DownloadNode $ href downloadFormat'
session
)
where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readNodeListDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeListDownloadFormat -> String
href t = url session $ Routes.NodeAPI GT.NodeList (Just id) (toLower $ show t)
href :: NodeListDownloadFormat -> S
ession -> S
tring
href t
session
= url session $ Routes.NodeAPI GT.NodeList (Just id) (toLower $ show t)
info :: NodeListDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format"
...
...
@@ -118,7 +122,9 @@ actionDownloadNodeTexts :: R2.Component ActionDownload
actionDownloadNodeTexts = R.createElement actionDownloadNodeTextsCpt
actionDownloadNodeTextsCpt :: R.Component ActionDownload
actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
cpt { id, session } _ = do
cpt { id } _ = do
session <- useSession
downloadFormat <- T.useBox NT_JSON
downloadFormat' <- T.useLive T.unequal downloadFormat
...
...
@@ -130,14 +136,14 @@ actionDownloadNodeTextsCpt = here.component "actionDownloadNodeTexts" cpt where
, opt NT_JSON downloadFormat ]
, H.div {} [ H.text $ info downloadFormat' ]
]
(submitButtonHref DownloadNode $ href downloadFormat')
(submitButtonHref DownloadNode $ href downloadFormat'
session
)
where
opt t downloadFormat = H.option { value: show t } [ H.text $ show t ]
where
onClick _ = T.write_ t downloadFormat
onChange downloadFormat e = T.write_ (readNodeTextsDownloadFormat $ R.unsafeEventValue e) downloadFormat
href :: NodeTextsDownloadFormat -> String
href t = url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t)
href :: NodeTextsDownloadFormat -> S
ession -> S
tring
href t
session
= url session $ Routes.NodeAPI GT.NodeTexts (Just id) ("export/" <> urlNodeTextsDownloadFormat t)
info :: NodeTextsDownloadFormat -> String
info t = "Info about the Documents as " <> show t <> " format"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
a6ec0726
...
...
@@ -37,7 +37,7 @@ linkNode = R.createElement linkNodeCpt
linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = here.component "linkNode" cpt
where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do
action <- T.useBox (LinkNode { nodeType: Nothing, params: Nothing})
pure $
...
...
@@ -47,7 +47,6 @@ linkNodeCpt = here.component "linkNode" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
...
...
@@ -62,7 +61,7 @@ linkNode' = R.createElement linkNodeCpt'
linkNodeCpt' :: R.Component Props
linkNodeCpt' = here.component "__clone__" cpt
where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams, action } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams, action } _ = do
action' <- T.useLive T.unequal action
...
...
@@ -82,7 +81,6 @@ linkNodeCpt' = here.component "__clone__" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
] button
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/ManageTeam.purs
View file @
a6ec0726
...
...
@@ -11,6 +11,7 @@ import Gargantext.Components.GraphQL.Endpoints (deleteTeamMembership, getTeam)
import Gargantext.Components.GraphQL.Team (Team, TeamMember)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session)
import Gargantext.Types (ID, NodeType)
import Gargantext.Utils.Reactix as R2
...
...
@@ -24,21 +25,19 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.ManageTeam"
type ActionManageTeam = (
id :: ID
, nodeType :: NodeType
, session :: Session
)
actionManageTeam :: R2.Component ActionManageTeam
actionManageTeam = R.createElement actionManageTeamCpt
actionManageTeamCpt :: R.Component ActionManageTeam
actionManageTeamCpt = here.component "actionManageTeam" cpt where
cpt {id, session} _ = do
cpt {id} _ = do
session <- useSession
useLoader { errorHandler
, loader: loadTeam
, path: { nodeId: id, session }
, render: \team -> teamLayoutWrapper { team
, nodeId: id
, session
} []
}
where
...
...
@@ -46,28 +45,25 @@ actionManageTeamCpt = here.component "actionManageTeam" cpt where
type TeamProps =
( nodeId :: ID
, session :: Session
, team :: Team
)
teamLayoutWrapper :: R2.Component TeamProps
teamLayoutWrapper = R.createElement teamLayoutWrapperCpt
teamLayoutWrapperCpt :: R.Component TeamProps
teamLayoutWrapperCpt = here.component "teamLayoutWrapper" cpt where
cpt {nodeId,
session,
team: {team_owner_username, team_members}} _ = do
cpt {nodeId, team: {team_owner_username, team_members}} _ = do
teamS <- T.useBox team_members
team' <- T.useLive T.unequal teamS
error <- T.useBox ""
error' <- T.useLive T.unequal error
pure $ teamLayoutRows {nodeId,
session,
team: teamS, team', error, error', team_owner_username}
pure $ teamLayoutRows {nodeId, team: teamS, team', error, error', team_owner_username}
type TeamRowProps =
( nodeId :: ID
, session :: Session
, team :: T.Box (Array TeamMember)
, error :: T.Box String
, error :: T.Box String
, team' :: Array TeamMember
, error' :: String
, team_owner_username :: String
...
...
@@ -75,10 +71,23 @@ type TeamRowProps =
teamLayoutRows :: R2.Leaf TeamRowProps
teamLayoutRows = R2.leafComponent teamLayoutRowsCpt
teamLayoutRowsCpt :: R.Component TeamRowProps
teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
cpt { team, nodeId, session, error, team', error', team_owner_username} _ = do
cpt { team, nodeId, 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
true -> pure $ H.div { style: {margin: "10px"}}
...
...
@@ -86,22 +95,11 @@ teamLayoutRowsCpt = here.component "teamLayoutRows" cpt where
false -> pure $ Tools.panel (makeLeader team_owner_username : (map makeTeam team')) (H.div {} [H.text error'])
where
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 }
} []
]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
makeLeader username = H.div {className: "from-group row"} [ H.div { className: "col-8"} [ H.text username ]
, H.p { className: "col-2"} [ H.text "owner"]
]
submit sharedFolderId _ = do
runAff_ callback $ saveDeleteTeam { session, nodeId, sharedFolderId }
callback res =
case res of
Left _ -> do
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
a6ec0726
...
...
@@ -28,7 +28,7 @@ mergeNode = R.createElement mergeNodeCpt
mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt = here.component "mergeNode" cpt
where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do
action <- T.useBox (MergeNode { params: Nothing })
action' <- T.useLive T.unequal action
...
...
@@ -47,7 +47,6 @@ mergeNodeCpt = here.component "mergeNode" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
, H.ul { className:"merge mx-auto list-group"}
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
a6ec0726
...
...
@@ -30,7 +30,7 @@ moveNode = R.createElement moveNodeCpt
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = here.component "moveNode" cpt
where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do
action :: T.Box Action <- T.useBox (MoveNode {params: Nothing})
pure $
...
...
@@ -40,7 +40,6 @@ moveNodeCpt = here.component "moveNode" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
...
...
@@ -54,7 +53,7 @@ moveNode' :: R2.Component Props
moveNode' = R.createElement moveNodeCpt'
moveNodeCpt' :: R.Component Props
moveNodeCpt' = here.component "__clone__" cpt where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams, action } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams, action } _ = do
action' <- T.useLive T.unequal action
...
...
@@ -72,7 +71,6 @@ moveNodeCpt' = here.component "__clone__" cpt where
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
] button
src/Gargantext/Components/Forest/Tree/Node/Action/Search.purs
View file @
a6ec0726
...
...
@@ -10,7 +10,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Lang (allLangs)
import Gargantext.Sessions (Session)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
...
...
@@ -25,8 +24,7 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search"
type Props =
( boxes :: Boxes
, dispatch :: Action -> Aff Unit
, id :: Maybe ID
, session :: Session )
, id :: Maybe ID )
-- | Action : Search
actionSearch :: R2.Component Props
...
...
@@ -34,7 +32,7 @@ actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt
where
cpt { boxes: { errors }, dispatch, id
, session
} _ = do
cpt { boxes: { errors }, dispatch, id } _ = do
search <- T.useBox $ defaultSearch { node_id = id }
pure $ R.fragment
[ H.p { className: "action-search m-1" }
...
...
@@ -44,7 +42,6 @@ actionSearchCpt = here.component "actionSearch" cpt
, langs: allLangs
, onSearch: searchOn dispatch
, search
, session
} []
]
where
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchBar.purs
View file @
a6ec0726
...
...
@@ -7,6 +7,7 @@ import Effect (Effect)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (searchField)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (Search, allDatabases)
import Gargantext.Components.Lang (Lang)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Prelude (Unit, pure, ($))
import Gargantext.Sessions (Session)
import Gargantext.Types (FrontendError)
...
...
@@ -23,7 +24,6 @@ type Props = ( errors :: T.Box (Array FrontendError)
, langs :: Array Lang
, onSearch :: GT.AsyncTaskWithType -> Effect Unit
, search :: T.Box Search
, session :: Session
)
searchBar :: R2.Component Props
...
...
@@ -31,7 +31,7 @@ searchBar = R.createElement searchBarCpt
searchBarCpt :: R.Component Props
searchBarCpt = here.component "searchBar" cpt
where
cpt { errors, langs, onSearch, search
, session
} _ = do
cpt { errors, langs, onSearch, search } _ = do
--onSearchChange session s
pure $ H.div { className: "search-bar m-1" }
[ searchField { databases: allDatabases
...
...
@@ -39,6 +39,5 @@ searchBarCpt = here.component "searchBar" cpt
, langs
, onSearch
, search
, session
} []
]
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
a6ec0726
...
...
@@ -25,6 +25,7 @@ import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session)
import Gargantext.Types (FrontendError)
import Gargantext.Types as GT
...
...
@@ -54,7 +55,6 @@ type Props =
-- State hook for a search, how we get data in and out
, onSearch :: GT.AsyncTaskWithType -> Effect Unit
, search :: T.Box Search
, session :: Session
)
searchField :: R2.Component Props
...
...
@@ -62,7 +62,7 @@ searchField = R.createElement searchFieldCpt
searchFieldCpt :: R.Component Props
searchFieldCpt = here.component "searchField" cpt
where
cpt { databases, errors, langs, onSearch, search
, session
} _ = do
cpt { databases, errors, langs, onSearch, search } _ = do
selection <- T.useBox ListSelection.MyListsFirst
pure $
...
...
@@ -72,9 +72,9 @@ searchFieldCpt = here.component "searchField" cpt
-- then
-- H.div {}[]
-- else
, datafieldInput { databases, langs, search
, session
} []
, ListSelection.selection { selection
, session
} []
, submitButton { errors, onSearch, search, selection
, session
} []
, datafieldInput { databases, langs, search } []
, ListSelection.selection { selection } []
, submitButton { errors, onSearch, search, selection } []
]
--pure $ panel params button
...
...
@@ -118,14 +118,15 @@ componentYearsCpt = here.component "componentYears" cpt where
, on: { click: clickRemove idx search } } [] ]
type ComponentIMTProps =
( session :: Session
| ComponentProps )
( | ComponentProps )
componentIMT :: R2.Component ComponentIMTProps
componentIMT = R.createElement componentIMTCpt
componentIMTCpt :: R.Component ComponentIMTProps
componentIMTCpt = here.component "componentIMT" cpt where
cpt { search, session } _ = do
cpt { search } _ = do
session <- useSession
useLoader { errorHandler
, loader: \_ -> getIMTSchools session
, path: unit
...
...
@@ -143,7 +144,7 @@ componentWithIMTOrgsCpt :: R.Component ComponentWithIMTOrgsProps
componentWithIMTOrgsCpt = here.component "componentWithIMTOrgs" cpt where
cpt { schools, search } _ = do
search' <- T.useLive T.unequal search
let allIMTOrgs = [All_IMT] <> (IMT_org <$> schools)
liCpt org =
H.li {}
...
...
@@ -156,7 +157,7 @@ componentWithIMTOrgsCpt = here.component "componentWithIMTOrgs" cpt where
All_IMT -> H.i {} [H.text $ " " <> show org]
(IMT_org { school_shortName }) -> H.text $ " " <> school_shortName
]
pure $ R.fragment
[ H.ul {} $ map liCpt $ allIMTOrgs
--, filterInput fi
...
...
@@ -428,44 +429,43 @@ filterInput (term /\ setTerm) =
type DatafieldInputProps =
( databases :: Array Database
, langs :: Array Lang
, search :: T.Box Search
, session :: Session )
, search :: T.Box Search )
datafieldInput :: R2.Component DatafieldInputProps
datafieldInput = R.createElement datafieldInputCpt
datafieldInputCpt :: R.Component DatafieldInputProps
datafieldInputCpt = here.component "datafieldInput" cpt where
cpt { databases, langs, search
, session
} _ = do
cpt { databases, langs, search} _ = do
search' <- T.useLive T.unequal search
iframeRef <- R.useRef null
pure $ H.div {}
[ dataFieldNav { search } []
, if isExternal search'.datafield
then databaseInput { databases, search } []
else H.div {} []
, if isHAL search'.datafield
then orgInput { orgs: allOrgs, search } []
else H.div {} []
, if isIMT search'.datafield
then componentIMT { search
, session
} []
then componentIMT { search } []
else H.div {} []
, if isHAL search'.datafield
then componentYears { search } []
else H.div {} []
, if isCNRS search'.datafield
then componentCNRS { search } []
else H.div {} []
, if needsLang search'.datafield
then langNav { langs, search } []
else H.div {} []
, H.div {} [ searchIframes { iframeRef, search } [] ]
]
...
...
@@ -518,7 +518,6 @@ type SubmitButtonProps =
, onSearch :: GT.AsyncTaskWithType -> Effect Unit
, search :: T.Box Search
, selection :: T.Box ListSelection.Selection
, session :: Session
)
submitButton :: R2.Component SubmitButtonProps
...
...
@@ -526,7 +525,9 @@ submitButton = R.createElement submitButtonComponent
submitButtonComponent :: R.Component SubmitButtonProps
submitButtonComponent = here.component "submitButton" cpt
where
cpt { errors, onSearch, search, selection, session } _ = do
cpt { errors, onSearch, search, selection } _ = do
session <- useSession
search' <- T.useLive T.unequal search
selection' <- T.useLive T.unequal selection
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
a6ec0726
...
...
@@ -20,7 +20,6 @@ import Gargantext.Utils.SimpleJSON as GUSJ
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Toestand as T
here :: R2.Here
...
...
@@ -74,7 +73,7 @@ publishNode = R.createElement publishNodeCpt
publishNodeCpt :: R.Component SubTreeParamsIn
publishNodeCpt = here.component "publishNode" cpt
where
cpt { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } _ = do
cpt { boxes, dispatch, id, nodeType, subTreeParams } _ = do
action <- T.useBox (Action.SharePublic { params: Nothing })
action' <- T.useLive T.unequal action
...
...
@@ -90,7 +89,6 @@ publishNodeCpt = here.component "publishNode" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} []
] button
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
a6ec0726
...
...
@@ -28,6 +28,7 @@ import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (AffRESTError, RESTError)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Types (ID, NodeType(..))
...
...
@@ -50,23 +51,22 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Upload"
type ActionUpload =
( dispatch :: Action -> Aff Unit
, id :: ID
, nodeType :: NodeType
, session :: Session )
, nodeType :: NodeType )
actionUpload :: R2.Component ActionUpload
actionUpload = R.createElement actionUploadCpt
actionUploadCpt :: R.Component ActionUpload
actionUploadCpt = here.component "actionUpload" cpt where
cpt { nodeType: Corpus, dispatch, id
, session
} _ =
pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus
, session
}
cpt { nodeType: Corpus, dispatch, id } _ =
pure $ uploadFileView { dispatch, id, nodeType: GT.Corpus }
cpt { nodeType: NodeList, dispatch, id
, session
} _ =
pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList
, session
} []
cpt { nodeType: NodeList, dispatch, id } _ =
pure $ uploadTermListView { dispatch, id, nodeType: GT.NodeList } []
cpt props@{ nodeType: NodeFrameCalc } _ = pure $ uploadFrameCalcView props []
cpt props@{ nodeType: Annuaire, dispatch, id
, session
} _ =
pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire
, session
}
cpt props@{ nodeType: Annuaire, dispatch, id } _ =
pure $ uploadListView { dispatch, id, nodeType: GT.Annuaire }
cpt props@{ nodeType: _ } _ = pure $ actionUploadOther props []
...
...
@@ -105,7 +105,7 @@ uploadFileView = R2.leafComponent uploadFileViewCpt
uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt
where
cpt { dispatch, id, nodeType
, session
} _ = do
cpt { dispatch, id, nodeType } _ = do
-- mFile :: R.State (Maybe UploadFile) <- R.useState' Nothing
mFile <- T.useBox (Nothing :: Maybe UploadFile)
fileType <- T.useBox CSV
...
...
@@ -158,7 +158,7 @@ uploadFileViewCpt = here.component "uploadFileView" cpt
]
, R2.row
[ H.div { className: "col-6 flex-space-around" }
[ ListSelection.selection { selection
, session
} [] ]
[ ListSelection.selection { selection } [] ]
]
]
...
...
@@ -200,7 +200,6 @@ type UploadButtonProps =
uploadButton :: R2.Component UploadButtonProps
uploadButton = R.createElement uploadButtonCpt
uploadButtonCpt :: R.Component UploadButtonProps
uploadButtonCpt = here.component "uploadButton" cpt
where
...
...
@@ -279,7 +278,7 @@ uploadListView :: R2.Leaf Props
uploadListView = R2.leafComponent uploadListViewCpt
uploadListViewCpt :: R.Component Props
uploadListViewCpt = here.component "uploadListView" cpt where
cpt { dispatch
, session
} _ = do
cpt { dispatch } _ = do
-- States
mFile
<- T.useBox (Nothing :: Maybe UploadFile)
...
...
@@ -396,7 +395,6 @@ uploadListViewCpt = here.component "uploadListView" cpt where
[
ListSelection.selection
{ selection
, session
} []
]
]
...
...
@@ -713,7 +711,7 @@ uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt
uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
where
cpt { dispatch
, session
} _ = do
cpt { dispatch } _ = do
lang' /\ langBox
<- R2.useBox' EN
selection' /\ selectionBox
...
...
@@ -765,7 +763,6 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
[
ListSelection.selection
{ selection: selectionBox
, session
} []
]
]
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/WriteNodesDocuments.purs
View file @
a6ec0726
...
...
@@ -23,14 +23,13 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocument
type ActionWriteNodesDocuments =
( boxes :: Boxes
, dispatch :: Action -> Aff Unit
, id :: GT.ID
, session :: Session )
, id :: GT.ID )
actionWriteNodesDocuments :: R2.Component ActionWriteNodesDocuments
actionWriteNodesDocuments = R.createElement actionWriteNodesDocumentsCpt
actionWriteNodesDocumentsCpt :: R.Component ActionWriteNodesDocuments
actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt where
cpt { boxes, dispatch, id
, session
} _ = do
cpt { boxes, dispatch, id } _ = do
let bodies =
[ R2.row
[ H.div { className: "col-12 flex-space-around" }
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
a6ec0726
...
...
@@ -43,7 +43,6 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
type CommonProps =
( dispatch :: Action -> Aff Unit
, session :: Session
)
nodePopupView :: R2.Leaf NodePopupProps
...
...
@@ -170,14 +169,13 @@ nodePopupViewCpt = here.component "nodePopupView" cpt where
mPanelAction :: Record NodePopupS -> Record NodePopupProps -> R.Element
mPanelAction { action: Just action }
{ boxes, dispatch, id, name, nodeType
, session
} =
{ boxes, dispatch, id, name, nodeType } =
panelAction { action
, boxes
, dispatch
, id
, name
, nodeType
, session
}
mPanelAction { action: Nothing } _ =
H.div
...
...
@@ -324,7 +322,6 @@ type PanelActionProps =
, dispatch :: Action -> Aff Unit
, name :: Name
, nodeType :: GT.NodeType
, session :: Session
)
panelAction :: R2.Leaf PanelActionProps
...
...
@@ -333,28 +330,28 @@ panelActionCpt :: R.Component PanelActionProps
panelActionCpt = here.component "panelAction" cpt
where
cpt { action: Documentation nodeType} _ = pure $ actionDoc { nodeType } []
cpt { action: Download, id, nodeType
, session} _ = pure $ actionDownload { id, nodeType, session
} []
cpt { action: Upload, dispatch, id, nodeType
, session} _ = pure $ actionUpload { dispatch, id, nodeType, session
} []
cpt { action: Download, id, nodeType
} _ = pure $ actionDownload { id, nodeType
} []
cpt { action: Upload, dispatch, id, nodeType
} _ = pure $ actionUpload { dispatch, id, nodeType
} []
cpt { action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } []
cpt { action: ManageTeam, nodeType, id
, session} _ = pure $ actionManageTeam { id, nodeType, session
} []
cpt { action: ManageTeam, nodeType, id
} _ = pure $ actionManageTeam { id, nodeType
} []
cpt { action: Add xs, dispatch, id, name, nodeType} _ =
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} []
cpt { action: Refresh , dispatch, nodeType } _ = pure $ update { dispatch, nodeType } []
cpt { action: Config, nodeType } _ =
pure $ fragmentPT $ "Config " <> show nodeType
-- Functions using SubTree
cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType
, session
} _ =
pure $ mergeNode { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } []
cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType
, session
} _ =
pure $ moveNode { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } []
cpt { action: Link {subTreeParams}, boxes, dispatch, id, nodeType
, session
} _ =
pure $ linkNode { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } []
cpt { action: Merge {subTreeParams}, boxes, dispatch, id, nodeType } _ =
pure $ mergeNode { boxes, dispatch, id, nodeType, subTreeParams } []
cpt { action: Move {subTreeParams}, boxes, dispatch, id, nodeType } _ =
pure $ moveNode { boxes, dispatch, id, nodeType, subTreeParams } []
cpt { action: Link {subTreeParams}, boxes, dispatch, id, nodeType } _ =
pure $ linkNode { boxes, dispatch, id, nodeType, subTreeParams } []
cpt { action : Share, dispatch, id } _ = pure $ Share.shareNode { dispatch, id } []
cpt { action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType
, session
} _ =
pure $ Share.publishNode { boxes, dispatch, id, nodeType, s
ession, s
ubTreeParams } []
cpt { action: SearchBox, boxes, dispatch, id
, session
} _ =
pure $ actionSearch { boxes, dispatch, id: Just id
, session
} []
cpt { action: WriteNodesDocuments, boxes, dispatch, id
, session
} _ =
pure $ actionWriteNodesDocuments { boxes, dispatch, id
, session
} []
cpt { action : Publish {subTreeParams}, boxes, dispatch, id, nodeType } _ =
pure $ Share.publishNode { boxes, dispatch, id, nodeType, subTreeParams } []
cpt { action: SearchBox, boxes, dispatch, id } _ =
pure $ actionSearch { boxes, dispatch, id: Just id } []
cpt { action: WriteNodesDocuments, boxes, dispatch, id } _ =
pure $ actionWriteNodesDocuments { boxes, dispatch, id } []
cpt _ _ = pure $ H.div {} []
src/Gargantext/Components/Forest/Tree/Node/Box/Types.purs
View file @
a6ec0726
...
...
@@ -13,7 +13,6 @@ import Gargantext.Types as GT
type CommonProps =
( dispatch :: Action -> Aff Unit
, session :: Session
)
type NodePopupProps =
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
a6ec0726
...
...
@@ -14,6 +14,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTr
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT
...
...
@@ -49,9 +50,10 @@ subTreeViewCpt = here.component "subTreeView" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
} _ = do
session <- useSession
let
SubTreeParams {showtypes} = subTreeParams
-- (valAction /\ setAction) = action
...
...
@@ -66,7 +68,6 @@ subTreeViewCpt = here.component "subTreeView" cpt
, dispatch
, id
, nodeType
, session
, subTreeParams
, tree
} [] }
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/Sync.purs
View file @
a6ec0726
...
...
@@ -8,6 +8,7 @@ import Effect.Class (liftEffect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..), Elevation(..), Variant(..))
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session)
import Gargantext.Types as GT
import Gargantext.Utils ((?))
...
...
@@ -24,27 +25,27 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.Sync"
type NodeActionsGraphProps =
( id :: GT.ID
, graphVersions :: Record GraphAPI.GraphVersions
, session :: Session
, refresh :: Unit -> Aff Unit
, session :: Session
)
nodeActionsGraph :: R2.Component NodeActionsGraphProps
nodeActionsGraph = R.createElement nodeActionsGraphCpt
nodeActionsGraphCpt :: R.Component NodeActionsGraphProps
nodeActionsGraphCpt = here.component "nodeActionsGraph" cpt where
cpt { id, graphVersions,
session, refresh
} _ =
cpt { id, graphVersions,
refresh, session
} _ =
let sameVersions = (graphVersions.gv_graph == Just graphVersions.gv_repo)
in pure $
R2.when (not sameVersions) $
graphUpdateButton { id,
session, refresh
}
graphUpdateButton { id,
refresh, session
}
type GraphUpdateButtonProps =
( id :: GT.ID
, session :: Session
, refresh :: Unit -> Aff Unit
, session :: Session
)
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
...
...
@@ -52,7 +53,7 @@ graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
where
cpt { id,
session, refresh
} _ = do
cpt { id,
refresh, session
} _ = do
enabled <- T.useBox true
enabled' <- T.useLive T.unequal enabled
...
...
@@ -63,7 +64,7 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
, variant: Secondary
, elevation: Level1
, status: enabled' ? Enabled $ Disabled
, callback: const $ onClick enabled' enabled
, callback: const $ onClick enabled' enabled
session
, name: "refresh"
}
...
...
@@ -75,8 +76,8 @@ graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
-- , on: { click: onClick enabled' enabled } } []
-- ]
where
onClick false _ = pure unit
onClick true enabled = do
onClick false _
_
= pure unit
onClick true enabled
session
= do
launchAff_ $ do
liftEffect $ T.write_ false enabled
_g <- GraphAPI.updateGraphVersions { graphId: id, session }
...
...
@@ -91,7 +92,6 @@ type NodeActionsNodeListProps =
listId :: GT.ListId
, nodeId :: GT.ID
, nodeType :: GT.TabSubType GT.CTabNgramType
, session :: Session
, refresh :: Unit -> Aff Unit
)
...
...
@@ -106,7 +106,6 @@ type NodeListUpdateButtonProps =
( listId :: GT.ListId
, nodeId :: GT.ID
, nodeType :: GT.TabSubType GT.CTabNgramType
, session :: Session
, refresh :: Unit -> Aff Unit
)
...
...
src/Gargantext/Components/GraphExplorer/Frame/DocFocus.purs
View file @
a6ec0726
...
...
@@ -15,6 +15,7 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath)
import Gargantext.Components.GraphExplorer.Types (GraphSideDoc(..))
import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
...
...
@@ -27,19 +28,17 @@ here = R2.here "Gargantext.Components.GraphExplorer.Frame.DocFocus"
type Props =
( graphSideDoc :: GraphSideDoc
, session :: Session
, closeCallback :: Unit -> Effect Unit
)
docFocus :: R2.Leaf ( key :: String | Props )
docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where
cpt { graphSideDoc: GraphSideDoc { docId, listId, corpusId }
, session
, closeCallback
} _ = do
session <- useSession
-- | States
-- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
...
...
src/Gargantext/Components/GraphExplorer/Layout.purs
View file @
a6ec0726
...
...
@@ -28,7 +28,6 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Config (defaultFrontends)
import Gargantext.Data.Louvain as DLouvain
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Louvain as Louvain
...
...
@@ -75,8 +74,6 @@ layoutCpt = here.component "layout" cpt where
, graphId
} <- GraphStore.use
session <- useSession
showSidebar' <- R2.useLive' showSidebar
showDoc' <- R2.useLive' showDoc
mMetaData' <- R2.useLive' mMetaData
...
...
@@ -152,8 +149,7 @@ layoutCpt = here.component "layout" cpt where
{ className: "graph-layout__focus__inner" }
[
docFocus
{ session
, graphSideDoc
{ graphSideDoc
, closeCallback: closeDoc
, key: show $ getter _.docId graphSideDoc
}
...
...
@@ -182,7 +178,6 @@ layoutCpt = here.component "layout" cpt where
GES.sidebar
{ frontends: defaultFrontends
, metaData
, session
}
]
]
...
...
@@ -200,7 +195,6 @@ layoutCpt = here.component "layout" cpt where
{ fa2Ref
, noverlapRef
, reloadForest: reloadForest
, session
, sigmaRef
}
]
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
a6ec0726
...
...
@@ -37,6 +37,7 @@ import Gargantext.Core.NgramsTable.Types as CNT
import Gargantext.Data.Array (mapMaybe)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, FrontendError(..), NodeID, TabSubType(..), TabType(..), TermList(..), modeTabType)
...
...
@@ -54,7 +55,6 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Props =
( metaData :: GET.MetaData
, session :: Session
, frontends :: Frontends
)
...
...
@@ -626,7 +626,6 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
, metaData
, nodesMap
, rType
, session
} children = do
-- States
{ errors
...
...
@@ -641,6 +640,8 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
selectedNodeIds' <- R2.useLive' selectedNodeIds
graphId' <- R2.useLive' graphId
session <- useSession
-- Behaviors
let
callback _ = do
...
...
@@ -650,7 +651,7 @@ updateTermButtonCpt = here.component "updateTermButton" cpt where
, graphId: graphId'
, metaData: metaData
, nodes
, session
: session
, session
, termList: rType
, reloadForest
}
...
...
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
a6ec0726
...
...
@@ -45,9 +45,8 @@ type Props =
docListWrapper :: R2.Leaf Props
docListWrapper = R2.leaf docListWrapperCpt
docListWrapperCpt :: R.Component Props
docListWrapperCpt = here.component "
w
rapper" cpt where
docListWrapperCpt = here.component "
docListW
rapper" cpt where
cpt { metaData: GET.MetaData metaData
} _ = do
-- | States
...
...
@@ -123,9 +122,8 @@ type ListProps =
docList :: R2.Leaf ListProps
docList = R2.leaf docListCpt
docListCpt :: R.Component ListProps
docListCpt = here.component "
main
" cpt where
docListCpt = here.component "
docList
" cpt where
-- | Helpers
-- |
errorHandler err = do
...
...
@@ -268,7 +266,6 @@ type ItemProps =
item :: R2.Leaf ItemProps
item = R2.leaf itemCpt
itemCpt :: R.Component ItemProps
itemCpt = here.component "item" cpt where
cpt { documentView: dv@(DocumentsView { id, title, source })
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Buttons.purs
View file @
a6ec0726
...
...
@@ -29,12 +29,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileFormat(..
import Gargantext.Components.GraphExplorer.API (cloneGraph)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Utils as GEU
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Camera as Camera
import Gargantext.Hooks.Sigmax.Graphology as Graphology
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Sessions (Session)
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
...
...
@@ -76,7 +76,6 @@ type CameraButtonProps =
, hyperdataGraph :: GET.HyperdataGraph
, forceAtlasState :: T.Box SigmaxTypes.ForceAtlasState
, reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
)
...
...
@@ -96,8 +95,8 @@ cameraButtonCpt = here.component "cameraButton" cpt
, forceAtlasState
, hyperdataGraph: GET.HyperdataGraph { graph: GET.GraphData graphData' }
, reloadForest
, session
, sigmaRef } _ = do
session <- useSession
forceAtlasState' <- R2.useLive' forceAtlasState
pure $ B.button
...
...
src/Gargantext/Components/GraphExplorer/Toolbar/Controls.purs
View file @
a6ec0726
...
...
@@ -15,6 +15,7 @@ import Gargantext.Components.GraphExplorer.Toolbar.Buttons (cameraButton, center
import Gargantext.Components.GraphExplorer.Toolbar.RangeControl (edgeConfluenceControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.Toolbar.SlideButton (labelSizeButton, labelRenderedSizeThresholdButton, mouseSelectorSizeSlider)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.Sigmax.ForceAtlas2 as ForceAtlas
import Gargantext.Hooks.Sigmax.Noverlap as Noverlap
import Gargantext.Hooks.Sigmax as Sigmax
...
...
@@ -35,7 +36,6 @@ type Controls =
( fa2Ref :: R.Ref (Maybe ForceAtlas.FA2Layout)
, noverlapRef :: R.Ref (Maybe Noverlap.NoverlapLayout)
, reloadForest :: T2.ReloadS
, session :: Session
, sigmaRef :: R.Ref Sigmax.Sigma
)
...
...
@@ -46,7 +46,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
cpt { fa2Ref
, noverlapRef
, reloadForest
, session
, sigmaRef
} _ = do
-- | States
...
...
@@ -82,8 +81,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
edgeConfluenceRange' <- R2.useLive' edgeConfluenceRange
nodeSizeRange' <- R2.useLive' nodeSizeRange
-- session <- useSession
-- ref to track automatic FA pausing
-- If user pauses FA before auto is triggered, clear the timeoutId
mFAPauseRef <- R.useRef Nothing
...
...
@@ -182,7 +179,6 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, forceAtlasState
, hyperdataGraph: hyperdataGraph'
, reloadForest
, session
, sigmaRef: sigmaRef
}
]
...
...
src/Gargantext/Components/ListSelection.purs
View file @
a6ec0726
...
...
@@ -10,6 +10,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe)
import Gargantext.Components.ListSelection.Types (NodeSimple(..), Selection(..), selectedListIds)
import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Session (useSession)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types (ID, NodeType(..), fldr)
...
...
@@ -23,14 +24,13 @@ here = R2.here "Gargantext.Components.ListSelection"
type Props =
( selection :: T.Box Selection
, session :: Session
)
selection :: R2.Component Props
selection = R.createElement selectionCpt
selectionCpt :: R.Component Props
selectionCpt = here.component "selection" cpt where
cpt { selection
, session
} _ = do
cpt { selection } _ = do
selection' <- R2.useLive' selection
pure $ H.div { className: "list-selection" }
[
...
...
@@ -44,33 +44,33 @@ selectionCpt = here.component "selection" cpt where
]
}
[]
, selectedIds { selection
, session
} []
, selectedIds { selection } []
]
selectedIds :: R2.Component Props
selectedIds = R.createElement selectedIdsCpt
selectedIdsCpt :: R.Component Props
selectedIdsCpt = here.component "selectedIds" cpt where
cpt { selection
, session
} _ = do
cpt { selection } _ = do
selection' <- T.useLive T.unequal selection
pure $ case selection' of
SelectedLists ids -> H.div {} [ idsSelector { selection
, session
} [] ]
SelectedLists ids -> H.div {} [ idsSelector { selection } [] ]
_ -> H.div {} []
type IdsSelectorProps =
( selection :: T.Box Selection
, session :: Session )
( selection :: T.Box Selection )
idsSelector :: R2.Component IdsSelectorProps
idsSelector = R.createElement idsSelectorCpt
idsSelectorCpt :: R.Component IdsSelectorProps
idsSelectorCpt = here.component "idsSelector" cpt where
cpt { selection, session } _ = do
cpt { selection } _ = do
session <- useSession
let Session { treeId: root } = session
pure $ H.div { className: "ids-selector" }
[ listTree { name: "", nodeType: NodeUser, root, selection, session } ] -- $ map checkbox [1, 2, 3, 4]
where
Session { treeId: root } = session
[ listTree { name: "", nodeType: NodeUser, root, selection } ] -- $ map checkbox [1, 2, 3, 4]
listIdsRoute :: ID -> SessionRoute
listIdsRoute = Children NodeList 0 1 Nothing <<< Just
...
...
@@ -88,22 +88,20 @@ type ListTreeProps =
, nodeType :: NodeType
, root :: ID
, selection :: T.Box Selection
, session :: Session
)
listTree :: R2.Leaf ListTreeProps
listTree props = R.createElement listTreeCpt props []
listTreeCpt :: R.Component ListTreeProps
listTreeCpt = here.component "listTree" cpt where
cpt { name, nodeType, root, selection
, session
} _ = do
cpt { name, nodeType, root, selection } _ = do
pure $ H.div { className: "tree" }
[ H.div { className: "root" }
[ H.i { className: fldr nodeType true } []
, H.text $ "[" <> show root <> "] " <> name ]
, listTreeChildren { render: listTree
, root
, selection
, session } []
, selection } []
]
type Render = Record ListTreeProps -> R.Element
...
...
@@ -111,14 +109,14 @@ type ListTreeChildrenProps =
( render :: Render
, root :: ID
, selection :: T.Box Selection
, session :: Session
)
listTreeChildren :: R2.Component ListTreeChildrenProps
listTreeChildren = R.createElement listTreeChildrenCpt
listTreeChildrenCpt :: R.Component ListTreeChildrenProps
listTreeChildrenCpt = here.component "listTreeChildren" cpt where
cpt { render, root, selection, session } _ = do
cpt { render, root, selection } _ = do
session <- useSession
useLoader { errorHandler
, loader: loadTreeChildren
, path: { root, session }
...
...
@@ -126,8 +124,7 @@ listTreeChildrenCpt = here.component "listTreeChildren" cpt where
listTreeChildrenLoaded { loaded
, render
, root
, selection
, session } [] }
, selection } [] }
where
errorHandler err = case err of
ReadJSONError err' -> here.warn2 "[listTreeChildren] ReadJSONError" $ show err'
...
...
@@ -137,30 +134,29 @@ type ListTreeChildrenLoadedProps =
( loaded :: Array NodeSimple
, render :: Render
, root :: ID
, selection :: T.Box Selection
, session :: Session )
, selection :: T.Box Selection )
listTreeChildrenLoaded :: R2.Component ListTreeChildrenLoadedProps
listTreeChildrenLoaded = R.createElement listTreeChildrenLoadedCpt
listTreeChildrenLoadedCpt :: R.Component ListTreeChildrenLoadedProps
listTreeChildrenLoadedCpt = here.component "listTreeChildrenLoaded" cpt where
cpt { loaded, render, root, selection
, session
} _ = do
cpt { loaded, render, root, selection } _ = do
pure $ H.div { className: "children" } (element <$> loaded)
where
element (NodeSimple { id, name, nodeType: nodeType@Corpus }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element (NodeSimple { id, name, nodeType: nodeType@Folder }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element (NodeSimple { id, name, nodeType: nodeType@FolderPrivate }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element (NodeSimple { id, name, nodeType: nodeType@FolderPublic }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element (NodeSimple { id, name, nodeType: nodeType@FolderShared }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element (NodeSimple { id, name, nodeType: NodeList}) =
renderListElement { id, name, selection }
element (NodeSimple { id, name, nodeType: nodeType@Team }) =
render { root: id, name, nodeType, selection
, session
}
render { root: id, name, nodeType, selection }
element _ = H.div {} []
type RenderListElementProps =
...
...
src/Gargantext/Components/PhyloExplorer/Frame/DocFocus.purs
View file @
a6ec0726
...
...
@@ -15,7 +15,7 @@ import Gargantext.Components.Document.Types (LoadedData, DocPath)
import Gargantext.Components.PhyloExplorer.Types (FrameDoc(..))
import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoaderEffect)
import Gargantext.
Sessions (
Session)
import Gargantext.
Hooks.Session (use
Session)
import Gargantext.Types (CTabNgramType(..), TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -27,7 +27,6 @@ here = R2.here "Gargantext.Components.PhyloExplorer.Frame.DocFocus"
type Props =
( frameDoc :: FrameDoc
, session :: Session
, closeCallback :: Unit -> Effect Unit
)
...
...
@@ -37,9 +36,9 @@ docFocus = R2.leaf docFocusCpt
docFocusCpt :: R.Component ( key :: String | Props )
docFocusCpt = here.component "main" cpt where
cpt { frameDoc: FrameDoc { docId, listId, corpusId }
, session
, closeCallback
} _ = do
session <- useSession
-- | States
-- |
state' /\ state <- R2.useBox' (Nothing :: Maybe LoadedData)
...
...
src/Gargantext/Components/PhyloExplorer/Layout.purs
View file @
a6ec0726
...
...
@@ -22,7 +22,6 @@ import Gargantext.Components.PhyloExplorer.ToolBar (toolBar)
import Gargantext.Components.PhyloExplorer.TopBar (topBar)
import Gargantext.Components.PhyloExplorer.Types (DisplayView, ExtractedCount, FrameDoc, PhyloData(..), TabView(..), Term, sortSources)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1', useUpdateEffect3')
import Gargantext.Types (SidePanelState(..))
import Gargantext.Utils (getter, (?))
...
...
@@ -79,8 +78,6 @@ layoutCpt = here.component "layout" cpt where
selectedSource' <- R2.useLive' selectedSource
frameDoc' <- R2.useLive' frameDoc
session <- useSession
-- | Hooks
-- |
let topBarPortalKey = "portal-topbar::" <> show phyloId'
...
...
@@ -272,8 +269,7 @@ layoutCpt = here.component "layout" cpt where
{ className: "phylo__focus__inner" }
[
docFocus
{ session
, frameDoc: frameDoc_
{ frameDoc: frameDoc_
, closeCallback: closeDocCallback
, key: show $ getter _.docId frameDoc_
}
...
...
src/Gargantext/Components/Router.purs
View file @
a6ec0726
...
...
@@ -215,7 +215,6 @@ mainPageCpt = here.component "mainPage" cpt where
forest :: R2.Leaf Props
forest = R2.leaf forestCpt
forestCpt :: R.Memo Props
forestCpt = R.memo' $ here.component "forest" cpt where
cpt { boxes } _ = do
...
...
src/Gargantext/Context/Progress.purs
View file @
a6ec0726
...
...
@@ -15,11 +15,12 @@ import Effect.Timer (IntervalId, clearInterval, setInterval)
import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (QueryProgressData, queryProgress)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Hooks.FirstEffect (useFirstEffect')
import Gargantext.
Sessions (
Session)
import Gargantext.
Hooks.Session (use
Session)
import Gargantext.Types (AsyncProgress, FrontendError)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Record as Record
import Record.Extra as RX
import Toestand as T
...
...
@@ -28,7 +29,6 @@ type AsyncProps =
, errors :: T.Box (Array FrontendError)
, nodeId :: GT.ID
, onFinish :: Unit -> Effect Unit
, session :: Session
)
asyncProgress :: R2.Component AsyncProps
...
...
@@ -39,6 +39,7 @@ component = R.hooksComponent "asyncProgressContext" cpt where
cpt props@{ errors
, onFinish
} children = do
session <- useSession
-- States
progress /\ progressBox <- R2.useBox' 0.0
intervalIdRef <- R.useRef (Nothing :: Maybe IntervalId)
...
...
@@ -47,7 +48,8 @@ component = R.hooksComponent "asyncProgressContext" cpt where
let
exec :: Unit -> Effect Unit
exec _ = launchAff_ do
let rdata = (RX.pick props :: Record QueryProgressData)
let rdata = (Record.merge (RX.pick props :: { asyncTask :: GT.AsyncTaskWithType
, nodeId :: GT.ID }) { session })
eAsyncProgress <- queryProgress rdata
handleRESTError errors eAsyncProgress onProgress
...
...
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