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
61f55710
Commit
61f55710
authored
Jan 18, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[refactoring] add separate G.U.Reload module
parent
349f7110
Changes
28
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
221 additions
and
327 deletions
+221
-327
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+7
-6
App.purs
src/Gargantext/Components/App.purs
+3
-2
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+5
-4
Forest.purs
src/Gargantext/Components/Forest.purs
+8
-9
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+19
-167
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+3
-2
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+22
-21
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+6
-5
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+12
-15
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+16
-25
Contacts.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
+10
-9
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+6
-5
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+12
-11
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+1
-1
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+1
-1
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+1
-1
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+1
-1
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+1
-1
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+4
-5
Utils.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
+11
-9
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+8
-7
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+3
-3
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+6
-5
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+3
-2
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+7
-6
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+1
-1
Types.purs
src/Gargantext/Types.purs
+2
-3
Reload.purs
src/Gargantext/Utils/Reload.purs
+42
-0
No files found.
src/Gargantext/AsyncTasks.purs
View file @
61f55710
...
@@ -16,6 +16,7 @@ import Gargantext.Prelude
...
@@ -16,6 +16,7 @@ import Gargantext.Prelude
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils as GU
import Gargantext.Utils as GU
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
localStorageKey :: String
localStorageKey :: String
...
@@ -48,15 +49,15 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
...
@@ -48,15 +49,15 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
type ReductorProps = (
type ReductorProps = (
appReload :: G
T
.ReloadS
appReload :: G
UR
.ReloadS
, treeReload :: G
T
.ReloadS
, treeReload :: G
UR
.ReloadS
, storage :: Storage
, storage :: Storage
)
)
type Reductor = R2.Reductor (Record ReductorProps) Action
type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit
type ReductorAction = Action -> Effect Unit
useTasks :: G
T.ReloadS -> GT
.ReloadS -> R.Hooks Reductor
useTasks :: G
UR.ReloadS -> GUR
.ReloadS -> R.Hooks Reductor
useTasks appReload treeReload = R2.useReductor act initializer unit
useTasks appReload treeReload = R2.useReductor act initializer unit
where
where
act :: R2.Actor (Record ReductorProps) Action
act :: R2.Actor (Record ReductorProps) Action
...
@@ -72,18 +73,18 @@ data Action =
...
@@ -72,18 +73,18 @@ data Action =
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action :: Record ReductorProps -> Action -> Effect (Record ReductorProps)
action p@{ treeReload, storage } (Insert nodeId t) = do
action p@{ treeReload, storage } (Insert nodeId t) = do
_ <-
snd treeReload $ (_ + 1)
_ <-
GUR.bump treeReload
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
let newStorage = Map.alter (maybe (Just [t]) (\ts -> Just $ A.cons t ts)) nodeId storage
pure $ p { storage = newStorage }
pure $ p { storage = newStorage }
action p (Finish nodeId t) = do
action p (Finish nodeId t) = do
action p (Remove nodeId t)
action p (Remove nodeId t)
action p@{ appReload, treeReload, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
action p@{ appReload, treeReload, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
_ <- if GT.asyncTaskTriggersAppReload typ then
_ <- if GT.asyncTaskTriggersAppReload typ then
snd appReload $ (_ + 1)
GUR.bump appReload
else
else
pure unit
pure unit
_ <- if GT.asyncTaskTriggersTreeReload typ then
_ <- if GT.asyncTaskTriggersTreeReload typ then
snd treeReload $ (_ + 1)
GUR.bump treeReload
else
else
pure unit
pure unit
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
...
...
src/Gargantext/Components/App.purs
View file @
61f55710
...
@@ -30,6 +30,7 @@ import Gargantext.Routes (AppRoute(..))
...
@@ -30,6 +30,7 @@ import Gargantext.Routes (AppRoute(..))
import Gargantext.Sessions (useSessions)
import Gargantext.Sessions (useSessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.App"
thisModule = "Gargantext.Components.App"
...
@@ -48,12 +49,12 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
...
@@ -48,12 +49,12 @@ appCpt = R.hooksComponentWithModule thisModule "app" cpt where
route <- useHashRouter router Home
route <- useHashRouter router Home
asyncTasksRef <- R.useRef Nothing
asyncTasksRef <- R.useRef Nothing
treeReloadRef <-
R.useRef Nothing
treeReloadRef <-
GUR.newI
showLogin <- R.useState' false
showLogin <- R.useState' false
backend <- R.useState' Nothing
backend <- R.useState' Nothing
appReload <-
R.useState' 0
appReload <-
GUR.new
showCorpus <- R.useState' false
showCorpus <- R.useState' false
...
...
src/Gargantext/Components/DocsTable.purs
View file @
61f55710
...
@@ -36,11 +36,12 @@ import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse
...
@@ -36,11 +36,12 @@ import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..),
ReloadS,
TableResult, TabSubType, TabType, showTabType')
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..), TableResult, TabSubType, TabType, showTabType')
import Gargantext.Utils (sortWith)
import Gargantext.Utils (sortWith)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.DocsTable"
thisModule = "Gargantext.Components.DocsTable"
...
@@ -415,7 +416,7 @@ type DocChooser = (
...
@@ -415,7 +416,7 @@ type DocChooser = (
, nodeId :: NodeID
, nodeId :: NodeID
, selected :: Boolean
, selected :: Boolean
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record SidePanelTriggers
, tableReload :: ReloadS
, tableReload ::
GUR.
ReloadS
)
)
docChooser :: R2.Component DocChooser
docChooser :: R2.Component DocChooser
...
@@ -432,7 +433,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
...
@@ -432,7 +433,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
, nodeId
, nodeId
, selected
, selected
, sidePanelTriggers: { triggerAnnotatedDocIdChange }
, sidePanelTriggers: { triggerAnnotatedDocIdChange }
, tableReload
: (_ /\ setReload)
} _ = do
, tableReload } _ = do
let eyeClass = if selected then "fa-eye" else "fa-eye-slash"
let eyeClass = if selected then "fa-eye" else "fa-eye-slash"
...
@@ -446,7 +447,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
...
@@ -446,7 +447,7 @@ docChooserCpt = R.hooksComponentWithModule thisModule "docChooser" cpt
-- log2 "[docChooser] onClick, corpusId" corpusId
-- log2 "[docChooser] onClick, corpusId" corpusId
-- log2 "[docChooser] onClick, nodeId" nodeId
-- log2 "[docChooser] onClick, nodeId" nodeId
R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
R2.callTrigger triggerAnnotatedDocIdChange { corpusId, listId, nodeId }
setReload $ (_ + 1)
GUR.bump tableReload
newtype SearchQuery = SearchQuery {
newtype SearchQuery = SearchQuery {
...
...
src/Gargantext/Components/Forest.purs
View file @
61f55710
...
@@ -17,14 +17,15 @@ import Gargantext.Ends (Frontends, Backend(..))
...
@@ -17,14 +17,15 @@ import Gargantext.Ends (Frontends, Backend(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (AppRoute)
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Types (
Reload, ReloadS,
Handed(..))
import Gargantext.Types (Handed(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Forest"
thisModule = "Gargantext.Components.Forest"
type Props = (
type Props = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, currentRoute :: AppRoute
...
@@ -32,7 +33,7 @@ type Props = (
...
@@ -32,7 +33,7 @@ type Props = (
, handed :: Handed
, handed :: Handed
, sessions :: Sessions
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, showLogin :: R.Setter Boolean
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
forest :: R2.Component Props
forest :: R2.Component Props
...
@@ -51,16 +52,14 @@ forest = R.createElement forestCpt
...
@@ -51,16 +52,14 @@ forest = R.createElement forestCpt
, showLogin
, showLogin
, treeReloadRef } _ = do
, treeReloadRef } _ = do
-- NOTE: this is a hack to reload the tree view on demand
-- NOTE: this is a hack to reload the tree view on demand
reload <-
R.useState' (0 :: Reload)
reload <-
GUR.new
asyncTasks <- GAT.useTasks appReload reload
asyncTasks <- GAT.useTasks appReload reload
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: OpenNodes)
openNodes <- R2.useLocalStorageState R2.openNodesKey (Set.empty :: OpenNodes)
-- TODO If `treeReloadRef` is set, `reload` state should be updated
-- TODO If `treeReloadRef` is set, `reload` state should be updated
R.useEffect' $ do
R.useEffect' $ do
R.setRef asyncTasksRef $ Just asyncTasks
R.setRef asyncTasksRef $ Just asyncTasks
case R.readRef treeReloadRef of
GUR.initializeI treeReloadRef reload
Nothing -> R.setRef treeReloadRef $ Just reload
Just _ -> pure unit
R2.useCache (
R2.useCache (
frontends
frontends
...
@@ -112,7 +111,7 @@ plus handed showLogin backend = H.div { className: "row" } [
...
@@ -112,7 +111,7 @@ plus handed showLogin backend = H.div { className: "row" } [
-------------------------
-------------------------
type ForestLayoutProps = (
type ForestLayoutProps = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend)
, backend :: R.State (Maybe Backend)
, currentRoute :: AppRoute
, currentRoute :: AppRoute
...
@@ -120,7 +119,7 @@ type ForestLayoutProps = (
...
@@ -120,7 +119,7 @@ type ForestLayoutProps = (
, handed :: R.State Handed
, handed :: R.State Handed
, sessions :: Sessions
, sessions :: Sessions
, showLogin :: R.Setter Boolean
, showLogin :: R.Setter Boolean
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
forestLayout :: R2.Component ForestLayoutProps
forestLayout :: R2.Component ForestLayoutProps
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
61f55710
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
61f55710
...
@@ -36,13 +36,14 @@ import Gargantext.Types (Name, ID)
...
@@ -36,13 +36,14 @@ import Gargantext.Types (Name, ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Forest.Tree.Node"
thisModule = "Gargantext.Components.Forest.Tree.Node"
-- Main Node
-- Main Node
type NodeMainSpanProps = (
type NodeMainSpanProps = (
appReload :: G
T
.ReloadS
appReload :: G
UR
.ReloadS
, asyncTasks :: GAT.Reductor
, asyncTasks :: GAT.Reductor
, currentRoute :: Routes.AppRoute
, currentRoute :: Routes.AppRoute
, folderOpen :: R.State Boolean
, folderOpen :: R.State Boolean
...
@@ -151,7 +152,7 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
...
@@ -151,7 +152,7 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
where
where
onTaskFinish id t _ = do
onTaskFinish id t _ = do
dispatchAsyncTasks $ GAT.Finish id t
dispatchAsyncTasks $ GAT.Finish id t
snd appReload $ (_ + 1)
GUR.bump appReload
SettingsBox {show: showBox} = settingsBox nodeType
SettingsBox {show: showBox} = settingsBox nodeType
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
onPopoverClose popoverRef _ = Popover.setOpen popoverRef false
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
61f55710
...
@@ -37,6 +37,7 @@ import Gargantext.Sessions (Session, Sessions, get)
...
@@ -37,6 +37,7 @@ import Gargantext.Sessions (Session, Sessions, get)
import Gargantext.Types as Types
import Gargantext.Types as Types
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.GraphExplorer"
thisModule = "Gargantext.Components.GraphExplorer"
...
@@ -55,7 +56,7 @@ type LayoutProps = (
...
@@ -55,7 +56,7 @@ type LayoutProps = (
type Props =
type Props =
( graph :: SigmaxT.SGraph
( graph :: SigmaxT.SGraph
, graphVersion ::
Types
.ReloadS
, graphVersion ::
GUR
.ReloadS
, hyperdataGraph :: GET.HyperdataGraph
, hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData
, mMetaData :: Maybe GET.MetaData
| LayoutProps
| LayoutProps
...
@@ -69,10 +70,10 @@ explorerLayoutCpt :: R.Component LayoutProps
...
@@ -69,10 +70,10 @@ explorerLayoutCpt :: R.Component LayoutProps
explorerLayoutCpt = R.hooksComponentWithModule thisModule "explorerLayout" cpt
explorerLayoutCpt = R.hooksComponentWithModule thisModule "explorerLayout" cpt
where
where
cpt props _ = do
cpt props _ = do
graphVersion <-
R.useState' 0
graphVersion <-
GUR.new
pure $ explorerLayoutView graphVersion props
pure $ explorerLayoutView graphVersion props
explorerLayoutView ::
Types
.ReloadS -> Record LayoutProps -> R.Element
explorerLayoutView ::
GUR
.ReloadS -> Record LayoutProps -> R.Element
explorerLayoutView graphVersion p = R.createElement el p []
explorerLayoutView graphVersion p = R.createElement el p []
where
where
el = R.hooksComponentWithModule thisModule "explorerLayoutView" cpt
el = R.hooksComponentWithModule thisModule "explorerLayoutView" cpt
...
@@ -115,15 +116,15 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
...
@@ -115,15 +116,15 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
dataRef <- R.useRef graph
dataRef <- R.useRef graph
graphRef <- R.useRef null
graphRef <- R.useRef null
graphVersionRef
<- R.useRef (fst
graphVersion)
graphVersionRef
<- R.useRef (GUR.value
graphVersion)
treeReload <-
R.useState' 0
treeReload <-
GUR.new
treeReloadRef <-
R.useRef $ Just
treeReload
treeReloadRef <-
GUR.newIInitialized
treeReload
controls <- Controls.useGraphControls { forceAtlasS
controls <- Controls.useGraphControls { forceAtlasS
, graph
, graph
, graphId
, graphId
, hyperdataGraph
, hyperdataGraph
, session
, session
, treeReload: \_ -> (snd treeReload) $ (+) 1
, treeReload: \_ -> GUR.bump treeReload
}
}
multiSelectEnabledRef <- R.useRef $ fst controls.multiSelectEnabled
multiSelectEnabledRef <- R.useRef $ fst controls.multiSelectEnabled
...
@@ -137,7 +138,7 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
...
@@ -137,7 +138,7 @@ explorerCpt = R.hooksComponentWithModule thisModule "explorer" cpt
let rSigma = R.readRef controls.sigmaRef
let rSigma = R.readRef controls.sigmaRef
Sigmax.cleanupSigma rSigma "explorerCpt"
Sigmax.cleanupSigma rSigma "explorerCpt"
R.setRef dataRef graph
R.setRef dataRef graph
R.setRef graphVersionRef (
fst
graphVersion)
R.setRef graphVersionRef (
GUR.value
graphVersion)
-- Reinitialize bunch of state as well.
-- Reinitialize bunch of state as well.
snd controls.removedNodeIds $ const SigmaxT.emptyNodeIds
snd controls.removedNodeIds $ const SigmaxT.emptyNodeIds
snd controls.selectedNodeIds $ const SigmaxT.emptyNodeIds
snd controls.selectedNodeIds $ const SigmaxT.emptyNodeIds
...
@@ -246,23 +247,23 @@ type TreeProps =
...
@@ -246,23 +247,23 @@ type TreeProps =
, currentRoute :: AppRoute
, currentRoute :: AppRoute
, frontends :: Frontends
, frontends :: Frontends
, handed :: Types.Handed
, handed :: Types.Handed
, reload ::
Types
.ReloadS
, reload ::
GUR
.ReloadS
, sessions :: Sessions
, sessions :: Sessions
, show :: Boolean
, show :: Boolean
, showLogin :: R.Setter Boolean
, showLogin :: R.Setter Boolean
, treeReloadRef ::
R.Ref (Maybe Types.ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
type MSidebarProps =
type MSidebarProps =
( frontends :: Frontends
( frontends :: Frontends
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphId :: GET.GraphId
, graphId :: GET.GraphId
, graphVersion ::
Types
.ReloadS
, graphVersion ::
GUR
.ReloadS
, removedNodeIds :: R.State SigmaxT.NodeIds
, removedNodeIds :: R.State SigmaxT.NodeIds
, showSidePanel :: R.State GET.SidePanelState
, showSidePanel :: R.State GET.SidePanelState
, selectedNodeIds :: R.State SigmaxT.NodeIds
, selectedNodeIds :: R.State SigmaxT.NodeIds
, session :: Session
, session :: Session
, treeReload ::
Types
.ReloadS
, treeReload ::
GUR
.ReloadS
)
)
type GraphProps = (
type GraphProps = (
...
@@ -370,11 +371,11 @@ modeGraphType Types.Sources = "star"
...
@@ -370,11 +371,11 @@ modeGraphType Types.Sources = "star"
modeGraphType Types.Terms = "def"
modeGraphType Types.Terms = "def"
getNodes :: Session ->
Types
.ReloadS -> GET.GraphId -> Aff GET.HyperdataGraph
getNodes :: Session ->
GUR
.ReloadS -> GET.GraphId -> Aff GET.HyperdataGraph
getNodes session
(graphVersion /\ _)
graphId =
getNodes session
graphVersion
graphId =
get session $ NodeAPI Types.Graph
get session $ NodeAPI Types.Graph
(Just graphId)
(Just graphId)
("?version=" <>
show graphVersion
)
("?version=" <>
(show $ GUR.value graphVersion)
)
transformGraph :: Record Controls.Controls -> SigmaxT.SGraph -> SigmaxT.SGraph
transformGraph :: Record Controls.Controls -> SigmaxT.SGraph -> SigmaxT.SGraph
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
61f55710
...
@@ -32,8 +32,9 @@ import Gargantext.Data.Array (mapMaybe)
...
@@ -32,8 +32,9 @@ import Gargantext.Data.Array (mapMaybe)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType,
ReloadS,
TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Types (CTabNgramType, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
thisModule = "Gargantext.Components.GraphExplorer.Sidebar"
thisModule = "Gargantext.Components.GraphExplorer.Sidebar"
...
@@ -42,13 +43,13 @@ type Props =
...
@@ -42,13 +43,13 @@ type Props =
( frontends :: Frontends
( frontends :: Frontends
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphId :: Int
, graphId :: Int
, graphVersion :: ReloadS
, graphVersion ::
GUR.
ReloadS
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, removedNodeIds :: R.State SigmaxT.NodeIds
, removedNodeIds :: R.State SigmaxT.NodeIds
, selectedNodeIds :: R.State SigmaxT.NodeIds
, selectedNodeIds :: R.State SigmaxT.NodeIds
, session :: Session
, session :: Session
, showSidePanel :: R.State GET.SidePanelState
, showSidePanel :: R.State GET.SidePanelState
, treeReload :: ReloadS
, treeReload ::
GUR.
ReloadS
)
)
sidebar :: Record Props -> R.Element
sidebar :: Record Props -> R.Element
...
@@ -204,7 +205,7 @@ type DeleteNodes =
...
@@ -204,7 +205,7 @@ type DeleteNodes =
, nodes :: Array (Record SigmaxT.Node)
, nodes :: Array (Record SigmaxT.Node)
, session :: Session
, session :: Session
, termList :: TermList
, termList :: TermList
, treeReload :: ReloadS
, treeReload ::
GUR.
ReloadS
)
)
deleteNodes :: Record DeleteNodes -> Effect Unit
deleteNodes :: Record DeleteNodes -> Effect Unit
...
@@ -215,7 +216,7 @@ deleteNodes { graphId, metaData, nodes, session, termList, treeReload } = do
...
@@ -215,7 +216,7 @@ deleteNodes { graphId, metaData, nodes, session, termList, treeReload } = do
case mPatch of
case mPatch of
Nothing -> pure unit
Nothing -> pure unit
Just (NTC.Versioned patch) -> do
Just (NTC.Versioned patch) -> do
liftEffect $
snd treeReload $ (+) 1
liftEffect $
GUR.bump treeReload
-- Why is this called delete node?
-- Why is this called delete node?
deleteNode :: TermList
deleteNode :: TermList
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
61f55710
...
@@ -45,10 +45,11 @@ import Gargantext.Components.Nodes.Lists.Types as NT
...
@@ -45,10 +45,11 @@ import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (CTabNgramType, OrderBy(..),
ReloadS,
SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes)
import Gargantext.Types (CTabNgramType, OrderBy(..), SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes)
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
import Gargantext.Utils.Seq (mapMaybe) as Seq
import Gargantext.Utils.Seq (mapMaybe) as Seq
thisModule :: String
thisModule :: String
...
@@ -280,11 +281,11 @@ tableContainerCpt { dispatch
...
@@ -280,11 +281,11 @@ tableContainerCpt { dispatch
type CommonProps = (
type CommonProps = (
afterSync :: Unit -> Aff Unit
afterSync :: Unit -> Aff Unit
, appReload :: ReloadS
, appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, sidePanelTriggers :: Record NT.SidePanelTriggers
, sidePanelTriggers :: Record NT.SidePanelTriggers
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
, withAutoUpdate :: Boolean
, withAutoUpdate :: Boolean
)
)
...
@@ -324,7 +325,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -324,7 +325,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
]
]
, search ]
, search ]
<>
<>
[ T.table { syncResetButton
[ T.table { syncResetButton
: [ syncResetButton ]
, colNames
, colNames
, container: tableContainer { dispatch: performAction
, container: tableContainer { dispatch: performAction
, ngramsChildren
, ngramsChildren
...
@@ -333,7 +334,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -333,7 +334,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
, ngramsTable
, ngramsTable
, path
, path
, tabNgramType
, tabNgramType
, syncResetButton
, syncResetButton
: [ syncResetButton ]
}
}
, params: params /\ setParams -- TODO-LENS
, params: params /\ setParams -- TODO-LENS
, rows: filteredConvertedRows
, rows: filteredConvertedRows
...
@@ -343,13 +344,14 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -343,13 +344,14 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
, ngramsSelection
, ngramsSelection
}
}
}
}
] <> syncResetButton
, syncResetButton ]
where
where
afterSync = chartsAfterSync path' asyncTasksRef nodeId treeReloadRef
syncResetButton = syncResetB
tns (chartsAfterSync path' asyncTasksRef nodeId treeReloadRef)
syncResetButton = syncResetB
uttons { afterSync
ngramsLocalPatch
,
ngramsLocalPatch
performAction
, performAction: performAction <<< CoreAction }
autoUpdate :: Array R.Element
autoUpdate :: Array R.Element
...
@@ -359,12 +361,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
...
@@ -359,12 +361,7 @@ loadedNgramsTableCpt = R.hooksComponentWithModule thisModule "loadedNgramsTable"
{ duration: 5000
{ duration: 5000
, effect: performAction
, effect: performAction
$ CoreAction
$ CoreAction
$ Synchronize { afterSync: chartsAfterSync
$ Synchronize { afterSync }
path'
asyncTasksRef
nodeId
treeReloadRef
}
}
}
]
]
else []
else []
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
61f55710
...
@@ -70,9 +70,7 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -70,9 +70,7 @@ module Gargantext.Components.NgramsTable.Core
-- Reset Button TODO put elsewhere this file is too big
-- Reset Button TODO put elsewhere this file is too big
, SyncResetButtonsProps
, SyncResetButtonsProps
, syncResetButtons
, syncResetButtons
, syncResetButtonsCpt
, chartsAfterSync
, chartsAfterSync
, syncResetBtns
)
)
where
where
...
@@ -136,8 +134,9 @@ import Gargantext.Components.Table.Types as T
...
@@ -136,8 +134,9 @@ import Gargantext.Components.Table.Types as T
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, post, put)
import Gargantext.Sessions (Session, get, post, put)
import Gargantext.Types (AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..)
, ReloadS
)
import Gargantext.Types (AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..))
import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.NgramsTable.Core"
thisModule = "Gargantext.Components.NgramsTable.Core"
...
@@ -1099,10 +1098,10 @@ type SyncResetButtonsProps =
...
@@ -1099,10 +1098,10 @@ type SyncResetButtonsProps =
syncResetButtons :: Record SyncResetButtonsProps -> R.Element
syncResetButtons :: Record SyncResetButtonsProps -> R.Element
syncResetButtons p = R.createElement syncResetButtonsCpt p []
syncResetButtons p = R.createElement syncResetButtonsCpt p []
syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" cpt
where
where
syncResetButtonsCpt :: R.Component SyncResetButtonsProps
syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" cpt
cpt { afterSync, ngramsLocalPatch, performAction } _ = do
cpt { afterSync, ngramsLocalPatch, performAction } _ = do
synchronizing@(s /\ setSynchronizing) <- R.useState' false
synchronizing@(s /\ setSynchronizing) <- R.useState' false
...
@@ -1121,14 +1120,18 @@ syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" c
...
@@ -1121,14 +1120,18 @@ syncResetButtonsCpt = R.hooksComponentWithModule thisModule "syncResetButtons" c
afterSync x
afterSync x
liftEffect $ setSynchronizing $ const false
liftEffect $ setSynchronizing $ const false
pure $ H.div {} [
pure $ H.div { className: "btn-toolbar" }
H.button { className: "btn btn-danger " <> hasChangesClass
[ H.div { className: "btn-group mr-2" }
[ H.button { className: "btn btn-danger " <> hasChangesClass
, on: { click: resetClick }
, on: { click: resetClick }
} [ H.text "Reset" ]
} [ H.text "Reset" ]
, H.button { className: "btn btn-primary " <> hasChangesClass
]
, H.div { className: "btn-group mr-2" }
[ H.button { className: "btn btn-primary " <> hasChangesClass
, on: { click: synchronizeClick }
, on: { click: synchronizeClick }
} [ H.text "Sync" ]
} [ H.text "Sync" ]
]
]
]
type ResetButton = (Unit -> Aff Unit)
type ResetButton = (Unit -> Aff Unit)
...
@@ -1136,14 +1139,6 @@ type ResetButton = (Unit -> Aff Unit)
...
@@ -1136,14 +1139,6 @@ type ResetButton = (Unit -> Aff Unit)
-> (Action -> Effect Unit)
-> (Action -> Effect Unit)
-> Array R.Element
-> Array R.Element
syncResetBtns :: ResetButton
syncResetBtns chartsAfterSync' ngramsLocalPatch performAction = [ syncResetButtons
{ afterSync: chartsAfterSync'
, ngramsLocalPatch
, performAction: performAction <<< CoreAction
}
]
chartsAfterSync :: forall props discard.
chartsAfterSync :: forall props discard.
{ listIds :: Array Int
{ listIds :: Array Int
, nodeId :: Int
, nodeId :: Int
...
@@ -1153,7 +1148,7 @@ chartsAfterSync :: forall props discard.
...
@@ -1153,7 +1148,7 @@ chartsAfterSync :: forall props discard.
}
}
-> R.Ref (Maybe GAT.Reductor)
-> R.Ref (Maybe GAT.Reductor)
-> Int
-> Int
->
R.Ref (Maybe ReloadS)
->
GUR.ReloadWithInitializeRef
-> discard
-> discard
-> Aff Unit
-> Aff Unit
chartsAfterSync path' asyncTasksRef nodeId treeReloadRef _ = do
chartsAfterSync path' asyncTasksRef nodeId treeReloadRef _ = do
...
@@ -1164,11 +1159,7 @@ chartsAfterSync path' asyncTasksRef nodeId treeReloadRef _ = do
...
@@ -1164,11 +1159,7 @@ chartsAfterSync path' asyncTasksRef nodeId treeReloadRef _ = do
Nothing -> log "[chartsAfterSync] asyncTasksRef is Nothing"
Nothing -> log "[chartsAfterSync] asyncTasksRef is Nothing"
Just asyncTasks -> do
Just asyncTasks -> do
snd asyncTasks $ GAT.Insert nodeId task
snd asyncTasks $ GAT.Insert nodeId task
case R.readRef treeReloadRef of
GUR.bumpI treeReloadRef
Nothing -> log "[chartsAfterSync] can't reload tree: ref empty"
Just treeReload -> do
snd treeReload $ (_ + 1)
-- snd appReload $ (_ + 1)
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync :: forall s. CoreParams s -> Aff AsyncTaskWithType
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts.purs
View file @
61f55710
...
@@ -25,8 +25,9 @@ import Gargantext.Hooks.Loader (useLoader)
...
@@ -25,8 +25,9 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==))
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==))
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..)
, ReloadS
)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts"
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts"
...
@@ -150,12 +151,12 @@ listElement :: Array R.Element -> R.Element
...
@@ -150,12 +151,12 @@ listElement :: Array R.Element -> R.Element
listElement = H.li { className: "list-group-item justify-content-between" }
listElement = H.li { className: "list-group-item justify-content-between" }
type LayoutProps = (
type LayoutProps = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
type KeyLayoutProps = (
type KeyLayoutProps = (
...
@@ -189,13 +190,13 @@ userLayoutWithKeyCpt :: R.Component KeyLayoutProps
...
@@ -189,13 +190,13 @@ userLayoutWithKeyCpt :: R.Component KeyLayoutProps
userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey" cpt
userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey" cpt
where
where
cpt { appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
cpt { appReload, asyncTasksRef, frontends, nodeId, session, treeReloadRef } _ = do
reload <-
R.useState' 0
reload <-
GUR.new
cacheState <- R.useState' LT.CacheOn
cacheState <- R.useState' LT.CacheOn
sidePanelTriggers <- LT.emptySidePanelTriggers
sidePanelTriggers <- LT.emptySidePanelTriggers
useLoader {nodeId, reload:
fst
reload, session} getContactWithReload $
useLoader {nodeId, reload:
GUR.value
reload, session} getContactWithReload $
\contactData@{contactNode: Contact {name, hyperdata}} ->
\contactData@{contactNode: Contact {name, hyperdata}} ->
H.ul { className: "col-md-12 list-group" } [
H.ul { className: "col-md-12 list-group" } [
display { title: fromMaybe "no name" name } (contactInfos hyperdata (onUpdateHyperdata reload))
display { title: fromMaybe "no name" name } (contactInfos hyperdata (onUpdateHyperdata reload))
...
@@ -212,11 +213,11 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
...
@@ -212,11 +213,11 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
}
}
]
]
where
where
onUpdateHyperdata :: ReloadS -> HyperdataUser -> Effect Unit
onUpdateHyperdata ::
GUR.
ReloadS -> HyperdataUser -> Effect Unit
onUpdateHyperdata
(_ /\ setReload)
hd = do
onUpdateHyperdata
reload
hd = do
launchAff_ $ do
launchAff_ $ do
_ <- saveContactHyperdata session nodeId hd
_ <- saveContactHyperdata session nodeId hd
liftEffect $
setReload $ (+) 1
liftEffect $
GUR.bump reload
-- | toUrl to get data
-- | toUrl to get data
getContact :: Session -> Int -> Aff ContactData
getContact :: Session -> Int -> Aff ContactData
...
@@ -231,7 +232,7 @@ getContact session id = do
...
@@ -231,7 +232,7 @@ getContact session id = do
-- throwError $ error "Missing default list"
-- throwError $ error "Missing default list"
pure {contactNode, defaultListId: 424242}
pure {contactNode, defaultListId: 424242}
getContactWithReload :: {nodeId :: Int, reload ::
Int
, session :: Session} -> Aff ContactData
getContactWithReload :: {nodeId :: Int, reload ::
GUR.Reload
, session :: Session} -> Aff ContactData
getContactWithReload {nodeId, session} = getContact session nodeId
getContactWithReload {nodeId, session} = getContact session nodeId
saveContactHyperdata :: Session -> Int -> HyperdataUser -> Aff Int
saveContactHyperdata :: Session -> Int -> HyperdataUser -> Aff Int
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
61f55710
...
@@ -20,7 +20,8 @@ import Gargantext.Components.Nodes.Lists.Types as LTypes
...
@@ -20,7 +20,8 @@ import Gargantext.Components.Nodes.Lists.Types as LTypes
import Gargantext.Components.Nodes.Texts.Types as TTypes
import Gargantext.Components.Nodes.Texts.Types as TTypes
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..), NodeID, PTabNgramType(..), ReloadS, TabType(..), TabSubType(..))
import Gargantext.Types (CTabNgramType(..), NodeID, PTabNgramType(..), TabType(..), TabSubType(..))
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs"
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs"
...
@@ -47,7 +48,7 @@ modeTabType' Books = CTabAuthors
...
@@ -47,7 +48,7 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps = (
type TabsProps = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State LTypes.CacheState
, cacheState :: R.State LTypes.CacheState
, contactData :: ContactData
, contactData :: ContactData
...
@@ -55,7 +56,7 @@ type TabsProps = (
...
@@ -55,7 +56,7 @@ type TabsProps = (
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
tabs :: Record TabsProps -> R.Element
tabs :: Record TabsProps -> R.Element
...
@@ -129,7 +130,7 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
...
@@ -129,7 +130,7 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
type NgramsViewTabsProps = (
type NgramsViewTabsProps = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State LTypes.CacheState
, cacheState :: R.State LTypes.CacheState
, defaultListId :: Int
, defaultListId :: Int
...
@@ -137,7 +138,7 @@ type NgramsViewTabsProps = (
...
@@ -137,7 +138,7 @@ type NgramsViewTabsProps = (
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, sidePanelTriggers :: Record LTypes.SidePanelTriggers
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
ngramsView :: Record NgramsViewTabsProps -> R.Element
ngramsView :: Record NgramsViewTabsProps -> R.Element
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
61f55710
...
@@ -26,9 +26,10 @@ import Gargantext.Data.Array as GDA
...
@@ -26,9 +26,10 @@ import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI, Children))
import Gargantext.Routes (SessionRoute(NodeAPI, Children))
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..), AffTableResult
, ReloadS
)
import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Corpus"
thisModule = "Gargantext.Components.Nodes.Corpus"
...
@@ -62,14 +63,14 @@ corpusLayoutWithKeyCpt :: R.Component KeyProps
...
@@ -62,14 +63,14 @@ corpusLayoutWithKeyCpt :: R.Component KeyProps
corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWithKey" cpt
corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWithKey" cpt
where
where
cpt { nodeId, session } _ = do
cpt { nodeId, session } _ = do
reload <-
R.useState' 0
reload <-
GUR.new
useLoader {nodeId, reload:
fst
reload, session} loadCorpusWithReload $
useLoader {nodeId, reload:
GUR.value
reload, session} loadCorpusWithReload $
\corpus -> corpusLayoutView {corpus, nodeId, reload, session}
\corpus -> corpusLayoutView {corpus, nodeId, reload, session}
type ViewProps =
type ViewProps =
( corpus :: NodePoly Hyperdata
( corpus :: NodePoly Hyperdata
, reload :: ReloadS
, reload ::
GUR.
ReloadS
| Props
| Props
)
)
...
@@ -123,15 +124,15 @@ corpusLayoutViewCpt = R.hooksComponentWithModule thisModule "corpusLayoutView" c
...
@@ -123,15 +124,15 @@ corpusLayoutViewCpt = R.hooksComponentWithModule thisModule "corpusLayoutView" c
onClickSave :: forall e. { fields :: R.State FTFieldsWithIndex
onClickSave :: forall e. { fields :: R.State FTFieldsWithIndex
, nodeId :: Int
, nodeId :: Int
, reload :: ReloadS
, reload ::
GUR.
ReloadS
, session :: Session } -> e -> Effect Unit
, session :: Session } -> e -> Effect Unit
onClickSave {fields: (fieldsS /\ _), nodeId, reload
: (_ /\ setReload)
, session} _ = do
onClickSave {fields: (fieldsS /\ _), nodeId, reload, session} _ = do
log2 "[corpusLayoutViewCpt] onClickSave fieldsS" fieldsS
log2 "[corpusLayoutViewCpt] onClickSave fieldsS" fieldsS
launchAff_ do
launchAff_ do
saveCorpus $ { hyperdata: Hyperdata {fields: (\(Tuple _ f) -> f) <$> fieldsS}
saveCorpus $ { hyperdata: Hyperdata {fields: (\(Tuple _ f) -> f) <$> fieldsS}
, nodeId
, nodeId
, session }
, session }
liftEffect $
setReload $ (+) 1
liftEffect $
GUR.bump reload
onClickAdd :: forall e. R.State FTFieldsWithIndex -> e -> Effect Unit
onClickAdd :: forall e. R.State FTFieldsWithIndex -> e -> Effect Unit
onClickAdd (_ /\ setFieldsS) _ = do
onClickAdd (_ /\ setFieldsS) _ = do
...
@@ -173,12 +174,12 @@ fieldsCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldsCodeEditorCpt
...
@@ -173,12 +174,12 @@ fieldsCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldsCodeEditorCpt
fromMaybe fields $
fromMaybe fields $
List.modifyAt idx (\(Tuple _ (Field f)) -> Tuple idx (Field $ f { typ = typ })) fields
List.modifyAt idx (\(Tuple _ (Field f)) -> Tuple idx (Field $ f { typ = typ })) fields
onMoveDown :: ReloadS -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit
onMoveDown ::
GUR.
ReloadS -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit
onMoveDown (_ /\ setMasterKey) (fs /\ setFields) idx _ = do
onMoveDown (_ /\ setMasterKey) (fs /\ setFields) idx _ = do
setMasterKey $ (+) 1
setMasterKey $ (+) 1
setFields $ recomputeIndices <<< (GDA.swapList idx (idx + 1))
setFields $ recomputeIndices <<< (GDA.swapList idx (idx + 1))
onMoveUp :: ReloadS -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit
onMoveUp ::
GUR.
ReloadS -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit
onMoveUp (_ /\ setMasterKey) (_ /\ setFields) idx _ = do
onMoveUp (_ /\ setMasterKey) (_ /\ setFields) idx _ = do
setMasterKey $ (+) 1
setMasterKey $ (+) 1
setFields $ recomputeIndices <<< (GDA.swapList idx (idx - 1))
setFields $ recomputeIndices <<< (GDA.swapList idx (idx - 1))
...
@@ -401,7 +402,7 @@ loadCorpus' :: Record LoadProps -> Aff (NodePoly Hyperdata)
...
@@ -401,7 +402,7 @@ loadCorpus' :: Record LoadProps -> Aff (NodePoly Hyperdata)
loadCorpus' {nodeId, session} = get session $ NodeAPI Corpus (Just nodeId) ""
loadCorpus' {nodeId, session} = get session $ NodeAPI Corpus (Just nodeId) ""
-- Just to make reloading effective
-- Just to make reloading effective
loadCorpusWithReload :: {reload ::
Int
| LoadProps} -> Aff (NodePoly Hyperdata)
loadCorpusWithReload :: {reload ::
GUR.Reload
| LoadProps} -> Aff (NodePoly Hyperdata)
loadCorpusWithReload {nodeId, session} = loadCorpus' {nodeId, session}
loadCorpusWithReload {nodeId, session} = loadCorpus' {nodeId, session}
type SaveProps = (
type SaveProps = (
...
@@ -452,7 +453,7 @@ loadCorpusWithChild { nodeId: childId, session } = do
...
@@ -452,7 +453,7 @@ loadCorpusWithChild { nodeId: childId, session } = do
type LoadWithReloadProps =
type LoadWithReloadProps =
(
(
reload ::
Int
reload ::
GUR.Reload
| LoadProps
| LoadProps
)
)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
61f55710
...
@@ -8,7 +8,7 @@ import Reactix as R
...
@@ -8,7 +8,7 @@ import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.Nodes.Corpus.Chart.Types (
Reload,
Path, Props, MetricsProps, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types (Path, Props, MetricsProps, ReloadPath)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Utils.Crypto (Hash)
import Gargantext.Utils.Crypto (Hash)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
61f55710
...
@@ -64,7 +64,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
...
@@ -64,7 +64,7 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
, series : [seriesBarD1 {name: "Number of publication / year"} $
, series : [seriesBarD1 {name: "Number of publication / year"} $
map (\n -> dataSerie {value: n, itemStyle : itemStyle {color:grey}}) count'] }
map (\n -> dataSerie {value: n, itemStyle : itemStyle {color:grey}}) count'] }
getMetricsHash :: Session ->
Tuple Reload (Record Path)
-> Aff String
getMetricsHash :: Session ->
ReloadPath
-> Aff String
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
get session $ ChartHash { chartType: Histo, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: Histo, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
61f55710
...
@@ -101,7 +101,7 @@ scatterOptions metrics' = Options
...
@@ -101,7 +101,7 @@ scatterOptions metrics' = Options
}
}
--}
--}
getMetricsHash :: Session ->
Tuple Reload (Record Path)
-> Aff String
getMetricsHash :: Session ->
ReloadPath
-> Aff String
getMetricsHash session (_ /\ { corpusId, listId, tabType }) =
getMetricsHash session (_ /\ { corpusId, listId, tabType }) =
get session $ CorpusMetricsHash { listId, tabType } (Just corpusId)
get session $ CorpusMetricsHash { listId, tabType } (Just corpusId)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
61f55710
...
@@ -84,7 +84,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
...
@@ -84,7 +84,7 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
}
}
getMetricsHash :: Session ->
Tuple Reload (Record Path)
-> Aff String
getMetricsHash :: Session ->
ReloadPath
-> Aff String
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
get session $ ChartHash { chartType: ChartPie, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: ChartPie, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
61f55710
...
@@ -56,7 +56,7 @@ scatterOptions nodes = Options
...
@@ -56,7 +56,7 @@ scatterOptions nodes = Options
}
}
getMetricsHash :: Session ->
Tuple Reload (Record Path)
-> Aff String
getMetricsHash :: Session ->
ReloadPath
-> Aff String
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, limit, listId, tabType }) = do
get session $ ChartHash { chartType: ChartTree, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: ChartTree, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
61f55710
...
@@ -5,9 +5,8 @@ import Data.Tuple (Tuple)
...
@@ -5,9 +5,8 @@ import Data.Tuple (Tuple)
import Reactix as R
import Reactix as R
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (ReloadS, TabType)
import Gargantext.Types (TabType)
import Gargantext.Utils.Reload as GUR
type Reload = Int
type Path = (
type Path = (
corpusId :: Int
corpusId :: Int
...
@@ -22,8 +21,8 @@ type Props = (
...
@@ -22,8 +21,8 @@ type Props = (
)
)
type MetricsProps = (
type MetricsProps = (
reload :: ReloadS
reload ::
GUR.
ReloadS
| Props
| Props
)
)
type ReloadPath = Tuple Reload (Record Path)
type ReloadPath = Tuple
GUR.
Reload (Record Path)
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
View file @
61f55710
...
@@ -15,22 +15,23 @@ import Gargantext.Components.Nodes.Corpus.Chart.Types (Path)
...
@@ -15,22 +15,23 @@ import Gargantext.Components.Nodes.Corpus.Chart.Types (Path)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types as T
import Gargantext.Types as T
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule = "Gargantext.Components.Nodes.Corpus.Chart.Utils"
thisModule = "Gargantext.Components.Nodes.Corpus.Chart.Utils"
reloadButtonWrap ::
T
.ReloadS -> R.Element -> R.Element
reloadButtonWrap ::
GUR
.ReloadS -> R.Element -> R.Element
reloadButtonWrap setReload el = H.div {} [
reloadButtonWrap setReload el = H.div {} [
reloadButton setReload
reloadButton setReload
, el
, el
]
]
reloadButton ::
T
.ReloadS -> R.Element
reloadButton ::
GUR
.ReloadS -> R.Element
reloadButton
(_ /\ setReload)
= H.a { className
reloadButton
reloadS
= H.a { className
, on: { click: onClick }
, on: { click: onClick }
, title: "Reload" } []
, title: "Reload" } []
where
where
className = "reload-btn fa fa-refresh"
className = "reload-btn fa fa-refresh"
onClick _ =
setReload $ (_ + 1)
onClick _ =
GUR.bump reloadS
mNgramsTypeFromTabType :: T.TabType -> Maybe T.CTabNgramType
mNgramsTypeFromTabType :: T.TabType -> Maybe T.CTabNgramType
...
@@ -44,7 +45,7 @@ mNgramsTypeFromTabType (T.TabPairing _) = Nothing
...
@@ -44,7 +45,7 @@ mNgramsTypeFromTabType (T.TabPairing _) = Nothing
type ChartUpdateButtonProps = (
type ChartUpdateButtonProps = (
chartType :: T.ChartType
chartType :: T.ChartType
, path :: Record Path
, path :: Record Path
, reload ::
T
.ReloadS
, reload ::
GUR
.ReloadS
, session :: Session
, session :: Session
)
)
...
@@ -56,7 +57,8 @@ chartUpdateButtonCpt = R.hooksComponentWithModule thisModule "chartUpdateButton"
...
@@ -56,7 +57,8 @@ chartUpdateButtonCpt = R.hooksComponentWithModule thisModule "chartUpdateButton"
where
where
cpt { chartType
cpt { chartType
, path: { corpusId, listId, tabType }
, path: { corpusId, listId, tabType }
, reload: (_ /\ setReload), session } _ = do
, reload
, session } _ = do
pure $ H.a { className: "chart-update-button fa fa-database"
pure $ H.a { className: "chart-update-button fa fa-database"
, on: { click: onClick }
, on: { click: onClick }
...
@@ -68,5 +70,5 @@ chartUpdateButtonCpt = R.hooksComponentWithModule thisModule "chartUpdateButton"
...
@@ -68,5 +70,5 @@ chartUpdateButtonCpt = R.hooksComponentWithModule thisModule "chartUpdateButton"
case mNgramsTypeFromTabType tabType of
case mNgramsTypeFromTabType tabType of
Just ngramsType -> do
Just ngramsType -> do
_ <- recomputeChart session chartType ngramsType corpusId listId
_ <- recomputeChart session chartType ngramsType corpusId listId
liftEffect $
setReload $ (_ + 1)
liftEffect $
GUR.bump reload
Nothing -> pure unit
Nothing -> pure unit
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
61f55710
...
@@ -16,8 +16,9 @@ import Gargantext.Components.Nodes.Dashboard.Types as DT
...
@@ -16,8 +16,9 @@ import Gargantext.Components.Nodes.Dashboard.Types as DT
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (NodeID
, ReloadS
)
import Gargantext.Types (NodeID)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule = "Gargantext.Components.Nodes.Corpus.Dashboard"
thisModule = "Gargantext.Components.Nodes.Corpus.Dashboard"
...
@@ -49,27 +50,27 @@ dashboardLayoutWithKeyCpt :: R.Component KeyProps
...
@@ -49,27 +50,27 @@ dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayoutWithKey" cpt
dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayoutWithKey" cpt
where
where
cpt { nodeId, session } _ = do
cpt { nodeId, session } _ = do
reload <-
R.useState' 0
reload <-
GUR.new
useLoader {nodeId, reload:
fst
reload, session} DT.loadDashboardWithReload $
useLoader {nodeId, reload:
GUR.value
reload, session} DT.loadDashboardWithReload $
\dashboardData@{hyperdata: DT.Hyperdata h, parentId} -> do
\dashboardData@{hyperdata: DT.Hyperdata h, parentId} -> do
let { charts } = h
let { charts } = h
dashboardLayoutLoaded { charts
dashboardLayoutLoaded { charts
, corpusId: parentId
, corpusId: parentId
, defaultListId: 0
, defaultListId: 0
, key: show $
fst
reload
, key: show $
GUR.value
reload
, nodeId
, nodeId
, onChange: onChange nodeId reload (DT.Hyperdata h)
, onChange: onChange nodeId reload (DT.Hyperdata h)
, session }
, session }
where
where
onChange :: NodeID -> ReloadS -> DT.Hyperdata -> Array P.PredefinedChart -> Effect Unit
onChange :: NodeID ->
GUR.
ReloadS -> DT.Hyperdata -> Array P.PredefinedChart -> Effect Unit
onChange nodeId'
(_ /\ setReload)
(DT.Hyperdata h) charts = do
onChange nodeId'
reload
(DT.Hyperdata h) charts = do
launchAff_ do
launchAff_ do
DT.saveDashboard { hyperdata: DT.Hyperdata $ h { charts = charts }
DT.saveDashboard { hyperdata: DT.Hyperdata $ h { charts = charts }
, nodeId:nodeId'
, nodeId:nodeId'
, session }
, session }
liftEffect $
setReload $ (+) 1
liftEffect $
GUR.bump reload
type LoadedProps =
type LoadedProps =
( charts :: Array P.PredefinedChart
( charts :: Array P.PredefinedChart
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
61f55710
...
@@ -54,10 +54,10 @@ type DocViewProps = (
...
@@ -54,10 +54,10 @@ type DocViewProps = (
docView :: R2.Component DocViewProps
docView :: R2.Component DocViewProps
docView = R.createElement docViewCpt
docView = R.createElement docViewCpt
docViewCpt :: R.Component DocViewProps
docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
where
where
docViewCpt :: R.Component DocViewProps
docViewCpt = R.hooksComponentWithModule thisModule "docView" cpt
cpt { path
cpt { path
, loaded: loaded@{ ngramsTable: Versioned { data: initTable }, document }
, loaded: loaded@{ ngramsTable: Versioned { data: initTable }, document }
, state: state@({ ngramsVersion: version, ngramsLocalPatch } /\ _)
, state: state@({ ngramsVersion: version, ngramsLocalPatch } /\ _)
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
61f55710
...
@@ -16,9 +16,10 @@ import Gargantext.Hooks.Loader (useLoader)
...
@@ -16,9 +16,10 @@ import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (NodeType(..)
, ReloadS
)
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule = "Gargantext.Components.Nodes.Frame"
thisModule = "Gargantext.Components.Nodes.Frame"
...
@@ -77,14 +78,14 @@ frameLayoutWithKeyCpt :: R.Component KeyProps
...
@@ -77,14 +78,14 @@ frameLayoutWithKeyCpt :: R.Component KeyProps
frameLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "frameLayoutWithKey" cpt
frameLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "frameLayoutWithKey" cpt
where
where
cpt { nodeId, session, nodeType} _ = do
cpt { nodeId, session, nodeType} _ = do
reload <-
R.useState' 0
reload <-
GUR.new
useLoader {nodeId, reload:
fst
reload, session} loadframeWithReload $
useLoader {nodeId, reload:
GUR.value
reload, session} loadframeWithReload $
\frame -> frameLayoutView {frame, nodeId, reload, session, nodeType}
\frame -> frameLayoutView {frame, nodeId, reload, session, nodeType}
type ViewProps =
type ViewProps =
( frame :: NodePoly Hyperdata
( frame :: NodePoly Hyperdata
, reload :: ReloadS
, reload ::
GUR.
ReloadS
| Props
| Props
)
)
...
@@ -120,6 +121,6 @@ loadframe' :: Record LoadProps -> Aff (NodePoly Hyperdata)
...
@@ -120,6 +121,6 @@ loadframe' :: Record LoadProps -> Aff (NodePoly Hyperdata)
loadframe' {nodeId, session} = get session $ NodeAPI Node (Just nodeId) ""
loadframe' {nodeId, session} = get session $ NodeAPI Node (Just nodeId) ""
-- Just to make reloading effective
-- Just to make reloading effective
loadframeWithReload :: {reload ::
Int
| LoadProps} -> Aff (NodePoly Hyperdata)
loadframeWithReload :: {reload ::
GUR.Reload
| LoadProps} -> Aff (NodePoly Hyperdata)
loadframeWithReload {nodeId, session} = loadframe' {nodeId, session}
loadframeWithReload {nodeId, session} = loadframe' {nodeId, session}
src/Gargantext/Components/Nodes/Lists.purs
View file @
61f55710
...
@@ -23,6 +23,7 @@ import Gargantext.Prelude
...
@@ -23,6 +23,7 @@ import Gargantext.Prelude
import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState)
import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists"
thisModule = "Gargantext.Components.Nodes.Lists"
...
@@ -72,12 +73,12 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
...
@@ -72,12 +73,12 @@ topBarCpt = R.hooksComponentWithModule thisModule "topBar" cpt
--------------------------------------------------------
--------------------------------------------------------
type CommonProps = (
type CommonProps = (
appReload :: G
T
.ReloadS
appReload :: G
UR
.ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, sessionUpdate :: Session -> Effect Unit
, sessionUpdate :: Session -> Effect Unit
, treeReloadRef ::
R.Ref (Maybe GT.ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
type Props = (
type Props = (
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
61f55710
...
@@ -23,21 +23,22 @@ import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
...
@@ -23,21 +23,22 @@ import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..),
ReloadS,
TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR
thisModule :: String
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
type Props = (
type Props = (
appReload :: ReloadS
appReload ::
GUR.
ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State CacheState
, cacheState :: R.State CacheState
, corpusData :: CorpusData
, corpusData :: CorpusData
, corpusId :: Int
, corpusId :: Int
, session :: Session
, session :: Session
, sidePanelTriggers :: Record SidePanelTriggers
, sidePanelTriggers :: Record SidePanelTriggers
, treeReloadRef ::
R.Ref (Maybe ReloadS)
, treeReloadRef ::
GUR.ReloadWithInitializeRef
)
)
type PropsWithKey = (
type PropsWithKey = (
...
@@ -98,7 +99,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
...
@@ -98,7 +99,7 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
} _ = do
} _ = do
chartType <- R.useState' Histo
chartType <- R.useState' Histo
chartsReload <-
R.useState' 0
chartsReload <-
GUR.new
pathS <- R.useState' $ NTC.initialPageParams session initialPath.corpusId [initialPath.listId] initialPath.tabType
pathS <- R.useState' $ NTC.initialPageParams session initialPath.corpusId [initialPath.listId] initialPath.tabType
let listId' = fromMaybe defaultListId $ A.head (fst pathS).listIds
let listId' = fromMaybe defaultListId $ A.head (fst pathS).listIds
let path = {
let path = {
...
@@ -133,14 +134,14 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
...
@@ -133,14 +134,14 @@ ngramsViewCpt = R.hooksComponentWithModule thisModule "ngramsView" cpt
]
]
)
)
where
where
afterSync
(_ /\ setChartsReload)
_ = do
afterSync
chartsReload
_ = do
case mNgramsType of
case mNgramsType of
Just ngramsType -> do
Just ngramsType -> do
-- NOTE: No need to recompute chart, after ngrams are sync this
-- NOTE: No need to recompute chart, after ngrams are sync this
-- should be recomputed already
-- should be recomputed already
-- We just refresh it
-- We just refresh it
-- _ <- recomputeChart session chartType ngramsType corpusId listId
-- _ <- recomputeChart session chartType ngramsType corpusId listId
liftEffect $
setChartsReload $ (+) 1
liftEffect $
GUR.bump chartsReload
Nothing -> pure unit
Nothing -> pure unit
tabNgramType = modeTabType mode
tabNgramType = modeTabType mode
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
61f55710
...
@@ -30,7 +30,7 @@ import Gargantext.Components.Tab as Tab
...
@@ -30,7 +30,7 @@ import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session, Sessions, sessionId, getCacheState, setCacheState)
import Gargantext.Sessions (Session, Sessions, sessionId, getCacheState, setCacheState)
import Gargantext.Types (CTabNgramType(..), Handed(..), ListId, NodeID,
ReloadS,
TabSubType(..), TabType(..))
import Gargantext.Types (CTabNgramType(..), Handed(..), ListId, NodeID, TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule :: String
...
...
src/Gargantext/Types.purs
View file @
61f55710
...
@@ -13,11 +13,12 @@ import Data.Maybe (Maybe(..), maybe, fromMaybe)
...
@@ -13,11 +13,12 @@ import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Tuple (fst, snd)
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Prelude
import Prim.Row (class Union)
import Prim.Row (class Union)
import Reactix as R
import Reactix as R
import URI.Query (Query)
import URI.Query (Query)
import Gargantext.Prelude
-------------------------------------------------------------------------
-------------------------------------------------------------------------
data Handed = LeftHanded | RightHanded
data Handed = LeftHanded | RightHanded
...
@@ -28,8 +29,6 @@ instance eqHanded :: Eq Handed where
...
@@ -28,8 +29,6 @@ instance eqHanded :: Eq Handed where
-------------------------------------------------------------------------
-------------------------------------------------------------------------
type ID = Int
type ID = Int
type Name = String
type Name = String
type Reload = Int
type ReloadS = R.State Reload
newtype SessionId = SessionId String
newtype SessionId = SessionId String
type NodeID = Int
type NodeID = Int
...
...
src/Gargantext/Utils/Reload.purs
0 → 100644
View file @
61f55710
module Gargantext.Utils.Reload where
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested((/\))
import Effect (Effect)
import Reactix as R
import Gargantext.Prelude
type Reload = Int
type ReloadS = R.State Reload
type ReloadSRef = R.Ref
new :: R.Hooks ReloadS
new = R.useState' 0
bump :: ReloadS -> Effect Unit
bump (_ /\ setReload) = setReload (_ + 1)
value :: ReloadS -> Reload
value (val /\ _) = val
-- a ReloadS ref that can be initialized later
data ReloadWithInitialize = Initialize | Ready ReloadS
type ReloadWithInitializeRef = R.Ref ReloadWithInitialize
newI :: R.Hooks ReloadWithInitializeRef
newI = R.useRef Initialize
newIInitialized :: ReloadS -> R.Hooks ReloadWithInitializeRef
newIInitialized reload = R.useRef $ Ready reload
initializeI :: ReloadWithInitializeRef -> ReloadS -> Effect Unit
initializeI ref reloadS = case R.readRef ref of
Initialize -> R.setRef ref $ Ready reloadS
Ready _ -> pure unit
bumpI :: ReloadWithInitializeRef -> Effect Unit
bumpI ref = case R.readRef ref of
Initialize -> pure unit
Ready reload -> bump reload
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