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
a702dad5
Commit
a702dad5
authored
Mar 30, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[toestand] some reloadForest/Root refactorign
parent
ebb67a01
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
32 deletions
+29
-32
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+5
-3
Forest.purs
src/Gargantext/Components/Forest.purs
+2
-2
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+2
-2
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+1
-1
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+1
-1
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+7
-8
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+9
-13
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+1
-1
Router.purs
src/Gargantext/Components/Router.purs
+1
-1
No files found.
src/Gargantext/AsyncTasks.purs
View file @
a702dad5
...
...
@@ -79,18 +79,20 @@ data Action =
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action p@{ reloadForest, storage } (Insert nodeId t) = do
_ <- T2.reload reloadForest
--
_ <- T2.reload reloadForest
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
pure $ p { storage = newStorage }
action p (Finish nodeId t) = do
action p (Remove nodeId t)
action p@{ reloadRoot, reloadForest, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
_ <- if GT.asyncTaskTriggersAppReload typ then
T2.reload reloadRoot
pure unit
-- T2.reload reloadRoot
else
pure unit
_ <- if GT.asyncTaskTriggersTreeReload typ then
T2.reload reloadForest
pure unit
-- T2.reload reloadForest
else
pure unit
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
...
...
src/Gargantext/Components/Forest.purs
View file @
a702dad5
...
...
@@ -76,7 +76,7 @@ forestCpt = here.component "forest" cpt where
-- T.write_ (Just tasks') tasks
handed' <- T.useLive T.unequal handed
reloadForest' <- T.useLive T.unequal reloadForest
reloadRoot' <- T.useLive T.unequal reloadRoot
--
reloadRoot' <- T.useLive T.unequal reloadRoot
route' <- T.useLive T.unequal route
forestOpen' <- T.useLive T.unequal forestOpen
sessions' <- T.useLive T.unequal sessions
...
...
@@ -87,7 +87,7 @@ forestCpt = here.component "forest" cpt where
-- R.setRef tasks $ Just tasks'
R2.useCache
( frontends /\ route' /\ sessions' /\ handed' /\ forestOpen'
/\ reloadForest' /\
reloadRoot' /\
(fst tasks).storage )
/\ reloadForest' /\ (fst tasks).storage )
(cp handed' sessions')
where
common = RX.pick props :: Record Common
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
a702dad5
...
...
@@ -77,9 +77,9 @@ treeLoaderCpt = here.component "treeLoader" cpt where
-- treeLoaderCpt = R.memo (here.component "treeLoader" cpt) memoCmp where
-- memoCmp ({ root: t1 }) ({ root: t2 }) = t1 == t2
cpt p@{ root, session } _ = do
app <- T.useLive T.unequal p.reloadRoot
--
app <- T.useLive T.unequal p.reloadRoot
let fetch { root: r } = getNodeTree session r
useLoader {
app,
root } fetch loaded where
useLoader { root } fetch loaded where
loaded tree' = tree props where
props = Record.merge common extra where
common = RecordE.pick p :: Record Common
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
a702dad5
...
...
@@ -147,7 +147,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
-- case mT of
-- Just t' -> snd t' $ GAT.Finish id' t
-- Nothing -> pure unit
T2.reload reloadRoot
--
T2.reload reloadRoot
SettingsBox {show: showBox} = settingsBox nodeType
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
a702dad5
...
...
@@ -361,7 +361,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
totalRecords = fromMaybe (Seq.length rows) mTotalRows
afterSync' _ = do
chartsAfterSync path' tasks
reloadForest
unit
chartsAfterSync path' tasks unit
afterSync unit
syncResetButton = syncResetButtons { afterSync: afterSync'
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
a702dad5
...
...
@@ -1141,7 +1141,8 @@ syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = here.component "syncResetButtons" cpt
where
cpt { afterSync, ngramsLocalPatch, performAction } _ = do
synchronizing@(s /\ setSynchronizing) <- R.useState' false
-- synchronizing <- T.useBox false
-- synchronizing' <- T.useLive T.unequal synchronizing
let
hasChanges = ngramsLocalPatch /= mempty
...
...
@@ -1151,12 +1152,12 @@ syncResetButtonsCpt = here.component "syncResetButtons" cpt
performAction ResetPatches
synchronizeClick _ = delay unit $ \_ -> do
setSynchronizing $ const true
-- T.write_ true synchronizing
performAction $ Synchronize { afterSync: newAfterSync }
newAfterSync x = do
afterSync x
liftEffect $ setSynchronizing $ const false
-- liftEffect $ T.write_ false synchronizing
pure $ H.div { className: "btn-toolbar" }
[ H.div { className: "btn-group mr-2" }
...
...
@@ -1166,8 +1167,8 @@ syncResetButtonsCpt = here.component "syncResetButtons" cpt
]
, H.div { className: "btn-group mr-2" }
[ H.button { className: "btn btn-primary " <> hasChangesClass
, on: { click: synchronizeClick }
} [ H.text "Sync" ]
, on: { click: synchronizeClick }
} [ H.text "Sync" ]
]
]
...
...
@@ -1185,15 +1186,13 @@ chartsAfterSync :: forall props discard.
| props
}
-> GAT.Reductor
-> T.Box T2.Reload
-> discard
-> Aff Unit
chartsAfterSync path'@{ nodeId } tasks
reloadForest
_ = do
chartsAfterSync path'@{ nodeId } tasks _ = do
task <- postNgramsChartsAsync path'
liftEffect $ do
log2 "[chartsAfterSync] Synchronize task" task
snd tasks $ GAT.Insert nodeId task
T2.reload reloadForest
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
a702dad5
module Gargantext.Components.Nodes.Lists where
import
Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (<>)
)
import
DOM.Simple.Console (log, log2
)
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (launchAff_)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Record.Extra as REX
import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Forest as Forest
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types
( getCorpusInfo, CorpusInfo(..), Hyperdata(..) )
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types
( CacheState(..), ListsLayoutControls, SidePanelState(..)
, initialControls, toggleSidePanelState )
import Gargantext.Components.Nodes.Lists.Types (CacheState(..), ListsLayoutControls, SidePanelState(..), initialControls, toggleSidePanelState)
import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (<>))
import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Record.Extra as REX
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists"
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
a702dad5
...
...
@@ -79,7 +79,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
, sidePanelTriggers
, tasks } _ = do
chartsReload <- T.useBox T2.newReload
chartsReload' <- T.useLive T.unequal chartsReload
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
{ listIds, nodeId, params, tabType } <- T.useLive T.unequal path
let path' = {
...
...
src/Gargantext/Components/Router.purs
View file @
a702dad5
...
...
@@ -226,8 +226,8 @@ listsCpt = here.component "lists" cpt where
, showLogin
, tasks }
, listsProps: { nodeId
, reloadRoot
, reloadForest
, reloadRoot
, session
, sessionUpdate: \_ -> pure unit
, tasks }
...
...
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