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