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
049ba618
Unverified
Commit
049ba618
authored
Nov 27, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loader: the inner-component is now only mounted when data is loaded (no Maybe)
parent
d1c7c8d9
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
35 deletions
+25
-35
Loader.purs
src/Gargantext/Components/Loader.purs
+12
-7
Annuaire.purs
src/Gargantext/Pages/Annuaire.purs
+2
-6
Corpus.purs
src/Gargantext/Pages/Corpus.purs
+3
-3
Documents.purs
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
+5
-5
NgramsTable.purs
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
+2
-8
Types.purs
src/Gargantext/Pages/Corpus/Tabs/Types.purs
+1
-6
No files found.
src/Gargantext/Components/Loader.purs
View file @
049ba618
...
...
@@ -12,16 +12,18 @@ import Thermite (Render, PerformAction, simpleSpec, modifyState_, createReactSpe
data Action path = ForceReload | SetPath path
type InnerProps
path loaded
=
{
path :: path
, loaded ::
Maybe
loaded
type InnerProps
Row path loaded row
=
(
path :: path
, loaded :: loaded
, dispatch :: Action path -> Effect Unit
, children :: Children
}
| row
)
type InnerProps path loaded row = Record (InnerPropsRow path loaded row)
type PropsRow path loaded row =
( path :: path
, component :: ReactClass (InnerProps path loaded)
, component :: ReactClass (InnerProps path loaded
(children :: Children)
)
| row
)
...
...
@@ -68,7 +70,10 @@ createLoaderClass name loader =
createLoaderClass' name loader render
where
render :: Render (State path loaded) (Props' path loaded) (Action path)
render dispatch {component} {currentPath, loaded} c =
render _ _ {loaded: Nothing} _ =
-- TODO load spinner
[]
render dispatch {component} {currentPath, loaded: Just loaded} c =
[React.createElement component {path: currentPath, loaded, dispatch} c]
{-
...
...
src/Gargantext/Pages/Annuaire.purs
View file @
049ba618
...
...
@@ -25,10 +25,7 @@ import Gargantext.Config.REST (get)
import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact(..), HyperData(..))
------------------------------------------------------------------------------
type Props =
{ path :: Int
, loaded :: Maybe AnnuaireInfo
, dispatch :: Loader.Action Int -> Effect Unit }
type Props = Loader.InnerProps Int AnnuaireInfo ()
data Action
= TabsA Tab.Action
...
...
@@ -82,8 +79,7 @@ loadedAnnuaireSpec :: Spec {} Props Void
loadedAnnuaireSpec = simpleSpec defaultPerformAction render
where
render :: Render {} Props Void
render _ {loaded: Nothing} _ _ = []
render _ {path: nodeId, loaded: Just (annuaireInfo@AnnuaireInfo {name, date})} _ _ =
render _ {path: nodeId, loaded: annuaireInfo@AnnuaireInfo {name, date}} _ _ =
T.renderTableHeaderLayout
{ title: name
, desc: name
...
...
src/Gargantext/Pages/Corpus.purs
View file @
049ba618
...
...
@@ -3,7 +3,7 @@ module Gargantext.Pages.Corpus where
import Data.Either (Either(..))
import Data.Lens (Lens', Prism', lens, prism)
import Data.Maybe (Maybe(..)
,maybe
)
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import React as React
import React (ReactClass, ReactElement)
...
...
@@ -17,7 +17,7 @@ import Gargantext.Components.Loader (createLoaderClass)
import Gargantext.Components.Table as Table
import Gargantext.Config (toUrl, NodeType(..), End(..))
import Gargantext.Config.REST (get)
import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..)
, corpusInfoDefault
)
import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..))
import Gargantext.Pages.Corpus.Tabs.Types (Props) as Tabs
import Gargantext.Pages.Corpus.Tabs.States (State, initialState) as Tabs
import Gargantext.Pages.Corpus.Tabs.Actions (Action) as Tabs
...
...
@@ -77,7 +77,7 @@ corpusHeaderSpec = simpleSpec defaultPerformAction render
, date: date'
, hyperdata : CorpusInfo corpus
}
=
maybe corpusInfoDefault identity
loaded
= loaded
------------------------------------------------------------------------
...
...
src/Gargantext/Pages/Corpus/Tabs/Documents.purs
View file @
049ba618
...
...
@@ -221,16 +221,16 @@ loadPage {nodeId, params: {limit, offset, orderBy}} = do
convOrderBy _ = DateAsc -- TODO
type PageLoaderProps
ext
=
type PageLoaderProps
row
=
{ path :: PageParams
, corpusInfo ::
Maybe (NodePoly CorpusInfo)
, corpusInfo ::
NodePoly CorpusInfo
, dispatch :: Action -> Effect Unit
|
ext
|
row
}
renderPage :: forall props path.
Render (Loader.State {nodeId :: Int | path} (Array DocumentsView))
{ corpusInfo ::
Maybe (NodePoly CorpusInfo)
{ corpusInfo ::
NodePoly CorpusInfo
, dispatch :: Action -> Effect Unit
| props
}
...
...
@@ -254,7 +254,7 @@ renderPage loaderDispatch {corpusInfo, dispatch} {currentPath: {nodeId}, loaded:
((\(NodePoly n) -> n.hyperdata)
>>>
(\(CorpusInfo c) -> c.totalRecords)
<$>
corpusInfo)
<$>
Just corpusInfo) -- TODO
}
]
where
...
...
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
View file @
049ba618
...
...
@@ -54,10 +54,7 @@ type Props = { mode :: Mode | PropsRow }
type PageParams = {nodeId :: Int, params :: T.Params, mode :: Mode}
type Props' = { path :: PageParams
, loaded :: Maybe NgramsTable
, dispatch :: Loader.Action PageParams -> Effect Unit
}
type Props' = Loader.InnerProps PageParams NgramsTable ()
type NgramsTerm = String
...
...
@@ -451,10 +448,7 @@ ngramsTableSpec' = simpleSpec performAction render
}
]
where
ngramsTable =
case applyNgramsTablePatch ngramsTablePatch <$> initTable of
Nothing -> NgramsTable mempty
Just t -> t
ngramsTable = applyNgramsTablePatch ngramsTablePatch initTable
rows = convertRow <$> Map.toUnfoldable (Map.filter displayRow (ngramsTable ^. _NgramsTable))
isRoot (NgramsElement e) = e.parent == Nothing
-- TODO: There is a missing case where we display a row that we should not.
...
...
src/Gargantext/Pages/Corpus/Tabs/Types.purs
View file @
049ba618
...
...
@@ -2,7 +2,6 @@ module Gargantext.Pages.Corpus.Tabs.Types where
import Data.Argonaut (class DecodeJson, decodeJson, (.?), (.??))
import Data.Maybe (Maybe(..))
import Effect (Effect)
--------------------------------------------------------
import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..))
...
...
@@ -45,11 +44,7 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where
pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords}
-- TODO type Props = {nodeId :: Int, info :: Maybe (NodePoly CorpusInfo) }
type PropsRow =
( path :: Int
, loaded :: Maybe (NodePoly CorpusInfo)
, dispatch :: Loader.Action Int -> Effect Unit
)
type PropsRow = Loader.InnerPropsRow Int (NodePoly CorpusInfo) ()
type Props = Record PropsRow
-- TODO include Gargantext.Pages.Corpus.Tabs.States
...
...
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