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
1190af30
Unverified
Commit
1190af30
authored
Nov 12, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NGRAMS] connect components
parent
faa2a272
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
31 deletions
+31
-31
NgramsTable.purs
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
+24
-17
Specs.purs
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
+5
-3
Types.purs
src/Gargantext/Pages/Corpus/Tabs/Types.purs
+2
-1
Layout.purs
src/Gargantext/Pages/Layout.purs
+0
-4
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+0
-3
Router.purs
src/Gargantext/Router.purs
+0
-3
No files found.
src/Gargantext/Pages/Corpus/Tabs/Ngrams/NgramsTable.purs
View file @
1190af30
...
...
@@ -29,6 +29,13 @@ import Gargantext.Config
import Gargantext.Config.REST
import Gargantext.Components.Tree (NTree(..))
import Gargantext.Components.Loader as Loader
import Gargantext.Pages.Corpus.Tabs.Types (CorpusInfo(..), PropsRow)
type Props = { mode :: Mode | PropsRow }
type Props' = { path :: Int
, loaded :: Maybe NgramsTable
}
type NgramsTable = Array (NTree NgramsElement)
...
...
@@ -52,13 +59,9 @@ data Action
| SetTermTypeFilter (Maybe TermType)
| SetSearchQuery String
type Dispatch = Action -> Effect Unit
data Mode = Authors | Sources | Terms
performAction :: PerformAction State {} Action
performAction (SetTermListFilter c) _ _ = modifyState_ $ _ { termListFilter = c }
performAction (SetTermTypeFilter c) _ _ = modifyState_ $ _ { termTypeFilter = c }
performAction (SetSearchQuery s) _ _ = modifyState_ $ _ { searchQuery = s }
performAction (SetTermListItem _i _l) _ _ = pure unit -- TODO
type Dispatch = Action -> Effect Unit
tableContainer :: {searchQuery :: String, dispatch :: Dispatch} -> T.TableContainerProps -> Array ReactElement
tableContainer {searchQuery, dispatch} props =
...
...
@@ -122,20 +125,23 @@ tableContainer {searchQuery, dispatch} props =
]
]
ngramsTableSpec'' = simpleSpec defaultPerformAction (\_ _ _ _ -> [])
ngramsTableSpec' :: Spec State {} Action
ngramsTableSpec' :: Spec State Props' Action
ngramsTableSpec' = simpleSpec performAction render
where
render :: Render State {} Action
render dispatch { {-path: nodeId, loaded-} } {searchQuery {- TODO more state -} } _ =
performAction :: PerformAction State Props' Action
performAction (SetTermListFilter c) _ _ = modifyState_ $ _ { termListFilter = c }
performAction (SetTermTypeFilter c) _ _ = modifyState_ $ _ { termTypeFilter = c }
performAction (SetSearchQuery s) _ _ = modifyState_ $ _ { searchQuery = s }
performAction (SetTermListItem _i _l) _ _ = pure unit -- TODO
render :: Render State Props' Action
render dispatch {path: nodeId, loaded} {searchQuery {- TODO more state -} } _ =
[ T.tableElt
{ loadRows
, container: tableContainer {searchQuery, dispatch}
, colNames:
T.ColumnName <$>
[ "
Map
"
[ "
Graph
"
, "Stop"
, "Terms"
, "Occurences (nb)"
...
...
@@ -189,13 +195,14 @@ ngramsLoaderClass = Loader.createLoaderClass "NgramsLoader" getNgramsTable
ngramsLoader :: Loader.Props Int NgramsTable -> ReactElement
ngramsLoader = React.createLeafElement ngramsLoaderClass
ngramsTableSpec :: Spec {}
{nodeId :: Int}
Void
ngramsTableSpec :: Spec {}
Props
Void
ngramsTableSpec = simpleSpec defaultPerformAction render
where
render :: Render {} {nodeId :: Int} Void
render _ {nodeId} _ _ =
render :: Render {} Props Void
render _ {path: nodeId} _ _ =
-- TODO: ignored mode, ignored loaded: corpusInfo
[ ngramsLoader { path: nodeId
, component: createClass "Layout" ngramsTableSpec'
'
initialState
, component: createClass "Layout" ngramsTableSpec' initialState
} ]
renderNgramsItem :: { ngrams :: String
...
...
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
View file @
1190af30
...
...
@@ -10,7 +10,7 @@ import Gargantext.Pages.Corpus.Tabs.States (State(), _doclens, _ngramsView, _tab
import Gargantext.Pages.Corpus.Tabs.Actions (Action(), _docAction, _NgramViewA, _tabAction)
import Gargantext.Pages.Corpus.Tabs.Documents as DV
import Gargantext.Pages.Corpus.Tabs.Ngrams as NV
import Gargantext.Pages.Corpus.Tabs.Ngrams
.NgramsTable
as NV
import Gargantext.Components.Tab as Tab
import Thermite (Spec, focus, hideState, cmapProps)
...
...
@@ -30,8 +30,10 @@ statefulTabs =
docPageSpec :: Spec State Props Action
docPageSpec = focus _doclens _docAction DV.layoutDocview
ngramsViewSpec :: NV.Props -> Spec State Props Action
ngramsViewSpec props = cmapProps (const props) (focus _ngramsView _NgramViewA NV.ngramsSpec)
ngramsViewSpec :: {mode :: NV.Mode} -> Spec State Props Action
ngramsViewSpec {mode} =
cmapProps (\{loaded, path} -> {mode,loaded,path})
(focus _ngramsView _NgramViewA NV.ngramsTableSpec)
authorPageSpec :: Spec State Props Action
authorPageSpec = ngramsViewSpec {mode: NV.Authors}
...
...
src/Gargantext/Pages/Corpus/Tabs/Types.purs
View file @
1190af30
...
...
@@ -43,7 +43,8 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where
pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords}
-- TODO type Props = {nodeId :: Int, info :: Maybe (NodePoly CorpusInfo) }
type Props = {path :: Int, loaded :: Maybe (NodePoly CorpusInfo) }
type PropsRow = (path :: Int, loaded :: Maybe (NodePoly CorpusInfo))
type Props = Record PropsRow
-- TODO include Gargantext.Pages.Corpus.Tabs.States
-- TODO include Gargantext.Pages.Corpus.Tabs.Actions
src/Gargantext/Pages/Layout.purs
View file @
1190af30
...
...
@@ -59,9 +59,5 @@ dispatchAction dispatcher _ PGraphExplorer = do
dispatcher $ SetRoute PGraphExplorer
dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
dispatchAction dispatcher _ NGramsTable = do
dispatcher $ SetRoute NGramsTable
-- dispatcher $ NgramsA TODO
dispatchAction dispatcher _ Dashboard = do
dispatcher $ SetRoute Dashboard
src/Gargantext/Pages/Layout/Specs.purs
View file @
1190af30
...
...
@@ -64,9 +64,6 @@ pagesComponent s = case s.currentRoute of
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction C.layoutUser
-- To be removed
selectSpec NGramsTable = layout0 $ cmapProps (const {nodeId: i}) $ noState NG.ngramsTableSpec
where i = 0 -- TODO
-- selectSpec _ = simpleSpec defaultPerformAction defaultRender
...
...
src/Gargantext/Router.purs
View file @
1190af30
...
...
@@ -21,7 +21,6 @@ data Routes
| AddCorpus
| Document Int
| PGraphExplorer
| NGramsTable
| Dashboard
| Annuaire Int
| UserPage Int
...
...
@@ -33,7 +32,6 @@ routing =
<|> AddCorpus <$ route "addCorpus"
<|> Folder <$> (route "folder" *> int)
<|> Corpus <$> (route "corpus" *> int)
<|> NGramsTable <$ route "ngrams"
<|> Document <$> (route "document" *> int)
<|> Dashboard <$ route "dashboard"
<|> PGraphExplorer <$ route "graph"
...
...
@@ -54,7 +52,6 @@ instance showRoutes :: Show Routes where
show (UserPage i) = "User" <> show i
show (Document i) = "Document"
show (Corpus i) = "Corpus" <> show i
show NGramsTable = "NGramsTable"
show (Annuaire i) = "Annuaire" <> show i
show (Folder i) = "Folder" <> show i
show Dashboard = "Dashboard"
...
...
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