Commit 2bdf5821 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[refactor] add ReloadS state

parent 7d22a0a8
...@@ -49,8 +49,8 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } }) ...@@ -49,8 +49,8 @@ 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 :: R.State Int appReload :: GT.ReloadS
, treeReload :: R.State Int , treeReload :: GT.ReloadS
, storage :: Storage , storage :: Storage
) )
...@@ -58,7 +58,7 @@ type Reductor = R2.Reductor (Record ReductorProps) Action ...@@ -58,7 +58,7 @@ type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit type ReductorAction = Action -> Effect Unit
type OnFinish = Effect Unit type OnFinish = Effect Unit
useTasks :: R.State Int -> R.State Int -> R.Hooks Reductor useTasks :: GT.ReloadS -> GT.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
......
...@@ -17,14 +17,14 @@ import Gargantext.Ends (Frontends, Backend(..)) ...@@ -17,14 +17,14 @@ 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, Handed(..)) import Gargantext.Types (Reload, ReloadS, Handed(..))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.Forest" thisModule = "Gargantext.Components.Forest"
type Props = ( type Props = (
appReload :: R.State Int appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend) , backend :: R.State (Maybe Backend)
, frontends :: Frontends , frontends :: Frontends
...@@ -32,7 +32,7 @@ type Props = ( ...@@ -32,7 +32,7 @@ type Props = (
, route :: AppRoute , route :: AppRoute
, sessions :: Sessions , sessions :: Sessions
, showLogin :: R.Setter Boolean , showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
forest :: Record Props -> R.Element forest :: Record Props -> R.Element
...@@ -115,7 +115,7 @@ plus handed showLogin backend = H.div { className: handedClass } [ ...@@ -115,7 +115,7 @@ plus handed showLogin backend = H.div { className: handedClass } [
------------------------- -------------------------
type ForestLayoutProps = ( type ForestLayoutProps = (
appReload :: R.State Int appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, backend :: R.State (Maybe Backend) , backend :: R.State (Maybe Backend)
, child :: R.Element , child :: R.Element
...@@ -124,7 +124,7 @@ type ForestLayoutProps = ( ...@@ -124,7 +124,7 @@ type ForestLayoutProps = (
, route :: AppRoute , route :: AppRoute
, sessions :: Sessions , sessions :: Sessions
, showLogin :: R.Setter Boolean , showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
forestLayout :: Record ForestLayoutProps -> R.Element forestLayout :: Record ForestLayoutProps -> R.Element
......
...@@ -42,7 +42,7 @@ thisModule = "Gargantext.Components.Forest.Tree.Node" ...@@ -42,7 +42,7 @@ thisModule = "Gargantext.Components.Forest.Tree.Node"
-- Main Node -- Main Node
type NodeMainSpanProps = ( type NodeMainSpanProps = (
appReload :: R.State Int appReload :: GT.ReloadS
, asyncTasks :: GAT.Reductor , asyncTasks :: GAT.Reductor
, folderOpen :: R.State Boolean , folderOpen :: R.State Boolean
, frontends :: Frontends , frontends :: Frontends
......
...@@ -55,7 +55,7 @@ type LayoutProps = ( ...@@ -55,7 +55,7 @@ type LayoutProps = (
type Props = type Props =
( graph :: SigmaxT.SGraph ( graph :: SigmaxT.SGraph
, graphVersion :: R.State Int , graphVersion :: Types.ReloadS
, hyperdataGraph :: GET.HyperdataGraph , hyperdataGraph :: GET.HyperdataGraph
, mMetaData :: Maybe GET.MetaData , mMetaData :: Maybe GET.MetaData
| LayoutProps | LayoutProps
...@@ -72,7 +72,7 @@ explorerLayoutCpt = R.hooksComponentWithModule thisModule "explorerLayout" cpt ...@@ -72,7 +72,7 @@ explorerLayoutCpt = R.hooksComponentWithModule thisModule "explorerLayout" cpt
graphVersion <- R.useState' 0 graphVersion <- R.useState' 0
pure $ explorerLayoutView graphVersion props pure $ explorerLayoutView graphVersion props
explorerLayoutView :: R.State Int -> Record LayoutProps -> R.Element explorerLayoutView :: Types.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
...@@ -242,23 +242,23 @@ type TreeProps = ...@@ -242,23 +242,23 @@ type TreeProps =
, frontends :: Frontends , frontends :: Frontends
, handed :: Types.Handed , handed :: Types.Handed
, mCurrentRoute :: AppRoute , mCurrentRoute :: AppRoute
, reload :: R.State Int , reload :: Types.ReloadS
, sessions :: Sessions , sessions :: Sessions
, show :: Boolean , show :: Boolean
, showLogin :: R.Setter Boolean , showLogin :: R.Setter Boolean
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe Types.ReloadS)
) )
type MSidebarProps = type MSidebarProps =
( frontends :: Frontends ( frontends :: Frontends
, graph :: SigmaxT.SGraph , graph :: SigmaxT.SGraph
, graphId :: GET.GraphId , graphId :: GET.GraphId
, graphVersion :: R.State Int , graphVersion :: Types.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 :: R.State Int , treeReload :: Types.ReloadS
) )
type GraphProps = ( type GraphProps = (
...@@ -366,7 +366,7 @@ modeGraphType Types.Sources = "star" ...@@ -366,7 +366,7 @@ modeGraphType Types.Sources = "star"
modeGraphType Types.Terms = "def" modeGraphType Types.Terms = "def"
getNodes :: Session -> R.State Int -> GET.GraphId -> Aff GET.HyperdataGraph getNodes :: Session -> Types.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)
......
...@@ -32,7 +32,7 @@ import Gargantext.Data.Array (mapMaybe) ...@@ -32,7 +32,7 @@ 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, TabSubType(..), TabType(..), TermList(..), modeTabType) import Gargantext.Types (CTabNgramType, ReloadS, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
...@@ -42,13 +42,13 @@ type Props = ...@@ -42,13 +42,13 @@ type Props =
( frontends :: Frontends ( frontends :: Frontends
, graph :: SigmaxT.SGraph , graph :: SigmaxT.SGraph
, graphId :: Int , graphId :: Int
, graphVersion :: R.State Int , graphVersion :: 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 :: R.State Int , treeReload :: ReloadS
) )
sidebar :: Record Props -> R.Element sidebar :: Record Props -> R.Element
...@@ -204,7 +204,7 @@ type DeleteNodes = ...@@ -204,7 +204,7 @@ type DeleteNodes =
, nodes :: Array (Record SigmaxT.Node) , nodes :: Array (Record SigmaxT.Node)
, session :: Session , session :: Session
, termList :: TermList , termList :: TermList
, treeReload :: R.State Int , treeReload :: ReloadS
) )
deleteNodes :: Record DeleteNodes -> Effect Unit deleteNodes :: Record DeleteNodes -> Effect Unit
......
...@@ -43,7 +43,7 @@ import Gargantext.Components.Nodes.Lists.Types as NT ...@@ -43,7 +43,7 @@ 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(..), SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes) import Gargantext.Types (CTabNgramType, OrderBy(..), ReloadS, 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
...@@ -280,13 +280,13 @@ tableContainerCpt { dispatch ...@@ -280,13 +280,13 @@ tableContainerCpt { dispatch
-- NEXT -- NEXT
type Props = ( type Props = (
appReload :: R.State Int appReload :: ReloadS
, afterSync :: Unit -> Aff Unit , afterSync :: Unit -> Aff Unit
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, path :: R.State PageParams , path :: R.State PageParams
, state :: R.State State , state :: R.State State
, tabNgramType :: CTabNgramType , tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable , versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean , withAutoUpdate :: Boolean
) )
...@@ -510,7 +510,7 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng ...@@ -510,7 +510,7 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
type MainNgramsTableProps = ( type MainNgramsTableProps = (
afterSync :: Unit -> Aff Unit afterSync :: Unit -> Aff Unit
, appReload :: R.State Int , appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State NT.CacheState , cacheState :: R.State NT.CacheState
, defaultListId :: Int , defaultListId :: Int
...@@ -520,7 +520,7 @@ type MainNgramsTableProps = ( ...@@ -520,7 +520,7 @@ type MainNgramsTableProps = (
, session :: Session , session :: Session
, tabNgramType :: CTabNgramType , tabNgramType :: CTabNgramType
, tabType :: TabType , tabType :: TabType
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
, withAutoUpdate :: Boolean , withAutoUpdate :: Boolean
) )
...@@ -620,11 +620,11 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt ...@@ -620,11 +620,11 @@ mainNgramsTableCpt = R.hooksComponentWithModule thisModule "mainNgramsTable" cpt
type MainNgramsTablePaintProps = ( type MainNgramsTablePaintProps = (
afterSync :: Unit -> Aff Unit afterSync :: Unit -> Aff Unit
, appReload :: R.State Int , appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, path :: PageParams , path :: PageParams
, tabNgramType :: CTabNgramType , tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable , versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean , withAutoUpdate :: Boolean
) )
...@@ -653,11 +653,11 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable ...@@ -653,11 +653,11 @@ mainNgramsTablePaintCpt = R.hooksComponentWithModule thisModule "mainNgramsTable
type MainNgramsTablePaintNoCacheProps = ( type MainNgramsTablePaintNoCacheProps = (
afterSync :: Unit -> Aff Unit afterSync :: Unit -> Aff Unit
, appReload :: R.State Int , appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, pathS :: R.State PageParams , pathS :: R.State PageParams
, tabNgramType :: CTabNgramType , tabNgramType :: CTabNgramType
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
, versioned :: VersionedNgramsTable , versioned :: VersionedNgramsTable
, withAutoUpdate :: Boolean , withAutoUpdate :: Boolean
) )
......
...@@ -25,7 +25,7 @@ import Gargantext.Hooks.Loader (useLoader) ...@@ -25,7 +25,7 @@ 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(..)) import Gargantext.Types (NodeType(..), ReloadS)
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts" thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts"
...@@ -145,12 +145,12 @@ infoRender (Tuple title content) = ...@@ -145,12 +145,12 @@ infoRender (Tuple title content) =
, H.span {} [H.text content] ] , H.span {} [H.text content] ]
type LayoutProps = ( type LayoutProps = (
appReload :: R.State Int appReload :: 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 (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
type KeyLayoutProps = ( type KeyLayoutProps = (
...@@ -204,7 +204,7 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey" ...@@ -204,7 +204,7 @@ userLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "userLayoutWithKey"
} }
] ]
where where
onUpdateHyperdata :: R.State Int -> HyperdataUser -> Effect Unit onUpdateHyperdata :: ReloadS -> HyperdataUser -> Effect Unit
onUpdateHyperdata (_ /\ setReload) hd = do onUpdateHyperdata (_ /\ setReload) hd = do
log2 "[onUpdateHyperdata] hd" hd log2 "[onUpdateHyperdata] hd" hd
launchAff_ $ do launchAff_ $ do
......
...@@ -18,7 +18,7 @@ import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData) ...@@ -18,7 +18,7 @@ import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData)
import Gargantext.Components.Nodes.Lists.Types as NTypes import Gargantext.Components.Nodes.Lists.Types as NTypes
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (TabType(..), TabSubType(..), CTabNgramType(..), PTabNgramType(..)) import Gargantext.Types (ReloadS, TabType(..), TabSubType(..), CTabNgramType(..), PTabNgramType(..))
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs" thisModule = "Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs"
...@@ -45,14 +45,14 @@ modeTabType' Books = CTabAuthors ...@@ -45,14 +45,14 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors modeTabType' Communication = CTabAuthors
type TabsProps = ( type TabsProps = (
appReload :: R.State Int appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State NTypes.CacheState , cacheState :: R.State NTypes.CacheState
, contactData :: ContactData , contactData :: ContactData
, frontends :: Frontends , frontends :: Frontends
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
tabs :: Record TabsProps -> R.Element tabs :: Record TabsProps -> R.Element
...@@ -94,14 +94,14 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt ...@@ -94,14 +94,14 @@ tabsCpt = R.hooksComponentWithModule thisModule "tabs" cpt
type NgramsViewTabsProps = ( type NgramsViewTabsProps = (
appReload :: R.State Int appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State NTypes.CacheState , cacheState :: R.State NTypes.CacheState
, defaultListId :: Int , defaultListId :: Int
, mode :: Mode , mode :: Mode
, nodeId :: Int , nodeId :: Int
, session :: Session , session :: Session
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
ngramsView :: Record NgramsViewTabsProps -> R.Element ngramsView :: Record NgramsViewTabsProps -> R.Element
......
...@@ -26,7 +26,7 @@ import Gargantext.Data.Array as GDA ...@@ -26,7 +26,7 @@ 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) import Gargantext.Types (NodeType(..), AffTableResult, ReloadS)
import Gargantext.Utils.Crypto as Crypto import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -38,8 +38,6 @@ type Props = ...@@ -38,8 +38,6 @@ type Props =
, session :: Session , session :: Session
) )
type Reload = R.State Int
type KeyProps = type KeyProps =
( key :: String ( key :: String
| Props | Props
...@@ -71,7 +69,7 @@ corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWith ...@@ -71,7 +69,7 @@ corpusLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "corpusLayoutWith
type ViewProps = type ViewProps =
( corpus :: NodePoly Hyperdata ( corpus :: NodePoly Hyperdata
, reload :: Reload , reload :: ReloadS
| Props | Props
) )
...@@ -125,7 +123,7 @@ corpusLayoutViewCpt = R.hooksComponentWithModule thisModule "corpusLayoutView" c ...@@ -125,7 +123,7 @@ 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 :: R.State Int , reload :: ReloadS
, session :: Session } -> e -> Effect Unit , session :: Session } -> e -> Effect Unit
onClickSave {fields: (fieldsS /\ _), nodeId, reload: (_ /\ setReload), session} _ = do onClickSave {fields: (fieldsS /\ _), nodeId, reload: (_ /\ setReload), session} _ = do
log2 "[corpusLayoutViewCpt] onClickSave fieldsS" fieldsS log2 "[corpusLayoutViewCpt] onClickSave fieldsS" fieldsS
...@@ -175,12 +173,12 @@ fieldsCodeEditorCpt = R.hooksComponentWithModule thisModule "fieldsCodeEditorCpt ...@@ -175,12 +173,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 :: R.State Int -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit onMoveDown :: 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 :: R.State Int -> R.State FTFieldsWithIndex -> Index -> Unit -> Effect Unit onMoveUp :: 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))
......
...@@ -5,7 +5,7 @@ import Data.Tuple (Tuple) ...@@ -5,7 +5,7 @@ import Data.Tuple (Tuple)
import Reactix as R import Reactix as R
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (TabType) import Gargantext.Types (ReloadS, TabType)
type Reload = Int type Reload = Int
...@@ -22,7 +22,7 @@ type Props = ( ...@@ -22,7 +22,7 @@ type Props = (
) )
type MetricsProps = ( type MetricsProps = (
reload :: R.State Int reload :: ReloadS
| Props | Props
) )
......
...@@ -18,13 +18,13 @@ import Gargantext.Utils.Reactix as R2 ...@@ -18,13 +18,13 @@ import Gargantext.Utils.Reactix as R2
thisModule = "Gargantext.Components.Nodes.Corpus.Chart.Utils" thisModule = "Gargantext.Components.Nodes.Corpus.Chart.Utils"
reloadButtonWrap :: R.State Int -> R.Element -> R.Element reloadButtonWrap :: T.ReloadS -> R.Element -> R.Element
reloadButtonWrap setReload el = H.div {} [ reloadButtonWrap setReload el = H.div {} [
reloadButton setReload reloadButton setReload
, el , el
] ]
reloadButton :: R.State Int -> R.Element reloadButton :: T.ReloadS -> R.Element
reloadButton (_ /\ setReload) = H.a { className reloadButton (_ /\ setReload) = H.a { className
, on: { click: onClick } , on: { click: onClick }
, title: "Reload" } [] , title: "Reload" } []
...@@ -44,7 +44,7 @@ mNgramsTypeFromTabType (T.TabPairing _) = Nothing ...@@ -44,7 +44,7 @@ mNgramsTypeFromTabType (T.TabPairing _) = Nothing
type ChartUpdateButtonProps = ( type ChartUpdateButtonProps = (
chartType :: T.ChartType chartType :: T.ChartType
, path :: Record Path , path :: Record Path
, reload :: R.State Int , reload :: T.ReloadS
, session :: Session , session :: Session
) )
......
...@@ -16,7 +16,7 @@ import Gargantext.Components.Nodes.Dashboard.Types as DT ...@@ -16,7 +16,7 @@ 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) import Gargantext.Types (NodeID, ReloadS)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
thisModule = "Gargantext.Components.Nodes.Corpus.Dashboard" thisModule = "Gargantext.Components.Nodes.Corpus.Dashboard"
...@@ -63,7 +63,7 @@ dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayo ...@@ -63,7 +63,7 @@ dashboardLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "dashboardLayo
, session } , session }
where where
onChange :: NodeID -> R.State Int -> DT.Hyperdata -> Array P.PredefinedChart -> Effect Unit onChange :: NodeID -> ReloadS -> DT.Hyperdata -> Array P.PredefinedChart -> Effect Unit
onChange nodeId' (_ /\ setReload) (DT.Hyperdata h) charts = do onChange nodeId' (_ /\ setReload) (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 }
......
...@@ -16,7 +16,7 @@ import Gargantext.Hooks.Loader (useLoader) ...@@ -16,7 +16,7 @@ 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(..)) import Gargantext.Types (NodeType(..), ReloadS)
import Gargantext.Utils.Argonaut (genericSumEncodeJson) import Gargantext.Utils.Argonaut (genericSumEncodeJson)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
...@@ -54,8 +54,6 @@ type Props = ...@@ -54,8 +54,6 @@ type Props =
, nodeType :: NodeType , nodeType :: NodeType
) )
type Reload = R.State Int
type KeyProps = type KeyProps =
( key :: String ( key :: String
| Props | Props
...@@ -86,7 +84,7 @@ frameLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "frameLayoutWithKe ...@@ -86,7 +84,7 @@ frameLayoutWithKeyCpt = R.hooksComponentWithModule thisModule "frameLayoutWithKe
type ViewProps = type ViewProps =
( frame :: NodePoly Hyperdata ( frame :: NodePoly Hyperdata
, reload :: Reload , reload :: ReloadS
| Props | Props
) )
......
...@@ -18,6 +18,7 @@ import Gargantext.Components.Table as Table ...@@ -18,6 +18,7 @@ import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState) import Gargantext.Sessions (Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
thisModule :: String thisModule :: String
...@@ -26,12 +27,12 @@ thisModule = "Gargantext.Components.Nodes.Lists" ...@@ -26,12 +27,12 @@ thisModule = "Gargantext.Components.Nodes.Lists"
------------------------------------------------------------------------ ------------------------------------------------------------------------
type Props = ( type Props = (
appReload :: R.State Int appReload :: GT.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 (R.State Int)) , treeReloadRef :: R.Ref (Maybe GT.ReloadS)
) )
listsLayout :: Record Props -> R.Element listsLayout :: Record Props -> R.Element
......
...@@ -23,20 +23,20 @@ import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType) ...@@ -23,20 +23,20 @@ import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Lists.Types as NTypes import Gargantext.Components.Nodes.Lists.Types as NTypes
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(..), TabSubType(..), TabType(..), chartTypeFromString, modeTabType) import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), ReloadS, TabSubType(..), TabType(..), chartTypeFromString, modeTabType)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
thisModule :: String thisModule :: String
thisModule = "Gargantext.Components.Nodes.Lists.Tabs" thisModule = "Gargantext.Components.Nodes.Lists.Tabs"
type Props = ( type Props = (
appReload :: R.State Int appReload :: ReloadS
, asyncTasksRef :: R.Ref (Maybe GAT.Reductor) , asyncTasksRef :: R.Ref (Maybe GAT.Reductor)
, cacheState :: R.State NTypes.CacheState , cacheState :: R.State NTypes.CacheState
, corpusData :: CorpusData , corpusData :: CorpusData
, corpusId :: Int , corpusId :: Int
, session :: Session , session :: Session
, treeReloadRef :: R.Ref (Maybe (R.State Int)) , treeReloadRef :: R.Ref (Maybe ReloadS)
) )
type PropsWithKey = ( type PropsWithKey = (
......
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