[refactor] some more hereComponent refactoring

parent ab6bd6c3
Pipeline #5561 failed with stage
in 0 seconds
...@@ -114,13 +114,13 @@ type RatingSimpleLoaderProps = ...@@ -114,13 +114,13 @@ type RatingSimpleLoaderProps =
ratingSimpleLoader :: R2.Component RatingSimpleLoaderProps ratingSimpleLoader :: R2.Component RatingSimpleLoaderProps
ratingSimpleLoader = R.createElement ratingSimpleLoaderCpt ratingSimpleLoader = R.createElement ratingSimpleLoaderCpt
ratingSimpleLoaderCpt :: R.Component RatingSimpleLoaderProps ratingSimpleLoaderCpt :: R.Component RatingSimpleLoaderProps
ratingSimpleLoaderCpt = here.component "ratingSimpleLoader" cpt where ratingSimpleLoaderCpt = R2.hereComponent here "ratingSimpleLoader" hCpt where
cpt { docId hCpt hp { docId
, corpusId , corpusId
, session , session
} _ = do } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[ratingSimpleLoader]" , herePrefix: hp
, loader: loadDocumentContext session , loader: loadDocumentContext session
, path: { docId, corpusId } , path: { docId, corpusId }
, render: \{ nc_category } -> do , render: \{ nc_category } -> do
......
...@@ -30,9 +30,8 @@ here = R2.here "Gargantext.Components.Corpus.EditionBlock" ...@@ -30,9 +30,8 @@ here = R2.here "Gargantext.Components.Corpus.EditionBlock"
editionBlock :: R2.Leaf Props editionBlock :: R2.Leaf Props
editionBlock = R2.leaf editionBlockCpt editionBlock = R2.leaf editionBlockCpt
editionBlockCpt :: R.Component Props editionBlockCpt :: R.Component Props
editionBlockCpt = here.component "main" cpt where editionBlockCpt = R2.hereComponent here "editionBlock" hCpt where
cpt { nodeId hCpt hp { nodeId } _ = do
} _ = do
-- | States -- | States
-- | -- |
session <- useSession session <- useSession
...@@ -42,7 +41,7 @@ editionBlockCpt = here.component "main" cpt where ...@@ -42,7 +41,7 @@ editionBlockCpt = here.component "main" cpt where
-- | Computed -- | Computed
-- | -- |
let let
errorHandler = logRESTError (R2.herePrefix here "[corpusLayout]") errorHandler = logRESTError hp
-- | Hooks -- | Hooks
-- | -- |
...@@ -94,7 +93,7 @@ type Props_ = ...@@ -94,7 +93,7 @@ type Props_ =
editionBlock_ :: R2.Leaf Props_ editionBlock_ :: R2.Leaf Props_
editionBlock_ = R2.leaf editionBlockCpt_ editionBlock_ = R2.leaf editionBlockCpt_
editionBlockCpt_ :: R.Component Props_ editionBlockCpt_ :: R.Component Props_
editionBlockCpt_ = here.component "main_" cpt where editionBlockCpt_ = here.component "editionBlock_" cpt where
cpt { nodeId cpt { nodeId
, hyperdata , hyperdata
} _ = do } _ = do
......
...@@ -36,7 +36,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT ...@@ -36,7 +36,7 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext) import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Table as TT import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends, url) import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..)) import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
...@@ -121,8 +121,8 @@ type Props = ( ...@@ -121,8 +121,8 @@ type Props = (
docView :: R2.Component Props docView :: R2.Component Props
docView = R.createElement docViewCpt docView = R.createElement docViewCpt
docViewCpt :: R.Component Props docViewCpt :: R.Component Props
docViewCpt = here.component "docView" cpt where docViewCpt = R2.hereComponent here "docView" hCpt where
cpt { layout: { cacheState hCpt hp { layout: { cacheState
, chart , chart
, chartReload , chartReload
, frontends , frontends
...@@ -155,7 +155,7 @@ docViewCpt = here.component "docView" cpt where ...@@ -155,7 +155,7 @@ docViewCpt = here.component "docView" cpt where
-- @onCreateDocumentEnd <AsyncProgress> -- @onCreateDocumentEnd <AsyncProgress>
onCreateDocumentEnd <- pure $ \asyncProgress -> do onCreateDocumentEnd <- pure $ \asyncProgress -> do
here.log2 "[DocsTables] NodeDocument task:" asyncProgress R2.hpLog2 hp "NodeDocument task:" asyncProgress
T.write_ false onDocumentCreationPendingBox T.write_ false onDocumentCreationPendingBox
toggleModal unit toggleModal unit
...@@ -171,7 +171,7 @@ docViewCpt = here.component "docView" cpt where ...@@ -171,7 +171,7 @@ docViewCpt = here.component "docView" cpt where
eTask <- DFC.create session nodeId fdata eTask <- DFC.create session nodeId fdata
handleRESTError (R2.herePrefix here "[docView]") errors eTask handleRESTError hp errors eTask
\t -> liftEffect $ launchDocumentCreationProgress \t -> liftEffect $ launchDocumentCreationProgress
errors errors
session session
...@@ -390,8 +390,8 @@ filterDocsByYear year docs = A.filter filterFunc docs ...@@ -390,8 +390,8 @@ filterDocsByYear year docs = A.filter filterFunc docs
pageLayout :: R2.Component ( key :: String | PageLayoutProps ) pageLayout :: R2.Component ( key :: String | PageLayoutProps )
pageLayout = R.createElement pageLayoutCpt pageLayout = R.createElement pageLayoutCpt
pageLayoutCpt :: R.Component ( key :: String | PageLayoutProps ) pageLayoutCpt :: R.Component ( key :: String | PageLayoutProps )
pageLayoutCpt = here.component "pageLayout" cpt where pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
cpt props@{ cacheState hCpt hp props@{ cacheState
, listId , listId
, mCorpusId , mCorpusId
, nodeId , nodeId
...@@ -459,7 +459,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where ...@@ -459,7 +459,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where
, localCategories , localCategories
, params: paramsS } [] , params: paramsS } []
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]" , herePrefix: hp
, path: path { params = paramsS' } , path: path { params = paramsS' }
, loader , loader
, render } , render }
......
...@@ -26,7 +26,6 @@ import Gargantext.Components.Document.Types (DocPath, Document(..), LoadedData, ...@@ -26,7 +26,6 @@ import Gargantext.Components.Document.Types (DocPath, Document(..), LoadedData,
import Gargantext.Components.GraphQL.Endpoints (getContextNgrams) import Gargantext.Components.GraphQL.Endpoints (getContextNgrams)
import Gargantext.Components.NgramsTable.AutoSync (useAutoSync) import Gargantext.Components.NgramsTable.AutoSync (useAutoSync)
import Gargantext.Components.Node (NodePoly(..)) import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (logRESTError)
import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache) import Gargantext.Core.NgramsTable.Functions (addNewNgramA, applyNgramsPatches, coreDispatch, findNgramRoot, setTermListA, computeCache)
import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm, State, Versioned(..), replace) import Gargantext.Core.NgramsTable.Types (CoreAction(..), NgramsTable(..), NgramsTerm, State, Versioned(..), replace)
import Gargantext.Hooks.FirstEffect (useFirstEffect') import Gargantext.Hooks.FirstEffect (useFirstEffect')
...@@ -66,15 +65,15 @@ options = ...@@ -66,15 +65,15 @@ options =
layout :: forall r. R2.OptLeaf Options Props r layout :: forall r. R2.OptLeaf Options Props r
layout = R2.optLeaf layoutCpt options layout = R2.optLeaf layoutCpt options
layoutCpt :: R.Component Props layoutCpt :: R.Component Props
layoutCpt = here.component "layout" cpt where layoutCpt = R2.hereComponent here "layout" hCpt where
cpt props@{ path: path@{ listIds hCpt hp props@{ path: path@{ listIds
, nodeId } , nodeId }
, session } _ = do , session } _ = do
case A.head listIds of case A.head listIds of
Nothing -> pure $ H.div {} [ H.text "No list supplied!" ] Nothing -> pure $ H.div {} [ H.text "No list supplied!" ]
Just listId -> Just listId ->
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[layout]" , herePrefix: hp
, loader: \p -> getContextNgrams session p.contextId p.listId , loader: \p -> getContextNgrams session p.contextId p.listId
, path: { contextId: nodeId, listId } , path: { contextId: nodeId, listId }
, render: \contextNgrams -> , render: \contextNgrams ->
......
...@@ -343,13 +343,12 @@ type PageProps = ( rowsLoaded :: Rows | PageLayoutProps ) ...@@ -343,13 +343,12 @@ type PageProps = ( rowsLoaded :: Rows | PageLayoutProps )
pageLayout :: R2.Component PageLayoutProps pageLayout :: R2.Component PageLayoutProps
pageLayout = R.createElement pageLayoutCpt pageLayout = R.createElement pageLayoutCpt
pageLayoutCpt :: R.Component PageLayoutProps pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = here.component "pageLayout" cpt pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
where hCpt hp { container, deletions, frontends, path, session, totalRecords } _ = do
cpt { container, deletions, frontends, path, session, totalRecords } _ = do
path' <- T.useLive T.unequal path path' <- T.useLive T.unequal path
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]" , herePrefix: hp
, loader: loadPage , loader: loadPage
, path: path' , path: path'
, render: \rowsLoaded -> page { container, deletions, frontends, path, rowsLoaded, session, totalRecords } [] } , render: \rowsLoaded -> page { container, deletions, frontends, path, rowsLoaded, session, totalRecords } [] }
......
...@@ -30,7 +30,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(.. ...@@ -30,7 +30,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..
import Gargantext.Components.GraphQL.Endpoints (getNode, getTreeFirstLevel) import Gargantext.Components.GraphQL.Endpoints (getNode, getTreeFirstLevel)
import Gargantext.Components.GraphQL.Node (Node) import Gargantext.Components.GraphQL.Node (Node)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, TreeNode) import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, TreeNode)
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
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)
...@@ -57,12 +57,12 @@ data FolderStyle = FolderUp | FolderChild ...@@ -57,12 +57,12 @@ data FolderStyle = FolderUp | FolderChild
folderView :: R2.Leaf Props folderView :: R2.Leaf Props
folderView = R2.leaf folderViewCpt folderView = R2.leaf folderViewCpt
folderViewCpt :: R.Component Props folderViewCpt :: R.Component Props
folderViewCpt = here.component "folderViewCpt" cpt where folderViewCpt = R2.hereComponent here "folderViewCpt" hCpt where
cpt { nodeId, session } _ = do hCpt hp { nodeId, session } _ = do
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[folderView]" , herePrefix: hp
, loader: loadFolders , loader: loadFolders
, path: { nodeId, session, reload: reload'} , path: { nodeId, session, reload: reload'}
, render: \folders -> folderViewMain { folders , render: \folders -> folderViewMain { folders
...@@ -264,12 +264,12 @@ backButtonCpt = here.component "backButton" cpt where ...@@ -264,12 +264,12 @@ backButtonCpt = here.component "backButton" cpt where
backButtonSmart :: R2.Component (nodeId :: Int, session :: Session) backButtonSmart :: R2.Component (nodeId :: Int, session :: Session)
backButtonSmart = R.createElement backButtonSmartCpt backButtonSmart = R.createElement backButtonSmartCpt
backButtonSmartCpt :: R.Component (nodeId :: Int, session :: Session) backButtonSmartCpt :: R.Component (nodeId :: Int, session :: Session)
backButtonSmartCpt = here.component "backButtonSmart" cpt where backButtonSmartCpt = R2.hereComponent here "backButtonSmart" hCpt where
cpt {nodeId, session} _ = do hCpt hp { nodeId, session } _ = do
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[backButtonSmart]" , herePrefix: hp
, loader: loadNode , loader: loadNode
, path: { nodeId, session, reload: reload' } , path: { nodeId, session, reload: reload' }
, render: \node -> backButtonSmartMain { node, session } [] , render: \node -> backButtonSmartMain { node, session } []
......
...@@ -37,7 +37,7 @@ import URI.Fragment as Fragment ...@@ -37,7 +37,7 @@ import URI.Fragment as Fragment
import Effect (Effect) import Effect (Effect)
import Effect.Console (log) import Effect.Console (log)
import Toestand as T import Toestand as T
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Utils.Toestand as T2 import Gargantext.Utils.Toestand as T2
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
...@@ -165,15 +165,15 @@ componentCpt = here.component "breadcrumb" cpt where ...@@ -165,15 +165,15 @@ componentCpt = here.component "breadcrumb" cpt where
breadcrumbView :: R2.Leaf Props breadcrumbView :: R2.Leaf Props
breadcrumbView = R2.leaf breadcrumbViewCpt breadcrumbView = R2.leaf breadcrumbViewCpt
breadcrumbViewCpt :: R.Component Props breadcrumbViewCpt :: R.Component Props
breadcrumbViewCpt = here.component "breadcrumbViewCpt" cpt where breadcrumbViewCpt = R2.hereComponent here "breadcrumbViewCpt" hCpt where
cpt { nodeId, session } _ = do hCpt hp { nodeId, session } _ = do
let session' = session let session' = session
case session' of case session' of
Nothing -> pure $ H.div {} [] Nothing -> pure $ H.div {} []
Just (session') -> do Just (session') -> do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[breadcrumbView]" , herePrefix: hp
, loader: loadBreadcrumbData , loader: loadBreadcrumbData
, path: { nodeId: nodeId , path: { nodeId: nodeId
, session: session' , session: session'
......
...@@ -110,11 +110,11 @@ treeLoader :: R2.Leaf ( key :: String | LoaderProps ) ...@@ -110,11 +110,11 @@ 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 = R2.hereComponent here "treeLoader" hCpt where
-- treeLoaderCpt :: R.Memo LoaderProps -- treeLoaderCpt :: R.Memo LoaderProps
-- treeLoaderCpt = R.memo (here.component "treeLoader" cpt) memoCmp where -- treeLoaderCpt = R.memo (here.component "treeLoader" cpt) memoCmp where
-- memoCmp ({ root: t1 }) ({ root: t2 }) = t1 == t2 -- memoCmp ({ root: t1 }) ({ root: t2 }) = t1 == t2
cpt p@{ root, session } _ = do hCpt hp p@{ root, session } _ = do
-- States -- States
-- app <- T.useLive T.unequal p.reloadRoot -- app <- T.useLive T.unequal p.reloadRoot
state /\ stateBox <- R2.useBox' Nothing state /\ stateBox <- R2.useBox' Nothing
...@@ -144,7 +144,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where ...@@ -144,7 +144,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where
props = Record.merge common extra where props = Record.merge common extra where
common = RecordE.pick p :: Record Common common = RecordE.pick p :: Record Common
extra = { reloadTree: p.reload, root, session, tree: tree' } extra = { reloadTree: p.reload, root, session, tree: tree' }
errorHandler = logRESTError (R2.herePrefix here "[treeLoader]") errorHandler = logRESTError hp
getNodeTree :: Session -> ID -> AffRESTError FTree getNodeTree :: Session -> ID -> AffRESTError FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) "" getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
...@@ -255,8 +255,8 @@ renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where ...@@ -255,8 +255,8 @@ renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
childLoader :: R2.Component ChildLoaderProps childLoader :: R2.Component ChildLoaderProps
childLoader = R.createElement childLoaderCpt childLoader = R.createElement childLoaderCpt
childLoaderCpt :: R.Component ChildLoaderProps childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt = here.component "childLoader" cpt where childLoaderCpt = R2.hereComponent here "childLoader" hCpt where
cpt p@{ reloadTree hCpt hp p@{ reloadTree
, render , render
, root } _ = do , root } _ = do
-- States -- States
...@@ -287,7 +287,7 @@ childLoaderCpt = here.component "childLoader" cpt where ...@@ -287,7 +287,7 @@ childLoaderCpt = here.component "childLoader" cpt where
} }
where where
errorHandler = logRESTError (R2.herePrefix here "[childLoader]") errorHandler = logRESTError hp
fetch _ = getNodeTreeFirstLevel p.session p.id 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 }
......
...@@ -30,7 +30,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools.Sync (nodeActionsGraph, node ...@@ -30,7 +30,6 @@ import Gargantext.Components.Forest.Tree.Node.Tools.Sync (nodeActionsGraph, node
import Gargantext.Components.GraphExplorer.API as GraphAPI import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.Lang (Lang(EN)) import Gargantext.Components.Lang (Lang(EN))
import Gargantext.Components.Nodes.Corpus.Types (CorpusData) import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
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 (useLoader, useLoaderEffect) import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
...@@ -604,12 +603,12 @@ nodeActionsCpt = here.component "nodeActions" cpt where ...@@ -604,12 +603,12 @@ nodeActionsCpt = here.component "nodeActions" cpt where
graphNodeActions :: R2.Leaf NodeActionsCommon graphNodeActions :: R2.Leaf NodeActionsCommon
graphNodeActions = R2.leaf graphNodeActionsCpt graphNodeActions = R2.leaf graphNodeActionsCpt
graphNodeActionsCpt :: R.Component NodeActionsCommon graphNodeActionsCpt :: R.Component NodeActionsCommon
graphNodeActionsCpt = here.component "graphNodeActions" cpt where graphNodeActionsCpt = R2.hereComponent here "graphNodeActions" hCpt where
cpt { id, refresh, session } _ = do hCpt hp { id, refresh, session } _ = do
-- Hooks -- Hooks
useLoader useLoader
{ errorHandler: Nothing { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[graphNodeActions]" , herePrefix: hp
, loader: graphVersions session , loader: graphVersions session
, path: id , path: id
, render: \gv -> graphNodeActionsLoaded { gv, id, refresh, session } , render: \gv -> graphNodeActionsLoaded { gv, id, refresh, session }
...@@ -636,12 +635,12 @@ graphNodeActionsLoadedCpt = here.component "graphNodeActionsLoaded" cpt where ...@@ -636,12 +635,12 @@ graphNodeActionsLoadedCpt = here.component "graphNodeActionsLoaded" cpt where
listNodeActions :: R2.Leaf NodeActionsCommon listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions = R2.leaf listNodeActionsCpt listNodeActions = R2.leaf listNodeActionsCpt
listNodeActionsCpt :: R.Component NodeActionsCommon listNodeActionsCpt :: R.Component NodeActionsCommon
listNodeActionsCpt = here.component "listNodeActions" cpt where listNodeActionsCpt = R2.hereComponent here "listNodeActions" hCpt where
cpt { id, refresh, session } _ = do hCpt hp { id, refresh, session } _ = do
-- Hooks -- Hooks
useLoader useLoader
{ errorHandler: Nothing { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listNodeActions]" , herePrefix: hp
, loader: loadCorpusWithChild , loader: loadCorpusWithChild
, path: { nodeId: id, session } , path: { nodeId: id, session }
, render: \corpusData -> listNodeActionsLoaded { corpusData, id, refresh, session } , render: \corpusData -> listNodeActionsLoaded { corpusData, id, refresh, session }
......
...@@ -31,10 +31,10 @@ type ActionManageTeam = ( ...@@ -31,10 +31,10 @@ type ActionManageTeam = (
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 = R2.hereComponent here "actionManageTeam" hCpt where
cpt { id, session } _ = do hCpt hp { id, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionManageTeam]" , herePrefix: hp
, loader: loadTeam , loader: loadTeam
, path: { nodeId: id, session } , path: { nodeId: id, session }
, render: \team -> teamLayoutWrapper { team , render: \team -> teamLayoutWrapper { team
......
...@@ -37,11 +37,11 @@ type Props = ...@@ -37,11 +37,11 @@ type Props =
actionSearch :: R2.Component Props actionSearch :: R2.Component Props
actionSearch = R.createElement actionSearchCpt actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt where actionSearchCpt = R2.hereComponent here "actionSearch" hCpt where
cpt props@({ session }) _ = do hCpt hp props@({ session }) _ = do
{ errors } <- Store.use { errors } <- Store.use
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionSearch]" , herePrefix: hp
, loader: loadLanguages , loader: loadLanguages
, path: { session } , path: { session }
, render: \langs -> , render: \langs ->
......
...@@ -128,10 +128,10 @@ type ComponentIMTProps = ...@@ -128,10 +128,10 @@ type ComponentIMTProps =
componentIMT :: R2.Component ComponentIMTProps componentIMT :: R2.Component ComponentIMTProps
componentIMT = R.createElement componentIMTCpt componentIMT = R.createElement componentIMTCpt
componentIMTCpt :: R.Component ComponentIMTProps componentIMTCpt :: R.Component ComponentIMTProps
componentIMTCpt = here.component "componentIMT" cpt where componentIMTCpt = R2.hereComponent here "componentIMT" hCpt where
cpt { search, session } _ = do hCpt hp { search, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[componentIMT]" , herePrefix: hp
, loader: \_ -> getIMTSchools session , loader: \_ -> getIMTSchools session
, path: unit , path: unit
, render: \schools -> componentWithIMTOrgs { schools, search } [] } , render: \schools -> componentWithIMTOrgs { schools, search } [] }
...@@ -392,10 +392,10 @@ type PubmedInputProps = ( ...@@ -392,10 +392,10 @@ type PubmedInputProps = (
pubmedInput :: R2.Component PubmedInputProps pubmedInput :: R2.Component PubmedInputProps
pubmedInput = R.createElement pubmedInputCpt pubmedInput = R.createElement pubmedInputCpt
pubmedInputCpt :: R.Component PubmedInputProps pubmedInputCpt :: R.Component PubmedInputProps
pubmedInputCpt = here.component "pubmedInput" cpt where pubmedInputCpt = R2.hereComponent here "pubmedInput" hCpt where
cpt { search, session: session@(Session { treeId }) } _ = do hCpt hp { search, session: session@(Session { treeId }) } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pubmedInput]" , herePrefix: hp
, loader: \_ -> getUser session treeId , loader: \_ -> getUser session treeId
, path: unit , path: unit
, render: \user -> pubmedInputLoaded { pubmedAPIKey: user.u_hyperdata.pubmed_api_key , render: \user -> pubmedInputLoaded { pubmedAPIKey: user.u_hyperdata.pubmed_api_key
...@@ -444,10 +444,10 @@ type EPOInputProps = ( ...@@ -444,10 +444,10 @@ type EPOInputProps = (
epoInput :: R2.Component EPOInputProps epoInput :: R2.Component EPOInputProps
epoInput = R.createElement epoInputCpt epoInput = R.createElement epoInputCpt
epoInputCpt :: R.Component EPOInputProps epoInputCpt :: R.Component EPOInputProps
epoInputCpt = here.component "epoInput" cpt where epoInputCpt = R2.hereComponent here "epoInput" hCpt where
cpt { search, session: session@(Session { treeId }) } _ = do hCpt hp { search, session: session@(Session { treeId }) } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[epoInput]" , herePrefix: hp
, loader: \_ -> getUser session treeId , loader: \_ -> getUser session treeId
, path: unit , path: unit
, render: \user -> epoInputLoaded { epoAPIUser: user.u_hyperdata.epo_api_user , render: \user -> epoInputLoaded { epoAPIUser: user.u_hyperdata.epo_api_user
......
...@@ -65,11 +65,10 @@ type ShareNode = ...@@ -65,11 +65,10 @@ type ShareNode =
shareNode :: R2.Component ShareNode shareNode :: R2.Component ShareNode
shareNode = R.createElement shareNodeCpt shareNode = R.createElement shareNodeCpt
shareNodeCpt :: R.Component ShareNode shareNodeCpt :: R.Component ShareNode
shareNodeCpt = here.component "shareNode" cpt shareNodeCpt = R2.hereComponent here "shareNode" hCpt where
where hCpt hp { id, session } _ = do
cpt { id, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[shareNode]" , herePrefix: hp
, loader: getCompletionsReq , loader: getCompletionsReq
, path: { session } , path: { session }
, render: \completions -> shareNodeInner { completions, id, session } [] , render: \completions -> shareNodeInner { completions, id, session } []
......
...@@ -106,10 +106,10 @@ type UploadFile = ...@@ -106,10 +106,10 @@ type UploadFile =
uploadFileView :: R2.Leaf Props uploadFileView :: R2.Leaf Props
uploadFileView = R2.leaf uploadFileViewCpt uploadFileView = R2.leaf uploadFileViewCpt
uploadFileViewCpt :: R.Component Props uploadFileViewCpt :: R.Component Props
uploadFileViewCpt = here.component "uploadFileView" cpt where uploadFileViewCpt = R2.hereComponent here "uploadFileView" hCpt where
cpt props@({ session }) _ = do hCpt hp props@({ session }) _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[uploadFileView]" , herePrefix: hp
, loader: loadLanguages , loader: loadLanguages
, path: { session } , path: { session }
, render: \langs -> , render: \langs ->
...@@ -731,10 +731,10 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt ...@@ -731,10 +731,10 @@ uploadTermButtonCpt = here.component "uploadTermButton" cpt
uploadFrameCalcView :: R2.Component Props uploadFrameCalcView :: R2.Component Props
uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt uploadFrameCalcView = R.createElement uploadFrameCalcViewCpt
uploadFrameCalcViewCpt :: R.Component Props uploadFrameCalcViewCpt :: R.Component Props
uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt where uploadFrameCalcViewCpt = R2.hereComponent here "uploadFrameCalcView" hCpt where
cpt props@({ session }) _ = do hCpt hp props@({ session }) _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[uploadFrameCalcView]" , herePrefix: hp
, loader: loadLanguages , loader: loadLanguages
, path: { session } , path: { session }
, render: \langs -> , render: \langs ->
......
...@@ -39,11 +39,11 @@ type ActionWriteNodesDocuments = ...@@ -39,11 +39,11 @@ type ActionWriteNodesDocuments =
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 = R2.hereComponent here "actionWriteNodesDocuments" hCpt where
cpt props@({ session }) _ = do hCpt hp props@({ session }) _ = do
{ errors } <- Store.use { errors } <- Store.use
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[actionWriteNodesDocuments]" , herePrefix: hp
, loader: loadLanguages , loader: loadLanguages
, path: { session } , path: { session }
, render: \langs -> , render: \langs ->
......
...@@ -39,9 +39,8 @@ type Props = ( ...@@ -39,9 +39,8 @@ type Props = (
asyncProgressBar :: R2.Component Props asyncProgressBar :: R2.Component Props
asyncProgressBar = R.createElement asyncProgressBarCpt asyncProgressBar = R.createElement asyncProgressBarCpt
asyncProgressBarCpt :: R.Component Props asyncProgressBarCpt :: R.Component Props
asyncProgressBarCpt = here.component "asyncProgressBar" cpt asyncProgressBarCpt = R2.hereComponent here "asyncProgressBar" hCpt where
where hCpt hp props@{ asyncTask: (GT.AsyncTaskWithType {task: GT.AsyncTask {id}})
cpt props@{ asyncTask: (GT.AsyncTaskWithType {task: GT.AsyncTask {id}})
, barType , barType
, onFinish , onFinish
} _ = do } _ = do
...@@ -55,7 +54,7 @@ asyncProgressBarCpt = here.component "asyncProgressBar" cpt ...@@ -55,7 +54,7 @@ asyncProgressBarCpt = here.component "asyncProgressBar" cpt
launchAff_ $ do launchAff_ $ do
let rdata = (RX.pick props :: Record QueryProgressData) let rdata = (RX.pick props :: Record QueryProgressData)
eAsyncProgress <- queryProgress rdata eAsyncProgress <- queryProgress rdata
handleRESTError (R2.herePrefix here "[asyncProgressBar]") errors eAsyncProgress $ handleRESTError hp errors eAsyncProgress $
\asyncProgress -> liftEffect $ do \asyncProgress -> liftEffect $ do
let GT.AsyncProgress { status } = asyncProgress let GT.AsyncProgress { status } = asyncProgress
T.write_ (min 100.0 $ GT.progressPercent asyncProgress) progress T.write_ (min 100.0 $ GT.progressPercent asyncProgress) progress
......
...@@ -41,9 +41,8 @@ type SubTreeParamsProps = ...@@ -41,9 +41,8 @@ type SubTreeParamsProps =
subTreeView :: R2.Component SubTreeParamsProps subTreeView :: R2.Component SubTreeParamsProps
subTreeView = R.createElement $ R.memo' subTreeViewCpt subTreeView = R.createElement $ R.memo' subTreeViewCpt
subTreeViewCpt :: R.Component SubTreeParamsProps subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = here.component "subTreeView" cpt subTreeViewCpt = R2.hereComponent here "subTreeView" hCpt where
where hCpt hp { action
cpt { action
, dispatch , dispatch
, id , id
, nodeType , nodeType
...@@ -56,7 +55,7 @@ subTreeViewCpt = here.component "subTreeView" cpt ...@@ -56,7 +55,7 @@ subTreeViewCpt = here.component "subTreeView" cpt
-- _ <- pure $ setAction (const $ setTreeOut valAction Nothing) -- _ <- pure $ setAction (const $ setTreeOut valAction Nothing)
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[subTreeView]" , herePrefix: hp
, loader: loadSubTree showtypes , loader: loadSubTree showtypes
, path: session , path: session
, render: \tree -> , render: \tree ->
......
...@@ -17,10 +17,10 @@ type ForgotPasswordProps = ( server :: String, uuid :: String ) ...@@ -17,10 +17,10 @@ type ForgotPasswordProps = ( server :: String, uuid :: String )
forgotPasswordLayout :: R2.Component ForgotPasswordProps forgotPasswordLayout :: R2.Component ForgotPasswordProps
forgotPasswordLayout = R.createElement forgotPasswordLayoutCpt forgotPasswordLayout = R.createElement forgotPasswordLayoutCpt
forgotPasswordLayoutCpt :: R.Component ForgotPasswordProps forgotPasswordLayoutCpt :: R.Component ForgotPasswordProps
forgotPasswordLayoutCpt = here.component "forgotPasswordLayout" cpt where forgotPasswordLayoutCpt = R2.hereComponent here "forgotPasswordLayout" hCpt where
cpt { server, uuid } _ = do hCpt hp { server, uuid } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[forgotPasswordLayout]" , herePrefix: hp
, loader: loadPassword , loader: loadPassword
, path: { server, uuid } , path: { server, uuid }
, render: \{ password } -> , render: \{ password } ->
......
...@@ -36,8 +36,8 @@ type Props = ...@@ -36,8 +36,8 @@ type Props =
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 = R2.hereComponent here "main" hCpt where
cpt { graphSideDoc: GraphSideDoc { docId, listId, corpusId } hCpt hp { graphSideDoc: GraphSideDoc { docId, listId, corpusId }
, session , session
, closeCallback , closeCallback
} _ = do } _ = do
...@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where ...@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where
-- | Hooks -- | Hooks
-- | -- |
useLoaderEffect useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[docFocus]") { errorHandler: logRESTError hp
, loader: loadData , loader: loadData
, path , path
, state , state
......
...@@ -20,7 +20,7 @@ import Gargantext.Components.GraphQL.Team (Team, teamQuery) ...@@ -20,7 +20,7 @@ import Gargantext.Components.GraphQL.Team (Team, teamQuery)
import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery) import Gargantext.Components.GraphQL.Tree (TreeFirstLevel, treeFirstLevelQuery, BreadcrumbInfo, breadcrumbQuery)
import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery) import Gargantext.Components.GraphQL.User (UserInfo, userInfoQuery, User, userQuery)
import Gargantext.Components.Lang (Lang) import Gargantext.Components.Lang (Lang)
import Gargantext.Config.REST (RESTError(..), AffRESTError, logRESTError) import Gargantext.Config.REST (RESTError(..), AffRESTError)
import Gargantext.Core.NgramsTable.Types (NgramsTerm(..)) import Gargantext.Core.NgramsTable.Types (NgramsTerm(..))
import Gargantext.Sessions (Session(..)) import Gargantext.Sessions (Session(..))
import Gargantext.Types (CorpusId, NodeType) import Gargantext.Types (CorpusId, NodeType)
......
...@@ -114,8 +114,7 @@ type LangSwitcherProps = ( ...@@ -114,8 +114,7 @@ type LangSwitcherProps = (
langSwitcher :: R2.Component LangSwitcherProps langSwitcher :: R2.Component LangSwitcherProps
langSwitcher = R.createElement langSwitcherCpt langSwitcher = R.createElement langSwitcherCpt
langSwitcherCpt :: R.Component LangSwitcherProps langSwitcherCpt :: R.Component LangSwitcherProps
langSwitcherCpt = here.component "langSwitcher" cpt langSwitcherCpt = here.component "langSwitcher" cpt where
where
cpt { lang, langs} _ = do cpt { lang, langs} _ = do
currentLang <- T.useLive T.unequal lang currentLang <- T.useLive T.unequal lang
let option l = H.option { value: show l} [ H.text $ show l] let option l = H.option { value: show l} [ H.text $ show l]
......
...@@ -117,10 +117,10 @@ type ListTreeChildrenProps = ...@@ -117,10 +117,10 @@ type ListTreeChildrenProps =
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 = R2.hereComponent here "listTreeChildren" hCpt where
cpt { render, root, selection, session } _ = do hCpt hp { render, root, selection, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listTreeChildren]" , herePrefix: hp
, loader: loadTreeChildren , loader: loadTreeChildren
, path: { root, session } , path: { root, session }
, render: \loaded -> , render: \loaded ->
......
...@@ -17,10 +17,8 @@ type Props = ...@@ -17,10 +17,8 @@ type Props =
loadingSpinner :: Record Props -> R.Element loadingSpinner :: Record Props -> R.Element
loadingSpinner props = R.createElement loadingSpinnerCpt props [] loadingSpinner props = R.createElement loadingSpinnerCpt props []
loadingSpinnerCpt :: R.Component Props loadingSpinnerCpt :: R.Component Props
loadingSpinnerCpt = here.component "LoadingSpinner" cpt loadingSpinnerCpt = here.component "LoadingSpinner" cpt where
where
-- cpt _ _ = H.i {className: "spinner fa fa-smile-o fa-spin fa-3x fa-fw"} [H.text ""] -- cpt _ _ = H.i {className: "spinner fa fa-smile-o fa-spin fa-3x fa-fw"} [H.text ""]
-- cpt _ _ = H.i {className: "fa fa-globe fa-spin fa-3x fa-fw"} [H.text ""] -- cpt _ _ = H.i {className: "fa fa-globe fa-spin fa-3x fa-fw"} [H.text ""]
......
...@@ -23,11 +23,9 @@ type Props = ( setVisible :: R.Setter Boolean ) ...@@ -23,11 +23,9 @@ type Props = ( setVisible :: R.Setter Boolean )
modal :: R2.Component Props modal :: R2.Component Props
modal = R.createElement modalCpt modal = R.createElement modalCpt
modalCpt :: R.Component Props modalCpt :: R.Component Props
modalCpt = here.component "modal" cpt modalCpt = R2.hereComponent here "modal" hCpt where
where hCpt _hp {setVisible} children = do
cpt {setVisible} children = do
host <- R2.getPortalHost host <- R2.getPortalHost
root <- R.useRef null -- used to close when user clicks outside root <- R.useRef null -- used to close when user clicks outside
R2.useLayoutEffectOnce $ modalEffect root setVisible R2.useLayoutEffectOnce $ modalEffect root setVisible
......
...@@ -1021,8 +1021,8 @@ type MainNgramsTableCacheProps = ...@@ -1021,8 +1021,8 @@ type MainNgramsTableCacheProps =
mainNgramsTableCacheOn :: R2.Leaf MainNgramsTableCacheProps mainNgramsTableCacheOn :: R2.Leaf MainNgramsTableCacheProps
mainNgramsTableCacheOn = R2.leaf mainNgramsTableCacheOnCpt mainNgramsTableCacheOn = R2.leaf mainNgramsTableCacheOnCpt
mainNgramsTableCacheOnCpt :: R.Component MainNgramsTableCacheProps mainNgramsTableCacheOnCpt :: R.Component MainNgramsTableCacheProps
mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where mainNgramsTableCacheOnCpt = R2.hereComponent here "mainNgramsTableCacheOn" hCpt where
cpt { afterSync hCpt hp { afterSync
, defaultListId , defaultListId
, path , path
, session , session
...@@ -1052,8 +1052,9 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1052,8 +1052,9 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, renderer: render , renderer: render
, spinnerClass: Nothing , spinnerClass: Nothing
} }
where
errorHandler = logRESTError hp
versionEndpoint { defaultListId, path: { nodeId, tabType, session } } _ = get session $ Routes.GetNgramsTableVersion { listId: defaultListId, tabType } (Just nodeId) versionEndpoint { defaultListId, path: { nodeId, tabType, session } } _ = get session $ Routes.GetNgramsTableVersion { listId: defaultListId, tabType } (Just nodeId)
errorHandler = logRESTError (R2.herePrefix here "[mainNgramsTableCacheOn]")
mkRequest :: PageParams -> GUC.Request mkRequest :: PageParams -> GUC.Request
mkRequest path@{ session } = GUC.makeGetRequest session $ url path mkRequest path@{ session } = GUC.makeGetRequest session $ url path
where where
...@@ -1068,8 +1069,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where ...@@ -1068,8 +1069,8 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
mainNgramsTableCacheOff :: R2.Leaf MainNgramsTableCacheProps mainNgramsTableCacheOff :: R2.Leaf MainNgramsTableCacheProps
mainNgramsTableCacheOff = R2.leaf mainNgramsTableCacheOffCpt mainNgramsTableCacheOff = R2.leaf mainNgramsTableCacheOffCpt
mainNgramsTableCacheOffCpt :: R.Component MainNgramsTableCacheProps mainNgramsTableCacheOffCpt :: R.Component MainNgramsTableCacheProps
mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where mainNgramsTableCacheOffCpt = R2.hereComponent here "mainNgramsTableCacheOff" hCpt where
cpt { afterSync hCpt hp { afterSync
, path , path
, session , session
, state , state
...@@ -1086,7 +1087,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where ...@@ -1086,7 +1087,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
, versionedWithCount , versionedWithCount
, withAutoUpdate } [] , withAutoUpdate } []
useLoaderBox { errorHandler: Nothing useLoaderBox { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[mainNgramsTableCacheOff]" , herePrefix: hp
, loader , loader
, path , path
, render } , render }
......
...@@ -70,13 +70,13 @@ type KeyLayoutProps = ...@@ -70,13 +70,13 @@ type KeyLayoutProps =
annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps annuaireLayoutWithKey :: R2.Leaf KeyLayoutProps
annuaireLayoutWithKey = R2.leaf annuaireLayoutWithKeyCpt annuaireLayoutWithKey = R2.leaf annuaireLayoutWithKeyCpt
annuaireLayoutWithKeyCpt :: R.Component KeyLayoutProps annuaireLayoutWithKeyCpt :: R.Component KeyLayoutProps
annuaireLayoutWithKeyCpt = here.component "annuaireLayoutWithKey" cpt where annuaireLayoutWithKeyCpt = R2.hereComponent here "annuaireLayoutWithKey" hCpt where
cpt { frontends, nodeId, session } _ = do hCpt hp { frontends, nodeId, session } _ = do
path <- T.useBox nodeId path <- T.useBox nodeId
path' <- T.useLive T.unequal path path' <- T.useLive T.unequal path
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[annuaireLayoutWithKey]" , herePrefix: hp
, loader: getAnnuaireInfo session , loader: getAnnuaireInfo session
, path: path' , path: path'
, render: \info -> annuaire { frontends, info, path, session } } , render: \info -> annuaire { frontends, info, path, session } }
...@@ -135,13 +135,12 @@ type PageLayoutProps = ...@@ -135,13 +135,12 @@ type PageLayoutProps =
pageLayout :: Record PageLayoutProps -> R.Element pageLayout :: Record PageLayoutProps -> R.Element
pageLayout props = R.createElement pageLayoutCpt props [] pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Component PageLayoutProps pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = here.component "pageLayout" cpt pageLayoutCpt = R2.hereComponent here "pageLayout" hCpt where
where hCpt hp { frontends, pagePath, session } _ = do
cpt { frontends, pagePath, session } _ = do
pagePath' <- T.useLive T.unequal pagePath pagePath' <- T.useLive T.unequal pagePath
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pageLayout]" , herePrefix: hp
, loader: loadPage session , loader: loadPage session
, path: pagePath' , path: pagePath'
, render: \table -> page { session, table, frontends, pagePath } } , render: \table -> page { session, table, frontends, pagePath } }
......
...@@ -21,7 +21,7 @@ import Gargantext.Components.InputWithEnter (inputWithEnter) ...@@ -21,7 +21,7 @@ import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser) import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Lists.Types as LT import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.Utils (handleRESTError) import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
...@@ -92,8 +92,9 @@ userLayoutCpt = here.component "userLayout" cpt ...@@ -92,8 +92,9 @@ userLayoutCpt = here.component "userLayout" cpt
userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps ) userLayoutWithKey :: R2.Leaf ( key :: String | LayoutProps )
userLayoutWithKey = R2.leaf userLayoutWithKeyCpt userLayoutWithKey = R2.leaf userLayoutWithKeyCpt
userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps ) userLayoutWithKeyCpt :: R.Component ( key :: String | LayoutProps )
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where -- userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cpt { frontends userLayoutWithKeyCpt = R2.hereComponent here "userLayoutWithKey" hCpt where
hCpt hp { frontends
, nodeId , nodeId
, session } _ = do , session } _ = do
{ errors, sidePanelLists, sidePanelTexts } <- AppStore.use { errors, sidePanelLists, sidePanelTexts } <- AppStore.use
...@@ -105,7 +106,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where ...@@ -105,7 +106,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cacheState <- T.useBox LT.CacheOn cacheState <- T.useBox LT.CacheOn
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[userLayoutWithKey]" , herePrefix: hp
, loader: getUserInfoWithReload , loader: getUserInfoWithReload
, path: { nodeId: userId, reload: reload', session } , path: { nodeId: userId, reload: reload', session }
, render: \userInfo@{ ui_username } -> , render: \userInfo@{ ui_username } ->
...@@ -132,7 +133,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where ...@@ -132,7 +133,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
launchAff_ $ do launchAff_ $ do
let Session {userId} = session let Session {userId} = session
res <- saveUserInfo session userId ui res <- saveUserInfo session userId ui
handleRESTError (R2.herePrefix here "[userLayoutWithKey]") errors res $ \_ -> handleRESTError hp errors res $ \_ ->
liftEffect $ T2.reload reload liftEffect $ T2.reload reload
--saveContactHyperdata :: Session -> Int -> HyperdataUser -> AffRESTError Int --saveContactHyperdata :: Session -> Int -> HyperdataUser -> AffRESTError Int
...@@ -161,11 +162,11 @@ type PubmedSettingsProps = ...@@ -161,11 +162,11 @@ type PubmedSettingsProps =
pubmedSettings :: R2.Leaf PubmedSettingsProps pubmedSettings :: R2.Leaf PubmedSettingsProps
pubmedSettings = R2.leaf pubmedSettingsCpt pubmedSettings = R2.leaf pubmedSettingsCpt
pubmedSettingsCpt :: R.Component PubmedSettingsProps pubmedSettingsCpt :: R.Component PubmedSettingsProps
pubmedSettingsCpt = here.component "pubmedSettings" cpt where pubmedSettingsCpt = R2.hereComponent here "pubmedSettings" hCpt where
cpt { nodeId hCpt hp { nodeId
, session } _ = do , session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[pubmedSettings]" , herePrefix: hp
, loader: \_ -> getUser session nodeId , loader: \_ -> getUser session nodeId
, path: unit , path: unit
, render: \user -> pubmedSettingsLoaded { nodeId , render: \user -> pubmedSettingsLoaded { nodeId
...@@ -207,11 +208,11 @@ type EPOSettingsProps = ...@@ -207,11 +208,11 @@ type EPOSettingsProps =
epoSettings :: R2.Leaf EPOSettingsProps epoSettings :: R2.Leaf EPOSettingsProps
epoSettings = R2.leaf epoSettingsCpt epoSettings = R2.leaf epoSettingsCpt
epoSettingsCpt :: R.Component EPOSettingsProps epoSettingsCpt :: R.Component EPOSettingsProps
epoSettingsCpt = here.component "epoSettings" cpt where epoSettingsCpt = R2.hereComponent here "epoSettings" hCpt where
cpt { nodeId hCpt hp { nodeId
, session } _ = do , session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[epoSettings]" , herePrefix: hp
, loader: \_ -> getUser session nodeId , loader: \_ -> getUser session nodeId
, path: unit , path: unit
, render: \user -> epoSettingsLoaded { nodeId , render: \user -> epoSettingsLoaded { nodeId
...@@ -258,8 +259,8 @@ type EditableUserField = ...@@ -258,8 +259,8 @@ type EditableUserField =
editableUserField :: R2.Leaf EditableUserField editableUserField :: R2.Leaf EditableUserField
editableUserField = R2.leaf editableUserFieldCpt editableUserField = R2.leaf editableUserFieldCpt
editableUserFieldCpt :: R.Component EditableUserField editableUserFieldCpt :: R.Component EditableUserField
editableUserFieldCpt = here.component "editableUserField" cpt where editableUserFieldCpt = R2.hereComponent here "editableUserField" hCpt where
cpt { callback hCpt hp { callback
, description , description
, mValue } _ = do , mValue } _ = do
{ errors } <- AppStore.use { errors } <- AppStore.use
...@@ -278,14 +279,12 @@ editableUserFieldCpt = here.component "editableUserField" cpt where ...@@ -278,14 +279,12 @@ editableUserFieldCpt = here.component "editableUserField" cpt where
where where
onUpdate errors s = do onUpdate errors s = do
here.log2 ("[editableUserField] " <> description) s
case s of case s of
"" -> pure unit "" -> pure unit
_ -> do _ -> do
launchAff_ $ do launchAff_ $ do
res <- callback s res <- callback s
handleRESTError (R2.herePrefix here "[editableUserField]") errors res $ \_result -> handleRESTError hp errors res (const $ pure unit)
liftEffect $ here.log ("[editableUserField] " <> description <> " updated")
------------------------------------------------------------ ------------------------------------------------------------
......
...@@ -31,10 +31,9 @@ type Props = ...@@ -31,10 +31,9 @@ type Props =
contactLayout :: R2.Leaf ( key :: String | Props ) contactLayout :: R2.Leaf ( key :: String | Props )
contactLayout = R2.leaf contactLayoutCpt contactLayout = R2.leaf contactLayoutCpt
contactLayoutCpt :: R.Component ( key :: String | Props ) contactLayoutCpt :: R.Component ( key :: String | Props )
contactLayoutCpt = here.component "layout" cpt where contactLayoutCpt = R2.hereComponent here "layout" hCpt where
-- Component -- Component
cpt { nodeId hCpt hp { nodeId } _ = do
} _ = do
session <- useSession session <- useSession
...@@ -42,7 +41,7 @@ contactLayoutCpt = here.component "layout" cpt where ...@@ -42,7 +41,7 @@ contactLayoutCpt = here.component "layout" cpt where
useLoader useLoader
{ errorHandler: Nothing { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[contactLayout]" , herePrefix: hp
, loader: getAnnuaireContact session , loader: getAnnuaireContact session
, path: nodeId , path: nodeId
, render: , render:
......
...@@ -33,9 +33,8 @@ cacheName = "metrics" ...@@ -33,9 +33,8 @@ cacheName = "metrics"
metricsLoadView :: forall a. Eq a => Record (MetricsLoadViewProps a) -> R.Element metricsLoadView :: forall a. Eq a => Record (MetricsLoadViewProps a) -> R.Element
metricsLoadView p = R.createElement metricsLoadViewCpt p [] metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a) metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = here.component "metricsLoadView" cpt metricsLoadViewCpt = R2.hereComponent here "metricsLoadView" hCpt where
where hCpt hp { getMetrics
cpt { getMetrics
, loaded , loaded
, onClick , onClick
, onInit , onInit
...@@ -46,7 +45,7 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt ...@@ -46,7 +45,7 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[metricsLoadView]" , herePrefix: hp
, loader: getMetrics session , loader: getMetrics session
, path: reload' /\ path , path: reload' /\ path
, render: \l -> loaded { path, reload, session, onClick, onInit } l } , render: \l -> loaded { path, reload, session, onClick, onInit } l }
......
...@@ -47,12 +47,12 @@ type ViewProps = ...@@ -47,12 +47,12 @@ type ViewProps =
corpusCodeLayout :: R2.Leaf Props corpusCodeLayout :: R2.Leaf Props
corpusCodeLayout = R2.leaf corpusCodeLayoutCpt corpusCodeLayout = R2.leaf corpusCodeLayoutCpt
corpusCodeLayoutCpt :: R.Component Props corpusCodeLayoutCpt :: R.Component Props
corpusCodeLayoutCpt = here.component "corpusCodeLayout" cpt where corpusCodeLayoutCpt = R2.hereComponent here "corpusCodeLayout" hCpt where
cpt { nodeId, session, boxes } _ = do hCpt hp { nodeId, session, boxes } _ = do
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[corpusCodeLayout]" , herePrefix: hp
, loader: loadCorpusWithReload , loader: loadCorpusWithReload
, path: { nodeId, reload: reload', session } , path: { nodeId, reload: reload', session }
, render: \corpus -> corpusCodeView { corpus, nodeId, reload, session, boxes } } , render: \corpus -> corpusCodeView { corpus, nodeId, reload, session, boxes } }
......
...@@ -47,14 +47,13 @@ type KeyProps = ...@@ -47,14 +47,13 @@ type KeyProps =
dashboardLayoutWithKey :: R2.Component KeyProps dashboardLayoutWithKey :: R2.Component KeyProps
dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt
dashboardLayoutWithKeyCpt :: R.Component KeyProps dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt dashboardLayoutWithKeyCpt = R2.hereComponent here "dashboardLayoutWithKey" hCpt where
where hCpt hp { nodeId, session } _ = do
cpt { nodeId, session } _ = do
reload <- T.useBox T2.newReload reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload reload' <- T.useLive T.unequal reload
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[dashboardLayoutWithKey]" , herePrefix: hp
, loader: DT.loadDashboardWithReload , loader: DT.loadDashboardWithReload
, path: { nodeId, reload: reload', session } , path: { nodeId, reload: reload', session }
, render: \(DT.DashboardData { hyperdata: DT.Hyperdata h, parentId }) -> do , render: \(DT.DashboardData { hyperdata: DT.Hyperdata h, parentId }) -> do
...@@ -76,7 +75,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt ...@@ -76,7 +75,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
, session } , session }
liftEffect $ do liftEffect $ do
_ <- case res of _ <- case res of
Left err -> here.warn2 "[dashboardLayoutWithKey] onChange RESTError" err Left err -> R2.hpWarn2 hp "onChange RESTError" err
_ -> pure unit _ -> pure unit
T2.reload reload T2.reload reload
......
...@@ -32,8 +32,8 @@ here = R2.here "Gargantext.Components.Nodes.Corpus.Document" ...@@ -32,8 +32,8 @@ here = R2.here "Gargantext.Components.Nodes.Corpus.Document"
node :: R2.Leaf ( key :: String | Props ) node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props ) nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where nodeCpt = R2.hereComponent here "node" hCpt where
cpt { listId hCpt hp { listId
, mCorpusId , mCorpusId
, nodeId , nodeId
} _ = do } _ = do
...@@ -55,7 +55,7 @@ nodeCpt = here.component "node" cpt where ...@@ -55,7 +55,7 @@ nodeCpt = here.component "node" cpt where
-- | Hooks -- | Hooks
-- | -- |
useLoaderEffect useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[documentLayoutWithKey]") { errorHandler: logRESTError hp
, loader: loadData , loader: loadData
, path , path
, state , state
......
...@@ -34,8 +34,8 @@ node :: R2.Leaf MainProps ...@@ -34,8 +34,8 @@ node :: R2.Leaf MainProps
node = R2.leaf nodeCpt node = R2.leaf nodeCpt
nodeCpt :: R.Component MainProps nodeCpt :: R.Component MainProps
nodeCpt = here.component "node" cpt where nodeCpt = R2.hereComponent here "node" hCpt where
cpt { nodeId } _ = do hCpt hp { nodeId } _ = do
-- | States -- | States
-- | -- |
session <- useSession session <- useSession
...@@ -45,7 +45,7 @@ nodeCpt = here.component "node" cpt where ...@@ -45,7 +45,7 @@ nodeCpt = here.component "node" cpt where
-- | Computed -- | Computed
-- | -- |
let errorHandler = logRESTError (R2.herePrefix here "[phylo]") let errorHandler = logRESTError hp
-- | Hooks -- | Hooks
-- | -- |
......
...@@ -50,10 +50,10 @@ type FileLayoutProps = ( nodeId :: NodeID, session :: Session ) ...@@ -50,10 +50,10 @@ type FileLayoutProps = ( nodeId :: NodeID, session :: Session )
fileLayout :: R2.Leaf FileLayoutProps fileLayout :: R2.Leaf FileLayoutProps
fileLayout = R2.leaf fileLayoutCpt fileLayout = R2.leaf fileLayoutCpt
fileLayoutCpt :: R.Component FileLayoutProps fileLayoutCpt :: R.Component FileLayoutProps
fileLayoutCpt = here.component "fileLayout" cpt where fileLayoutCpt = R2.hereComponent here "fileLayout" hCpt where
cpt { nodeId, session } _ = do hCpt hp { nodeId, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[fileLayout]" , herePrefix: hp
, loader: loadFile session , loader: loadFile session
, path: nodeId , path: nodeId
, render: onLoad } , render: onLoad }
......
...@@ -32,8 +32,8 @@ node :: R2.Leaf ( key :: String | Props ) ...@@ -32,8 +32,8 @@ node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props ) nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where nodeCpt = R2.hereComponent here "node" hCpt where
cpt { nodeId hCpt hp { nodeId
, nodeType , nodeType
} _ = do } _ = do
-- | States -- | States
...@@ -46,7 +46,7 @@ nodeCpt = here.component "node" cpt where ...@@ -46,7 +46,7 @@ nodeCpt = here.component "node" cpt where
-- | Hooks -- | Hooks
-- | -- |
useLoaderEffect useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[frameLayout]") { errorHandler: logRESTError hp
, loader: loadframeWithReload , loader: loadframeWithReload
, path: , path:
{ nodeId { nodeId
......
...@@ -41,8 +41,8 @@ here = R2.here "Gargantext.Components.Nodes.Graph" ...@@ -41,8 +41,8 @@ here = R2.here "Gargantext.Components.Nodes.Graph"
node :: R2.Leaf ( key :: String | Props ) node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt node = R2.leaf nodeCpt
nodeCpt :: R.Component ( key :: String | Props ) nodeCpt :: R.Component ( key :: String | Props )
nodeCpt = here.component "node" cpt where nodeCpt = R2.hereComponent here "node" hCpt where
cpt { graphId } _ = do hCpt hp { graphId } _ = do
-- | States -- | States
-- | -- |
{ graphVersion { graphVersion
...@@ -56,7 +56,7 @@ nodeCpt = here.component "node" cpt where ...@@ -56,7 +56,7 @@ nodeCpt = here.component "node" cpt where
-- | Computed -- | Computed
-- | -- |
let errorHandler = logRESTError (R2.herePrefix here "[node]") let errorHandler = logRESTError hp
-- | Hooks -- | Hooks
-- | -- |
......
...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..)) ...@@ -7,7 +7,7 @@ import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow) import Data.Show.Generic (genericShow)
import Data.String (take) import Data.String (take)
import Gargantext.Config (publicBackend) import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (AffRESTError, get, logRESTError) import Gargantext.Config.REST (AffRESTError, get)
import Gargantext.Ends (backendUrl) import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -68,10 +68,10 @@ loadPublicData _l = do ...@@ -68,10 +68,10 @@ loadPublicData _l = do
renderPublic :: R2.Leaf () renderPublic :: R2.Leaf ()
renderPublic = R2.leaf renderPublicCpt renderPublic = R2.leaf renderPublicCpt
renderPublicCpt :: R.Component () renderPublicCpt :: R.Component ()
renderPublicCpt = here.component "renderPublic" cpt where renderPublicCpt = R2.hereComponent here "renderPublic" hCpt where
cpt _ _ = do hCpt hp _ _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[renderPublic]" , herePrefix: hp
, loader: loadPublicData , loader: loadPublicData
, path: { reload: 0 } , path: { reload: 0 }
, render: loaded } , render: loaded }
......
...@@ -58,8 +58,8 @@ listsLayoutCpt = here.component "listsLayout" cpt where ...@@ -58,8 +58,8 @@ listsLayoutCpt = here.component "listsLayout" cpt where
listsLayoutWithKey :: R2.Component ( key :: String | Props ) listsLayoutWithKey :: R2.Component ( key :: String | Props )
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKeyCpt :: R.Component ( key :: String | Props ) listsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where listsLayoutWithKeyCpt = R2.hereComponent here "listsLayoutWithKey" hCpt where
cpt { boxes hCpt hp { boxes
, nodeId , nodeId
, session , session
, sessionUpdate , sessionUpdate
...@@ -75,7 +75,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where ...@@ -75,7 +75,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
T.listen (\{ new } -> afterCacheStateChange new) cacheState T.listen (\{ new } -> afterCacheStateChange new) cacheState
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[listsLayoutWithKey]" , herePrefix: hp
, path , path
, loader: loadCorpusWithChild , loader: loadCorpusWithChild
, render: \corpusData@{ corpusId, corpusNode: NodePoly poly } -> , render: \corpusData@{ corpusId, corpusNode: NodePoly poly } ->
...@@ -191,19 +191,19 @@ type NgramsDocListProps = ...@@ -191,19 +191,19 @@ type NgramsDocListProps =
ngramsDocList :: R2.Component NgramsDocListProps ngramsDocList :: R2.Component NgramsDocListProps
ngramsDocList = R.createElement ngramsDocListCpt ngramsDocList = R.createElement ngramsDocListCpt
ngramsDocListCpt :: R.Component NgramsDocListProps ngramsDocListCpt :: R.Component NgramsDocListProps
ngramsDocListCpt = here.component "ngramsDocList" cpt where ngramsDocListCpt = R2.hereComponent here "ngramsDocList" hCpt where
cpt { mCorpusId: Nothing } _ = do hCpt hp { mCorpusId: Nothing } _ = do
pure $ H.div {} [] pure $ H.div {} []
cpt { mListId: Nothing } _ = do hCpt hp { mListId: Nothing } _ = do
pure $ H.div {} [] pure $ H.div {} []
cpt { mNgrams: Nothing } _ = do hCpt hp { mNgrams: Nothing } _ = do
pure $ H.div {} [] pure $ H.div {} []
cpt { mCorpusId: Just corpusId hCpt hp { mCorpusId: Just corpusId
, mListId: Just listId , mListId: Just listId
, mNgrams: Just ngrams , mNgrams: Just ngrams
, session } _ = do , session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[ngramsDocList]" , herePrefix: hp
, path: { corpusId, ngrams, session } , path: { corpusId, ngrams, session }
, loader: loaderNgramsDocList , loader: loaderNgramsDocList
, render: \ctx -> ngramsDocListLoaded { contexts: ctx , render: \ctx -> ngramsDocListLoaded { contexts: ctx
......
...@@ -29,7 +29,6 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT ...@@ -29,7 +29,6 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (textsReloadContext) import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table import Gargantext.Components.Table as Table
import Gargantext.Config.REST (logRESTError)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader, useLoaderEffect) import Gargantext.Hooks.Loader (useLoader, useLoaderEffect)
import Gargantext.Hooks.Session (useSession) import Gargantext.Hooks.Session (useSession)
...@@ -75,8 +74,8 @@ textsLayoutCpt = here.component "textsLayout" cpt where ...@@ -75,8 +74,8 @@ textsLayoutCpt = here.component "textsLayout" cpt where
textsLayoutWithKey :: R2.Leaf ( key :: String | Props ) textsLayoutWithKey :: R2.Leaf ( key :: String | Props )
textsLayoutWithKey = R2.leaf textsLayoutWithKeyCpt textsLayoutWithKey = R2.leaf textsLayoutWithKeyCpt
textsLayoutWithKeyCpt :: R.Component ( key :: String | Props ) textsLayoutWithKeyCpt :: R.Component ( key :: String | Props )
textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt where textsLayoutWithKeyCpt = R2.hereComponent here "textsLayoutWithKey" hCpt where
cpt { frontends hCpt hp { frontends
, nodeId , nodeId
} _ = do } _ = do
session <- useSession session <- useSession
...@@ -92,7 +91,7 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt where ...@@ -92,7 +91,7 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt where
T.listen (\{ new } -> afterCacheStateChange new) cacheState T.listen (\{ new } -> afterCacheStateChange new) cacheState
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[textsLayoutWithKey]" , herePrefix: hp
, loader: loadCorpusWithChild , loader: loadCorpusWithChild
, path: { nodeId, session } , path: { nodeId, session }
, render: \corpusData@{ corpusId, corpusNode } -> , render: \corpusData@{ corpusId, corpusNode } ->
...@@ -508,8 +507,8 @@ type SideText = ...@@ -508,8 +507,8 @@ type SideText =
sideText :: R2.Leaf ( key :: String | SideText ) sideText :: R2.Leaf ( key :: String | SideText )
sideText = R2.leaf sideTextCpt sideText = R2.leaf sideTextCpt
sideTextCpt :: R.Component ( key :: String | SideText ) sideTextCpt :: R.Component ( key :: String | SideText )
sideTextCpt = here.component "sideText" cpt where sideTextCpt = R2.hereComponent here "sideText" hCpt where
cpt { sidePanelText: { corpusId, listId, nodeId } hCpt hp { sidePanelText: { corpusId, listId, nodeId }
, session , session
} _ = do } _ = do
-- | States -- | States
...@@ -547,7 +546,7 @@ sideTextCpt = here.component "sideText" cpt where ...@@ -547,7 +546,7 @@ sideTextCpt = here.component "sideText" cpt where
-- } -- }
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[sideText]" , herePrefix: hp
, loader: \{ path } -> loadData path , loader: \{ path } -> loadData path
, path: { path } , path: { path }
, render: \loaded -> loadedSideText { loaded , render: \loaded -> loadedSideText { loaded
......
...@@ -36,8 +36,8 @@ type Props = ...@@ -36,8 +36,8 @@ type Props =
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 = R2.hereComponent here "main" hCpt where
cpt { frameDoc: FrameDoc { docId, listId, corpusId } hCpt hp { frameDoc: FrameDoc { docId, listId, corpusId }
, session , session
, closeCallback , closeCallback
} _ = do } _ = do
...@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where ...@@ -64,7 +64,7 @@ docFocusCpt = here.component "main" cpt where
-- | Hooks -- | Hooks
-- | -- |
useLoaderEffect useLoaderEffect
{ errorHandler: logRESTError (R2.herePrefix here "[docFocus]") { errorHandler: logRESTError hp
, loader: loadData , loader: loadData
, path , path
, state , state
......
...@@ -63,8 +63,7 @@ data RangeUpdate = SetMin Number | SetMax Number ...@@ -63,8 +63,7 @@ data RangeUpdate = SetMin Number | SetMax Number
rangeSlider :: Record Props -> R.Element rangeSlider :: Record Props -> R.Element
rangeSlider props = R.createElement rangeSliderCpt props [] rangeSlider props = R.createElement rangeSliderCpt props []
rangeSliderCpt :: R.Component Props rangeSliderCpt :: R.Component Props
rangeSliderCpt = here.component "rangeSlider" cpt rangeSliderCpt = here.component "rangeSlider" cpt where
where
cpt props _ = do cpt props _ = do
-- rounding precision (i.e. how many decimal digits are in epsilon) -- rounding precision (i.e. how many decimal digits are in epsilon)
let (Range.Closed { min: minR, max: maxR }) = props.initialValue let (Range.Closed { min: minR, max: maxR }) = props.initialValue
......
...@@ -37,7 +37,7 @@ import Gargantext.Components.Tile (tileBlock) ...@@ -37,7 +37,7 @@ import Gargantext.Components.Tile (tileBlock)
import Gargantext.Components.TopBar as TopBar import Gargantext.Components.TopBar as TopBar
import Gargantext.Components.TreeSearch (treeSearch) import Gargantext.Components.TreeSearch (treeSearch)
import Gargantext.Config (defaultFrontends, defaultBackends) import Gargantext.Config (defaultFrontends, defaultBackends)
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Context.Session as SessionContext import Gargantext.Context.Session as SessionContext
import Gargantext.Ends (Backend) import Gargantext.Ends (Backend)
import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler) import Gargantext.Hooks.Resize (ResizeType(..), useResizeHandler)
......
...@@ -62,9 +62,9 @@ tab :: R2.Component TabProps ...@@ -62,9 +62,9 @@ tab :: R2.Component TabProps
tab = R.createElement tabCpt tab = R.createElement tabCpt
-- | A tab only shows its contents if it is currently selected -- | A tab only shows its contents if it is currently selected
tabCpt :: R.Component TabProps tabCpt :: R.Component TabProps
tabCpt = here.component "tab" cpt tabCpt = here.component "tab" cpt where
where cpt { selected, index } children = do
cpt { selected, index } children = pure $ H.div { className } children' pure $ H.div { className } children'
where where
same = selected == index same = selected == index
className = "tab-pane" <> (if same then "show active" else "fade") className = "tab-pane" <> (if same then "show active" else "fade")
......
...@@ -75,10 +75,8 @@ type ThemeSwitcherProps = ( ...@@ -75,10 +75,8 @@ type ThemeSwitcherProps = (
themeSwitcher :: R2.Component ThemeSwitcherProps themeSwitcher :: R2.Component ThemeSwitcherProps
themeSwitcher = R.createElement themeSwitcherCpt themeSwitcher = R.createElement themeSwitcherCpt
themeSwitcherCpt :: R.Component ThemeSwitcherProps themeSwitcherCpt :: R.Component ThemeSwitcherProps
themeSwitcherCpt = here.component "themeSwitcher" cpt themeSwitcherCpt = here.component "themeSwitcher" cpt where
where
cpt { theme, themes } _ = do cpt { theme, themes } _ = do
currentTheme <- T.useLive T.unequal theme currentTheme <- T.useLive T.unequal theme
......
...@@ -9,7 +9,7 @@ import Gargantext.Components.Bootstrap (formSelect') ...@@ -9,7 +9,7 @@ import Gargantext.Components.Bootstrap (formSelect')
import Gargantext.Components.Bootstrap as B import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..)) import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ModalSizing(..), Position(..), TooltipPosition(..), Variant(..))
import Gargantext.Components.InputWithEnter (inputWithEnter) import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Config.REST (AffRESTError, logRESTError) import Gargantext.Config.REST (AffRESTError)
import Gargantext.Hooks.LinkHandler (useLinkHandler) import Gargantext.Hooks.LinkHandler (useLinkHandler)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (AppRoute(..), appPath, nodeTypeAppRoute) import Gargantext.Routes (AppRoute(..), appPath, nodeTypeAppRoute)
...@@ -142,11 +142,11 @@ treeSearchContainer :: R2.Leaf ContainerProps ...@@ -142,11 +142,11 @@ treeSearchContainer :: R2.Leaf ContainerProps
treeSearchContainer = R2.leaf treeSearchContainerCpt treeSearchContainer = R2.leaf treeSearchContainerCpt
treeSearchContainerCpt :: R.Component ContainerProps treeSearchContainerCpt :: R.Component ContainerProps
treeSearchContainerCpt = here.component "treeSearchContainerCpt" cpt where treeSearchContainerCpt = R2.hereComponent here "treeSearchContainerCpt" hCpt where
cpt {query, visible, session } _ = do hCpt hp {query, visible, session } _ = do
useLoader { errorHandler: Nothing useLoader { errorHandler: Nothing
, herePrefix: R2.herePrefix here "[treeSearchContainer]" , herePrefix: hp
, path: { session, query } , path: { session, query }
, loader: loadSearch , loader: loadSearch
, render: \searchData -> treeSearchRenderContainer { visible, session, searchData } , render: \searchData -> treeSearchRenderContainer { visible, session, searchData }
......
...@@ -38,9 +38,8 @@ here = R2.here "Gargantext.Context.Progress" ...@@ -38,9 +38,8 @@ here = R2.here "Gargantext.Context.Progress"
asyncProgress :: R2.Component AsyncProps asyncProgress :: R2.Component AsyncProps
asyncProgress = R2.component asyncProgressCpt asyncProgress = R2.component asyncProgressCpt
asyncProgressCpt :: R.Component AsyncProps asyncProgressCpt :: R.Component AsyncProps
asyncProgressCpt = R.hooksComponent "asyncProgress" cpt where asyncProgressCpt = R2.hereComponent here "asyncProgress" hCpt where
cpt props@{ onFinish hCpt hp props@{ onFinish } children = do
} children = do
{ errors } <- AppStore.use { errors } <- AppStore.use
-- States -- States
...@@ -63,7 +62,7 @@ asyncProgressCpt = R.hooksComponent "asyncProgress" cpt where ...@@ -63,7 +62,7 @@ asyncProgressCpt = R.hooksComponent "asyncProgress" cpt where
Right _ -> T.write_ 1000 interval Right _ -> T.write_ 1000 interval
interval' <- T.read interval interval' <- T.read interval
resetInterval intervalIdRef (Just interval') exec resetInterval intervalIdRef (Just interval') exec
handleRESTError (R2.herePrefix here "[asyncProgress]") errors eAsyncProgress onProgress handleRESTError hp errors eAsyncProgress onProgress
onProgress :: AsyncProgress -> Aff Unit onProgress :: AsyncProgress -> Aff Unit
onProgress value = liftEffect do onProgress value = liftEffect do
......
...@@ -115,9 +115,21 @@ type Prefix = String ...@@ -115,9 +115,21 @@ type Prefix = String
newtype HerePrefix = HerePrefix { here :: Here newtype HerePrefix = HerePrefix { here :: Here
, prefix :: Prefix } , prefix :: Prefix }
hpLog2 :: forall a b. HerePrefix -> a -> b -> Effect Unit
hpLog2 (HerePrefix { here: h, prefix }) = h.log3 prefix
hpWarn2 :: forall a b. HerePrefix -> a -> b -> Effect Unit
hpWarn2 (HerePrefix { here: h, prefix }) = h.warn3 prefix
herePrefix :: Here -> Prefix -> HerePrefix herePrefix :: Here -> Prefix -> HerePrefix
herePrefix here prefix = HerePrefix { here, prefix } herePrefix here prefix = HerePrefix { here, prefix }
hereComponent :: forall p. Here -> Prefix -> (HerePrefix -> R.HooksComponent p) -> R.Component p
hereComponent here' prefix hpComponent = here'.component prefix (hpComponent hp)
where
hp :: HerePrefix
hp = herePrefix here' prefix
-- newtypes -- newtypes
type NTHooksComponent props = props -> Array R.Element -> R.Hooks R.Element type NTHooksComponent props = props -> Array R.Element -> R.Hooks R.Element
newtype NTComponent p = NTComponent (EffectFn1 p R.Element) newtype NTComponent p = NTComponent (EffectFn1 p R.Element)
......
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