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
cd469dce
Commit
cd469dce
authored
Apr 23, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[router] add reloadMainPage box
This is to trigger reloading of main page.
parent
21383650
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
114 additions
and
75 deletions
+114
-75
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+2
-2
Data.purs
src/Gargantext/Components/App/Data.purs
+7
-4
Forest.purs
src/Gargantext/Components/Forest.purs
+20
-9
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+48
-18
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+14
-13
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+2
-2
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+2
-2
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+4
-4
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+2
-2
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+3
-3
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+4
-4
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+2
-2
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+2
-2
Router.purs
src/Gargantext/Components/Router.purs
+2
-0
Types.purs
src/Gargantext/Types.purs
+0
-8
No files found.
src/Gargantext/AsyncTasks.purs
View file @
cd469dce
...
...
@@ -55,8 +55,8 @@ removeTaskFromList ts (GT.AsyncTaskWithType { task: GT.AsyncTask { id: id' } })
A.filter (\(GT.AsyncTaskWithType { task: GT.AsyncTask { id: id'' } }) -> id' /= id'') ts
type ReductorProps = (
reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, storage :: Storage
)
...
...
src/Gargantext/Components/App/Data.purs
View file @
cd469dce
...
...
@@ -20,8 +20,9 @@ type App =
, forestOpen :: OpenNodes
, graphVersion :: T2.Reload
, handed :: Handed
, reloadForest :: Int
, reloadRoot :: Int
, reloadForest :: T2.Reload
, reloadMainPage :: T2.Reload
, reloadRoot :: T2.Reload
, route :: AppRoute
, sessions :: Sessions
, showCorpus :: Boolean
...
...
@@ -41,6 +42,7 @@ emptyApp =
, graphVersion : T2.newReload
, handed : RightHanded
, reloadForest : T2.newReload
, reloadMainPage : T2.newReload
, reloadRoot : T2.newReload
, route : Home
, sessions : Sessions.empty
...
...
@@ -59,8 +61,9 @@ type Boxes =
, forestOpen :: T.Box OpenNodes
, graphVersion :: T2.ReloadS
, handed :: T.Box Handed
, reloadForest :: T.Box T2.Reload
, reloadRoot :: T.Box T2.Reload
, reloadForest :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, route :: T.Box AppRoute
, sessions :: T.Box Sessions
, showCorpus :: T.Box Boolean
...
...
src/Gargantext/Components/Forest.purs
View file @
cd469dce
...
...
@@ -34,14 +34,15 @@ here = R2.here "Gargantext.Components.Forest"
type Common =
( frontends :: Frontends
, handed :: T.Box Handed
, reloadRoot :: T.Box T2.Reload
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, route :: T.Box AppRoute
)
type Props =
( backend :: T.Box (Maybe Backend)
, forestOpen :: T.Box OpenNodes
, reloadForest :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, sessions :: T.Box Sessions
, showLogin :: T.Box Boolean
, showTree :: T.Box Boolean
...
...
@@ -64,6 +65,7 @@ forestCpt = here.component "forest" cpt where
, frontends
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
@@ -103,6 +105,7 @@ forestCpt = here.component "forest" cpt where
, frontends
, handed: handed'
, reload: reloadForest
, reloadMainPage
, reloadRoot
, root: treeId
, route
...
...
@@ -160,7 +163,8 @@ forestLayoutMain = R.createElement forestLayoutMainCpt
forestLayoutMainCpt :: R.Component Props
forestLayoutMainCpt = here.component "forestLayoutMain" cpt where
cpt props children = pure $ forestLayoutRaw props [ mainPage {} children ]
cpt props@{ reloadMainPage } children =
pure $ forestLayoutRaw props [ mainPage { reloadMainPage } children ]
forestLayoutRaw :: R2.Component Props
forestLayoutRaw = R.createElement forestLayoutRawCpt
...
...
@@ -171,6 +175,7 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
, forestOpen
, frontends
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
@@ -190,6 +195,7 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
, forestOpen
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
@@ -197,15 +203,20 @@ forestLayoutRawCpt = here.component "forestLayoutRaw" cpt where
, showLogin
, tasks } []
mainPage :: R2.Component ()
type MainPage =
( reloadMainPage :: T2.ReloadS )
mainPage :: R2.Component MainPage
mainPage = R.createElement mainPageCpt
-- mainPageCpt :: R.Memo ()
-- mainPageCpt = R.memo (here.component "mainPage" cpt) where
mainPageCpt :: R.Component
()
mainPageCpt :: R.Component
MainPage
mainPageCpt = here.component "mainPage" cpt
where
cpt _ children = do
cpt { reloadMainPage } children = do
reloadMainPage' <- T.useLive T.unequal reloadMainPage
pure $ H.div { className: "col-md-10" }
[ H.div { id: "page-wrapper" }
[ H.div { className: "container-fluid" } children ]
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
cd469dce
...
...
@@ -6,7 +6,6 @@ import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Traversable (traverse_, traverse)
import Data.Tuple (snd)
import DOM.Simple.Console (log, log2)
import Effect (Effect)
import Effect.Aff (Aff)
...
...
@@ -47,7 +46,8 @@ here = R2.here "Gargantext.Components.Forest.Tree"
-- Shared by every component here + performAction + nodeSpan
type Universal =
( reloadRoot :: T.Box T2.Reload )
( reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS )
-- Shared by every component here + nodeSpan
type Global =
...
...
@@ -60,7 +60,7 @@ type Global =
-- Shared by every component here
type Common = (
forestOpen :: T.Box OpenNodes
, reload :: T
.Box T2.Reload
, reload :: T
2.ReloadS
| Global
)
...
...
@@ -90,7 +90,7 @@ getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTreeFirstLevel :: Session -> ID -> Aff FTree
getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nodeId) ""
type NodeProps = ( reloadTree :: T
.Box T2.Reload
, session :: Session | Common )
type NodeProps = ( reloadTree :: T
2.ReloadS
, session :: Session | Common )
type TreeProps = ( tree :: FTree | NodeProps )
...
...
@@ -102,25 +102,18 @@ treeCpt = here.component "tree" cpt where
cpt p@{ reload, session, tree: NTree (LNode { id, name, nodeType }) children } _ = do
setPopoverRef <- R.useRef Nothing
folderOpen <- T2.useMemberBox nodeId p.forestOpen
folderOpen' <- T.useLive T.unequal folderOpen
pure $ H.ul { className: ulClass <> " " <> handedClass }
[ H.li { className: childrenClass children }
pure $ H.ul { className: ulClass }
[ H.li { className: childrenClass children' }
[ nodeSpan (nsprops { folderOpen, name, id, nodeType, setPopoverRef, isLeaf })
(renderChildren folderOpen')
[ renderChildren (Record.merge p { childProps: { children', folderOpen, render: tree } } ) [] ]
]
]
where
isLeaf = A.null children
nodeId = mkNodeId session id
ulClass = switchHanded "ml" "mr" p.handed <> "-auto tree"
handedClass = switchHanded "left" "right" p.handed <> "handed"
ulClass = switchHanded "ml left" "mr right" p.handed <> "-auto tree handed"
children' = A.sortWith fTreeID pubChildren
pubChildren = if isPublic nodeType then map (map pub) children else children
renderChildren false = []
renderChildren true = map renderChild children' where
renderChild (NTree (LNode {id: cId}) _) = childLoader props [] where
props = Record.merge nodeProps { id: cId, render: tree }
nodeProps = RecordE.pick p :: Record NodeProps
nsprops extra = Record.merge common extra' where
common = RecordE.pick p :: Record NSCommon
extra' = Record.merge extra { dispatch, reload } where
...
...
@@ -131,10 +124,47 @@ treeCpt = here.component "tree" cpt where
childrenClass [] = "no-children"
childrenClass _ = "with-children"
type ChildrenTreeProps =
( childProps :: { children' :: Array FTree
, folderOpen :: T.Box Boolean
, render :: R2.Leaf TreeProps }
| TreeProps )
renderChildren :: R2.Component ChildrenTreeProps
renderChildren = R.createElement renderChildrenCpt
renderChildrenCpt :: R.Component ChildrenTreeProps
renderChildrenCpt = here.component "renderChildren" cpt where
cpt p@{ childProps: { folderOpen } } _ = do
folderOpen' <- T.useLive T.unequal folderOpen
if folderOpen' then
pure $ renderTreeChildren p []
else
pure $ H.div {} []
renderTreeChildren :: R2.Component ChildrenTreeProps
renderTreeChildren = R.createElement renderTreeChildrenCpt
renderTreeChildrenCpt :: R.Component ChildrenTreeProps
renderTreeChildrenCpt = here.component "renderTreeChildren" cpt where
cpt p@{ childProps: { children'
, folderOpen
, render } } _ = do
pure $ R.fragment (map renderChild children')
where
nodeProps = RecordE.pick p :: Record NodeProps
renderChild (NTree (LNode {id: cId}) _) = childLoader props [] where
props = Record.merge nodeProps { id: cId, render }
--- The properties tree shares in common with performAction
type PACommon =
( forestOpen :: T.Box OpenNodes
, reloadTree :: T
.Box T2.Reload
, reloadTree :: T
2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
, tree :: FTree
...
...
@@ -155,7 +185,7 @@ childLoaderCpt :: R.Component ChildLoaderProps
childLoaderCpt = here.component "childLoader" cpt where
cpt p@{ render } _ = do
reload <- T.useBox T2.newReload
let reloads = [ reload, p.reload
Tree, p.reloadRoot
]
let reloads = [ reload, p.reload
Root, p.reloadTree
]
cache <- (A.cons p.id) <$> traverse (T.useLive T.unequal) reloads
useLoader cache fetch (paint reload)
where
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
cd469dce
...
...
@@ -51,8 +51,9 @@ type NodeMainSpanProps =
, isLeaf :: IsLeaf
, name :: Name
, nodeType :: GT.NodeType
, reload :: T.Box T2.Reload
, reloadRoot :: T.Box T2.Reload
, reload :: T2.ReloadS
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, route :: T.Box Routes.AppRoute
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, tasks :: T.Box GAT.Storage
...
...
@@ -84,7 +85,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, isLeaf
, name
, nodeType
, reload
, reload
MainPage
, reloadRoot
, route
, session
...
...
@@ -153,7 +154,7 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
T2.reload reloadRoot
else if GAT.asyncTaskTTriggersTreeReload t then do
here.log2 "reloading tree for task" t
T2.reload reload
T2.reload reload
MainPage
else do
here.log2 "task doesn't trigger a reload" t
pure unit
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
cd469dce
...
...
@@ -43,7 +43,7 @@ here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Common = (
graphId :: NodeID
, metaData :: GET.MetaData
, reloadForest :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, removedNodeIds :: T.Box SigmaxT.NodeIds
, selectedNodeIds :: T.Box SigmaxT.NodeIds
, session :: Session
...
...
@@ -313,7 +313,7 @@ type DeleteNodes =
( graphId :: NodeID
, metaData :: GET.MetaData
, nodes :: Array (Record SigmaxT.Node)
, reloadForest :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, session :: Session
, termList :: TermList
)
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
cd469dce
...
...
@@ -259,8 +259,8 @@ tableContainerCpt { dispatch
type CommonProps = (
afterSync :: Unit -> Aff Unit
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, tabNgramType :: CTabNgramType
, tasks :: T.Box GAT.Storage
, withAutoUpdate :: Boolean
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
cd469dce
...
...
@@ -56,8 +56,8 @@ type TabsProps =
, contactData :: ContactData
, frontends :: Frontends
, nodeId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState
...
...
@@ -133,8 +133,8 @@ ngramsViewCpt = here.component "ngramsView" cpt where
type NTCommon =
( cacheState :: T.Box LTypes.CacheState
, defaultListId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
)
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
cd469dce
...
...
@@ -154,8 +154,8 @@ listElement = H.li { className: "list-group-item justify-content-between" }
type LayoutNoSessionProps =
( frontends :: Frontends
, nodeId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, sidePanel :: T.Box (Maybe (Record TT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
cd469dce
...
...
@@ -148,8 +148,8 @@ type BasicProps =
)
type ReloadProps =
( reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
( reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
| BasicProps
)
...
...
@@ -228,7 +228,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
, reloadRoot
, tasks } ]
where
onUpdateHyperdata :: T
.Box T2.Reload
-> HyperdataContact -> Effect Unit
onUpdateHyperdata :: T
2.ReloadS
-> HyperdataContact -> Effect Unit
onUpdateHyperdata reload hd =
launchAff_ $
saveContactHyperdata session nodeId hd *> liftEffect (T2.reload reload)
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
cd469dce
...
...
@@ -53,8 +53,8 @@ type TabsProps = (
, contactData :: ContactData'
, frontends :: Frontends
, nodeId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, session :: Session
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
, sidePanelState :: T.Box SidePanelState
...
...
@@ -134,8 +134,8 @@ type NgramsViewTabsProps = (
, defaultListId :: Int
, mode :: Mode
, nodeId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
)
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
cd469dce
...
...
@@ -40,8 +40,8 @@ listsWithSessionContextCpt = here.component "listsWithSessionContext" cpt where
type CommonPropsNoSession =
( nodeId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, sessionUpdate :: Session -> Effect Unit
, sidePanel :: T.Box (Maybe (Record SidePanel))
, sidePanelState :: T.Box GT.SidePanelState
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
cd469dce
...
...
@@ -37,8 +37,8 @@ type Props = (
cacheState :: T.Box CacheState
, corpusData :: CorpusData
, corpusId :: Int
, reloadForest :: T
.Box T2.Reload
, reloadRoot :: T
.Box T2.Reload
, reloadForest :: T
2.ReloadS
, reloadRoot :: T
2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
)
...
...
src/Gargantext/Components/Router.purs
View file @
cd469dce
...
...
@@ -148,6 +148,7 @@ forestCpt = here.component "forest" cpt where
, forestOpen
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
@@ -162,6 +163,7 @@ forestCpt = here.component "forest" cpt where
, frontends: defaultFrontends
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
...
...
src/Gargantext/Types.purs
View file @
cd469dce
...
...
@@ -644,14 +644,6 @@ asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
asyncTaskTypePath UpdateNode = "update/"
asyncTaskTypePath UploadFile = "async/file/add/"
asyncTaskTriggersAppReload :: AsyncTaskType -> Boolean
asyncTaskTriggersAppReload _ = true
asyncTaskTriggersTreeReload :: AsyncTaskType -> Boolean
asyncTaskTriggersTreeReload Form = true
asyncTaskTriggersTreeReload UploadFile = true
asyncTaskTriggersTreeReload _ = false
type AsyncTaskID = String
...
...
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