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
bcc6aaa6
Commit
bcc6aaa6
authored
Nov 05, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngrams] asyncTasks – pass action only
parent
c37cc12f
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
113 additions
and
85 deletions
+113
-85
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+1
-0
App.purs
src/Gargantext/Components/App.purs
+18
-3
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+31
-31
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+4
-4
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+10
-10
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+1
-0
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+1
-1
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+1
-1
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+46
-35
No files found.
src/Gargantext/AsyncTasks.purs
View file @
bcc6aaa6
...
...
@@ -54,6 +54,7 @@ type ReductorProps = (
)
type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit
useTasks :: R.State Int -> R.Hooks Reductor
useTasks reload = R2.useReductor act initializer unit
...
...
src/Gargantext/Components/App.purs
View file @
bcc6aaa6
...
...
@@ -91,7 +91,12 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
false ->
case fst route of
Annuaire sid nodeId -> withSession sid $ \session -> forested $ annuaireLayout { frontends, nodeId, session }
ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout { annuaireId: aId, asyncTasks, frontends, nodeId, session }
ContactPage sid aId nodeId -> withSession sid $ \session -> forested $ annuaireUserLayout {
annuaireId: aId
, asyncTasks: snd asyncTasks, frontends
, nodeId
, session
}
Corpus sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
CorpusDocument sid corpusId listId nodeId -> withSession sid $ \session -> forested $ documentLayout { nodeId, listId, session, corpusId: Just corpusId }
Dashboard sid nodeId -> withSession sid $ \session -> forested $ dashboardLayout { nodeId, session }
...
...
@@ -103,7 +108,12 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
FolderPublic sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
FolderShared sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Home -> forested $ homeLayout { backend, lang:LL_EN, publicBackend, sessions, visible: showLogin }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout { asyncTasks, nodeId, session, sessionUpdate }
Lists sid nodeId -> withSession sid $ \session -> forested $ listsLayout {
asyncTasks: snd asyncTasks
, nodeId
, session
, sessionUpdate
}
Login -> login { backend, backends, sessions, visible: showLogin }
PGraphExplorer sid graphId ->
withSession sid $
...
...
@@ -126,7 +136,12 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
RouteFrameWrite sid nodeId -> withSession sid $ \session -> forested $ frameLayout { nodeId, session, nodeType: GT.NodeFrameWrite}
Team sid nodeId -> withSession sid $ \session -> forested $ corpusLayout { nodeId, session }
Texts sid nodeId -> withSession sid $ \session -> forested $ textsLayout { frontends, nodeId, session, sessionUpdate }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout { asyncTasks, frontends, nodeId, session }
UserPage sid nodeId -> withSession sid $ \session -> forested $ userLayout {
asyncTasks: snd asyncTasks
, frontends
, nodeId
, session
}
type ForestLayoutProps =
( asyncTasks :: GAT.Reductor
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
bcc6aaa6
...
...
@@ -280,7 +280,7 @@ tableContainerCpt { dispatch
-- NEXT
type Props = (
afterSync :: Unit -> Aff Unit
, asyncTasks :: GAT.Reductor
, asyncTasks :: GAT.Reductor
Action
, path :: R.State PageParams
, state :: R.State State
, tabNgramType :: CTabNgramType
...
...
@@ -341,7 +341,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
task <- postNgramsChartsAsync path'
liftEffect $ do
log2 "[performAction] Synchronize task" task
snd
asyncTasks $ GAT.Insert nodeId task
asyncTasks $ GAT.Insert nodeId task
autoUpdate :: Array R.Element
autoUpdate = if withAutoUpdate then
...
...
@@ -495,7 +495,7 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
type MainNgramsTableProps = (
afterSync :: Unit -> Aff Unit
, asyncTasks :: GAT.Reductor
, asyncTasks :: GAT.Reductor
Action
, cacheState :: R.State NT.CacheState
, defaultListId :: Int
, nodeId :: Int
...
...
@@ -587,7 +587,7 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
type MainNgramsTablePaintProps = (
afterSync :: Unit -> Aff Unit
, asyncTasks :: GAT.Reductor
, asyncTasks :: GAT.Reductor
Action
, path :: PageParams
, tabNgramType :: CTabNgramType
, versioned :: VersionedNgramsTable
...
...
@@ -614,33 +614,33 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
, withAutoUpdate
}
type MainNgramsTablePaintWithStateProps = (
afterSync :: Unit -> Aff Unit
, asyncTasks :: GAT.Reductor
, path :: R.State PageParams
, tabNgramType :: CTabNgramType
, versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean
)
mainNgramsTablePaintWithState :: Record MainNgramsTablePaintWithStateProps -> R.Element
mainNgramsTablePaintWithState p = R.createElement mainNgramsTablePaintWithStateCpt p []
mainNgramsTablePaintWithStateCpt :: R.Component MainNgramsTablePaintWithStateProps
mainNgramsTablePaintWithStateCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintWithState" cpt
where
cpt { afterSync, asyncTasks, path, tabNgramType, versioned, withAutoUpdate } _ = do
state <- R.useState' $ initialState versioned
pure $ loadedNgramsTable {
afterSync
, asyncTasks
, path
, state
, tabNgramType
, versioned
, withAutoUpdate
}
--
type MainNgramsTablePaintWithStateProps = (
--
afterSync :: Unit -> Aff Unit
--
, asyncTasks :: GAT.Reductor
--
, path :: R.State PageParams
--
, tabNgramType :: CTabNgramType
--
, versioned :: VersionedNgramsTable
--
, withAutoUpdate :: Boolean
--
)
--
mainNgramsTablePaintWithState :: Record MainNgramsTablePaintWithStateProps -> R.Element
--
mainNgramsTablePaintWithState p = R.createElement mainNgramsTablePaintWithStateCpt p []
--
mainNgramsTablePaintWithStateCpt :: R.Component MainNgramsTablePaintWithStateProps
--
mainNgramsTablePaintWithStateCpt = R.hooksComponentWithModule thisModule "mainNgramsTablePaintWithState" cpt
--
where
--
cpt { afterSync, asyncTasks, path, tabNgramType, versioned, withAutoUpdate } _ = do
--
state <- R.useState' $ initialState versioned
--
pure $ loadedNgramsTable {
--
afterSync
--
, asyncTasks
--
, path
--
, state
--
, tabNgramType
--
, versioned
--
, withAutoUpdate
--
}
type NgramsOcc = { occurrences :: Additive Int, children :: Set NgramsTerm }
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
bcc6aaa6
...
...
@@ -145,10 +145,10 @@ infoRender (Tuple title content) =
, H.span {} [H.text content] ]
type LayoutProps = (
asyncTasks
:: GAT.Reductor
, frontends :: Frontends
, nodeId :: Int
, session :: Session
asyncTasks
:: GAT.ReductorAction
, frontends
:: Frontends
, nodeId
:: Int
, session
:: Session
)
type KeyLayoutProps = (
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
bcc6aaa6
...
...
@@ -44,12 +44,12 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps = (
asyncTasks
:: GAT.Reductor
, cacheState :: R.State NTypes.CacheState
asyncTasks
:: GAT.ReductorAction
, cacheState
:: R.State NTypes.CacheState
, contactData :: ContactData
, frontends :: Frontends
, nodeId :: Int
, session :: Session
, frontends
:: Frontends
, nodeId
:: Int
, session
:: Session
)
tabs :: Record TabsProps -> R.Element
...
...
@@ -91,12 +91,12 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
type NgramsViewTabsProps = (
asyncTasks :: GAT.Reductor
, cacheState :: R.State NTypes.CacheState
asyncTasks :: GAT.Reductor
Action
, cacheState
:: R.State NTypes.CacheState
, defaultListId :: Int
, mode :: Mode
, nodeId :: Int
, session :: Session
, mode
:: Mode
, nodeId
:: Int
, session
:: Session
)
ngramsView :: Record NgramsViewTabsProps -> R.Element
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
bcc6aaa6
...
...
@@ -30,6 +30,7 @@ import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Corpus"
type Props =
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
bcc6aaa6
...
...
@@ -25,7 +25,7 @@ thisModule = "Gargantext.Components.Nodes.Lists"
------------------------------------------------------------------------
type Props = (
asyncTasks :: GAT.Reductor
asyncTasks :: GAT.Reductor
Action
, nodeId :: Int
, session :: Session
, sessionUpdate :: Session -> Effect Unit
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
bcc6aaa6
...
...
@@ -26,7 +26,7 @@ thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
type Props = (
asyncTasks
:: GAT.Reductor
asyncTasks
:: GAT.ReductorAction
, cacheState :: R.State NTypes.CacheState
, corpusData :: CorpusData
, corpusId :: Int
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
bcc6aaa6
...
...
@@ -11,6 +11,7 @@ import Effect.Aff (launchAff_)
import Reactix as R
import Reactix.DOM.HTML as H
--------------------------------------------------------
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.Loader (loader)
import Gargantext.Components.NgramsTable.Loader (clearCache)
...
...
@@ -163,58 +164,68 @@ docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
-- docViewLayoutRec :: forall a. DocViewProps a -> Record DT.LayoutProps
docViewLayoutRec { cacheState, corpusData: { defaultListId }, corpusId, frontends, session, tabType: TabDocs } =
{ nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, cacheState
{ cacheState
, chart : H.div {} []
, tabType: TabCorpus TabDocs
, totalRecords: 4737
, listId: defaultListId
, corpusId: Just corpusId
, frontends
, listId: defaultListId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
, showSearch: true
, frontends, session }
, tabType: TabCorpus TabDocs
, totalRecords: 4737
}
docViewLayoutRec { cacheState, corpusData: { defaultListId }, corpusId, frontends, session, tabType: TabMoreLikeFav } =
{ nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, cacheState
{ cacheState
, chart : H.div {} []
, tabType: TabCorpus TabMoreLikeFav
, totalRecords: 4737
, listId: defaultListId
, corpusId: Just corpusId
, frontends
, listId: defaultListId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
, showSearch: false
, frontends, session }
, tabType: TabCorpus TabMoreLikeFav
, totalRecords: 4737
}
docViewLayoutRec { cacheState, corpusData: { defaultListId }, corpusId, frontends, session, tabType: TabMoreLikeTrash } =
{ nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, cacheState
{ cacheState
, chart : H.div {} []
, tabType: TabCorpus TabMoreLikeTrash
, totalRecords: 4737
, listId: defaultListId
, corpusId: Just corpusId
, frontends
, listId: defaultListId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
, showSearch: false
, frontends, session }
, tabType: TabCorpus TabMoreLikeTrash
, totalRecords: 4737
}
docViewLayoutRec { cacheState, corpusData: { defaultListId }, corpusId, frontends, session, tabType: TabTrash } =
{ nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, cacheState
{ cacheState
, chart : H.div {} []
, tabType: TabCorpus TabTrash
, totalRecords: 4737
, listId: defaultListId
, corpusId: Nothing
, frontends
, listId: defaultListId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
, showSearch: true
, frontends, session }
, tabType: TabCorpus TabTrash
, totalRecords: 4737
}
-- DUMMY
docViewLayoutRec { cacheState, corpusData: { defaultListId }, corpusId, frontends, session, tabType } =
{ nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, cacheState
{ cacheState
, chart : H.div {} []
, tabType: TabCorpus TabTrash
, totalRecords: 4737
, listId: defaultListId
, corpusId: Nothing
, frontends
, listId: defaultListId
, nodeId: corpusId
-- ^ TODO merge nodeId and corpusId in DT
, session
, showSearch: true
, frontends, session }
, tabType: TabCorpus TabTrash
, totalRecords: 4737
}
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