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
d0ee31c0
Commit
d0ee31c0
authored
Apr 23, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ngramsTable] reloadMainPage and activeTab refresh
parent
cd469dce
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
64 additions
and
41 deletions
+64
-41
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+7
-1
Forest.purs
src/Gargantext/Components/Forest.purs
+4
-9
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+13
-5
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+3
-2
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+3
-2
Tabs.purs
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
+4
-1
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+7
-3
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+11
-10
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+3
-1
Router.purs
src/Gargantext/Components/Router.purs
+2
-0
Tab.purs
src/Gargantext/Components/Tab.purs
+7
-7
No files found.
src/Gargantext/AsyncTasks.purs
View file @
d0ee31c0
...
...
@@ -76,12 +76,18 @@ remove id task storage = T.modify_ newStorage storage
-- When a task is finished: which tasks cause forest or app reload
asyncTaskTriggersAppReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersAppReload GT.UpdateNgramsCharts = true
asyncTaskTriggersAppReload _ = false
asyncTaskTTriggersAppReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersAppReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersAppReload typ
asyncTaskTriggersMainPageReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersMainPageReload GT.UpdateNgramsCharts = true
asyncTaskTriggersMainPageReload _ = false
asyncTaskTTriggersMainPageReload :: GT.AsyncTaskWithType -> Boolean
asyncTaskTTriggersMainPageReload (GT.AsyncTaskWithType { typ }) = asyncTaskTriggersMainPageReload typ
asyncTaskTriggersTreeReload :: GT.AsyncTaskType -> Boolean
asyncTaskTriggersTreeReload GT.Form = true
asyncTaskTriggersTreeReload GT.UploadFile = true
...
...
src/Gargantext/Components/Forest.purs
View file @
d0ee31c0
...
...
@@ -164,7 +164,7 @@ forestLayoutMain = R.createElement forestLayoutMainCpt
forestLayoutMainCpt :: R.Component Props
forestLayoutMainCpt = here.component "forestLayoutMain" cpt where
cpt props@{ reloadMainPage } children =
pure $ forestLayoutRaw props [ mainPage {
reloadMainPage
} children ]
pure $ forestLayoutRaw props [ mainPage {} children ]
forestLayoutRaw :: R2.Component Props
forestLayoutRaw = R.createElement forestLayoutRawCpt
...
...
@@ -203,20 +203,15 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
, showLogin
, tasks } []
type MainPage =
( reloadMainPage :: T2.ReloadS )
mainPage :: R2.Component MainPage
mainPage :: R2.Component ()
mainPage = R.createElement mainPageCpt
-- mainPageCpt :: R.Memo ()
-- mainPageCpt = R.memo (here.component "mainPage" cpt) where
mainPageCpt :: R.Component
MainPage
mainPageCpt :: R.Component
()
mainPageCpt = here.component "mainPage" cpt
where
cpt { reloadMainPage } children = do
reloadMainPage' <- T.useLive T.unequal reloadMainPage
cpt _ children = do
pure $ H.div { className: "col-md-10" }
[ H.div { id: "page-wrapper" }
[ H.div { className: "container-fluid" } children ]
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
d0ee31c0
...
...
@@ -85,6 +85,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, isLeaf
, name
, nodeType
, reload
, reloadMainPage
, reloadRoot
, route
...
...
@@ -152,12 +153,19 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
if GAT.asyncTaskTTriggersAppReload t then do
here.log2 "reloading root for task" t
T2.reload reloadRoot
else if GAT.asyncTaskTTriggersTreeReload t then do
here.log2 "reloading tree for task" t
T2.reload reloadMainPage
else do
here.log2 "task doesn't trigger a reload" t
pure unit
if GAT.asyncTaskTTriggersTreeReload t then do
here.log2 "reloading tree for task" t
T2.reload reload
else do
here.log2 "task doesn't trigger a tree reload" t
pure unit
if GAT.asyncTaskTTriggersMainPageReload t then do
here.log2 "reloading main page for task" t
T2.reload reloadMainPage
else do
here.log2 "task doesn't trigger a main page reload" t
pure unit
-- snd tasks $ GAT.Finish id' t
-- mT <- T.read tasks
-- case mT of
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
d0ee31c0
...
...
@@ -70,8 +70,9 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt where
cpt props _ = do
active <- R.useState' 0
pure $ Tab.tabs { selected: fst active, tabs: tabs' props }
activeTab <- T.useBox 0
pure $ Tab.tabs { activeTab, tabs: tabs' props }
tabs' props@{ sidePanel, sidePanelState } =
[ "Documents" /\ docs
, "Patents" /\ ngramsView (viewProps Patents)
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
d0ee31c0
...
...
@@ -77,8 +77,9 @@ tabsCpt = here.component "tabs" cpt
, sidePanel
, sidePanelState
, reloadForest } _ = do
active <- R.useState' 0
pure $ Tab.tabs { selected: fst active, tabs: tabs' }
activeTab <- T.useBox 0
pure $ Tab.tabs { activeTab, tabs: tabs' }
where
tabs' =
[ "Documents" /\ docs
...
...
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
View file @
d0ee31c0
...
...
@@ -4,6 +4,7 @@ import Prelude hiding (div)
import Data.Array (fromFoldable)
import Data.Tuple (Tuple(..))
import Reactix as R
import Toestand as T
import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
import Gargantext.Components.FacetsTable (docView)
...
...
@@ -32,7 +33,9 @@ tabsCpt :: R.Component Props
tabsCpt = here.component "tabs" cpt
where
cpt {frontends, query, session, sides} _ = do
pure $ Tab.tabs { selected: 0, tabs: tabs' }
activeTab <- T.useBox 0
pure $ Tab.tabs { activeTab, tabs: tabs' }
where
tabs' = fromFoldable $ tab frontends session query <$> sides
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
d0ee31c0
module Gargantext.Components.Nodes.Lists where
import Data.Maybe (Maybe(..))
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (launchAff_)
import Gargantext.AsyncTasks as GAT
...
...
@@ -41,6 +39,7 @@ listsWithSessionContextCpt = here.component "listsWithSessionContext" cpt where
type CommonPropsNoSession =
( nodeId :: Int
, reloadForest :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, sessionUpdate :: Session -> Effect Unit
, sidePanel :: T.Box (Maybe (Record SidePanel))
...
...
@@ -72,12 +71,16 @@ listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
cpt { nodeId
, reloadForest
, reloadMainPage
, reloadRoot
, session
, sessionUpdate
, sidePanel
, sidePanelState
, tasks } _ = do
activeTab <- T.useBox 0
reloadMainPage' <- T.useLive T.unequal reloadMainPage
let path = { nodeId, session }
cacheState <- T.useBox $ getCacheState CacheOn session nodeId
...
...
@@ -101,7 +104,8 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
, title: "Corpus " <> name
, user: authors } []
, Tabs.tabs {
cacheState
activeTab
, cacheState
, corpusData
, corpusId
, key: "listsLayoutWithKey-tabs-" <> (show cacheState')
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
d0ee31c0
...
...
@@ -34,13 +34,14 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists.Tabs"
type Props = (
cacheState :: T.Box CacheState
, corpusData :: CorpusData
, corpusId :: Int
, reloadForest :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
activeTab :: T.Box Int
, cacheState :: T.Box CacheState
, corpusData :: CorpusData
, corpusId :: Int
, reloadForest :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
)
type PropsWithKey = ( key :: String | Props )
...
...
@@ -50,9 +51,9 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component PropsWithKey
tabsCpt = here.component "tabs" cpt where
cpt props _ = do
(selected /\ setSelected) <- R.useState' 0
pure $ Tab.tabs { selected
, tabs: tabs' } where
cpt props
@{ activeTab }
_ = do
pure $ Tab.tabs { activeTab
, tabs: tabs' } where
tabs' = [ "Terms" /\ view Terms []
, "Authors" /\ view Authors []
, "Institutes" /\ view Institutes []
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
d0ee31c0
...
...
@@ -160,8 +160,10 @@ tabsCpt = here.component "tabs" cpt
cpt { cacheState, corpusId, corpusData, frontends, session, sidePanel, sidePanelState } _ = do
let path = initialPath
activeTab <- T.useBox 0
pure $ Tab.tabs {
selected: 0
activeTab
, tabs: [
"Documents" /\ R.fragment [
histo { path, session }
...
...
src/Gargantext/Components/Router.purs
View file @
d0ee31c0
...
...
@@ -352,6 +352,7 @@ listsCpt = here.component "lists" cpt where
, forestOpen
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
@@ -366,6 +367,7 @@ listsCpt = here.component "lists" cpt where
pure $ authed sessionProps $
Lists.listsWithSessionContext { nodeId
, reloadForest
, reloadMainPage
, reloadRoot
, session
, sessionUpdate: \_ -> pure unit
...
...
src/Gargantext/Components/Tab.purs
View file @
d0ee31c0
module Gargantext.Components.Tab where
import Prelude hiding (div)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
...
...
@@ -8,14 +7,16 @@ import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
here :: R2.Here
here = R2.here "Gargantext.Components.Tab"
type TabsProps = (
selected ::
Int
, tabs :: Array (Tuple String R.Element)
activeTab :: T.Box
Int
, tabs
:: Array (Tuple String R.Element)
)
tabs :: R2.Leaf TabsProps
...
...
@@ -24,18 +25,17 @@ tabs props = R.createElement tabsCpt props []
-- this is actually just the list of tabs, not the tab contents itself
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt where
cpt props _ = do
activeTab <- T.useBox props.selected
cpt props@{ activeTab, tabs } _ = do
activeTab' <- T.useLive T.unequal activeTab
pure $ H.div {}
[ H.nav {}
[ H.br {}
, H.div { className: "nav nav-tabs", title: "Search result" }
(mapWithIndex (button activeTab activeTab')
props.
tabs)
(mapWithIndex (button activeTab activeTab') tabs)
]
, H.div { className: "tab-content" }
(mapWithIndex (item activeTab')
props.
tabs)
(mapWithIndex (item activeTab') tabs)
]
button activeTab selected index (name /\ _) =
H.a { className, on: { click } } [ H.text name ] where
...
...
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