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
b42e73e8
Commit
b42e73e8
authored
May 06, 2019
by
James Laver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Plumbed list id into docs table
parent
38ab9629
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
20 deletions
+32
-20
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+14
-9
Specs.purs
src/Gargantext/Pages/Annuaire/User/Contacts/Tabs/Specs.purs
+5
-2
Specs.purs
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
+13
-9
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
b42e73e8
...
@@ -52,6 +52,7 @@ type Props =
...
@@ -52,6 +52,7 @@ type Props =
, totalRecords :: Int
, totalRecords :: Int
, chart :: ReactElement
, chart :: ReactElement
, tabType :: TabType
, tabType :: TabType
, listId :: Int
-- ^ tabType is not ideal here since it is too much entangled with tabs and
-- ^ tabType is not ideal here since it is too much entangled with tabs and
-- ngramtable. Let's see how this evolves.
-- ngramtable. Let's see how this evolves.
}
}
...
@@ -177,7 +178,7 @@ layoutDocview = simpleSpec performAction render
...
@@ -177,7 +178,7 @@ layoutDocview = simpleSpec performAction render
(_documentIdsDeleted <>~ documentIdsToDelete)
(_documentIdsDeleted <>~ documentIdsToDelete)
render :: Render State Props Action
render :: Render State Props Action
render dispatch {nodeId, tabType, totalRecords, chart} deletionState _ =
render dispatch {nodeId, tabType,
listId,
totalRecords, chart} deletionState _ =
[ {- br'
[ {- br'
, div [ style {textAlign : "center"}] [ text " Filter "
, div [ style {textAlign : "center"}] [ text " Filter "
, input [className "form-control", style {width : "120px", display : "inline-block"}, placeholder "Filter here"]
, input [className "form-control", style {width : "120px", display : "inline-block"}, placeholder "Filter here"]
...
@@ -190,7 +191,8 @@ layoutDocview = simpleSpec performAction render
...
@@ -190,7 +191,8 @@ layoutDocview = simpleSpec performAction render
[ chart
[ chart
, div [className "col-md-12"]
, div [className "col-md-12"]
[ pageLoader
[ pageLoader
{ path: initialPageParams {nodeId, tabType}
{ path: initialPageParams {nodeId, tabType, listId}
, listId
, totalRecords
, totalRecords
, deletionState
, deletionState
, dispatch
, dispatch
...
@@ -211,13 +213,14 @@ layoutDocview = simpleSpec performAction render
...
@@ -211,13 +213,14 @@ layoutDocview = simpleSpec performAction render
mock :: Boolean
mock :: Boolean
mock = false
mock = false
type PageParams = {nodeId :: Int, tabType :: TabType, params :: T.Params}
type PageParams = {nodeId :: Int,
listId :: Int,
tabType :: TabType, params :: T.Params}
initialPageParams :: {nodeId :: Int, tabType :: TabType} -> PageParams
initialPageParams :: {nodeId :: Int, listId :: Int, tabType :: TabType} -> PageParams
initialPageParams {nodeId, tabType} = {nodeId, tabType, params: T.initialParams}
initialPageParams {nodeId, listId, tabType} =
{nodeId, tabType, listId, params: T.initialParams}
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage :: PageParams -> Aff (Array DocumentsView)
loadPage {nodeId, tabType, params: {limit, offset, orderBy}} = do
loadPage {nodeId, tabType,
listId,
params: {limit, offset, orderBy}} = do
logs "loading documents page: loadPage with Offset and limit"
logs "loading documents page: loadPage with Offset and limit"
res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
res <- get $ toUrl Back (Tab tabType offset limit (convOrderBy <$> orderBy)) (Just nodeId)
let docs = res2corpus <$> res
let docs = res2corpus <$> res
...
@@ -250,24 +253,26 @@ type PageLoaderProps row =
...
@@ -250,24 +253,26 @@ type PageLoaderProps row =
, totalRecords :: Int
, totalRecords :: Int
, dispatch :: Action -> Effect Unit
, dispatch :: Action -> Effect Unit
, deletionState :: State
, deletionState :: State
, listId :: Int
| row
| row
}
}
renderPage :: forall props path.
renderPage :: forall props path.
Render (Loader.State {nodeId :: Int, tabType :: TabType | path} (Array DocumentsView))
Render (Loader.State {nodeId :: Int,
listId :: Int,
tabType :: TabType | path} (Array DocumentsView))
{ totalRecords :: Int
{ totalRecords :: Int
, dispatch :: Action -> Effect Unit
, dispatch :: Action -> Effect Unit
, deletionState :: State
, deletionState :: State
, listId :: Int
| props
| props
}
}
(Loader.Action PageParams)
(Loader.Action PageParams)
renderPage _ _ {loaded: Nothing} _ = [] -- TODO loading spinner
renderPage _ _ {loaded: Nothing} _ = [] -- TODO loading spinner
renderPage loaderDispatch { totalRecords, dispatch
renderPage loaderDispatch { totalRecords, dispatch
, listId
, deletionState: {documentIdsToDelete, documentIdsDeleted, localFavorites}}
, deletionState: {documentIdsToDelete, documentIdsDeleted, localFavorites}}
{currentPath: {nodeId, tabType}, loaded: Just res} _ =
{currentPath: {nodeId, tabType}, loaded: Just res} _ =
[ T.tableElt
[ T.tableElt
{ rows
{ rows
, setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType, params})
, setParams: \params -> liftEffect $ loaderDispatch (Loader.SetPath {nodeId, tabType,
listId,
params})
, container: T.defaultContainer { title: "Documents" }
, container: T.defaultContainer { title: "Documents" }
, colNames:
, colNames:
T.ColumnName <$>
T.ColumnName <$>
...
...
src/Gargantext/Pages/Annuaire/User/Contacts/Tabs/Specs.purs
View file @
b42e73e8
...
@@ -44,8 +44,11 @@ statefulTabs =
...
@@ -44,8 +44,11 @@ statefulTabs =
where
where
chart = mempty
chart = mempty
-- TODO totalRecords
-- TODO totalRecords
docs = cmapProps (\{path: nodeId} ->
docs = cmapProps (\{path: nodeId, loaded} ->
{nodeId, chart, tabType: TabPairing TabDocs, totalRecords: 4736}) $
{ nodeId, chart
, tabType: TabPairing TabDocs
, totalRecords: 4736
, listId: loaded.defaultListId}) $
noState DT.docViewSpec
noState DT.docViewSpec
ngramsViewSpec :: {mode :: Mode} -> Spec Tab.State Props Tab.Action
ngramsViewSpec :: {mode :: Mode} -> Spec Tab.State Props Tab.Action
...
...
src/Gargantext/Pages/Corpus/Tabs/Specs.purs
View file @
b42e73e8
...
@@ -61,16 +61,20 @@ statefulTabs =
...
@@ -61,16 +61,20 @@ statefulTabs =
docs = noState ( cmapProps (\{path: corpusId} -> {corpusId : corpusId, tabType: TabCorpus TabDocs}) histoSpec
docs = noState ( cmapProps (\{path: corpusId} -> {corpusId : corpusId, tabType: TabCorpus TabDocs}) histoSpec
<>
<>
(cmapProps (\{path: nodeId} -> { nodeId : nodeId
(cmapProps (\{path: nodeId, loaded: loaded} ->
{ nodeId : nodeId
, chart : div [][]
, chart : div [][]
, tabType: TabCorpus TabDocs
, tabType: TabCorpus TabDocs
, totalRecords: 4737}) $ noState DT.docViewSpec
, totalRecords: 4737
, listId: loaded.defaultListId}) $ noState DT.docViewSpec
)
)
)
)
trash = cmapProps (\{path: nodeId} -> { nodeId
trash = cmapProps (\{path: nodeId, loaded: loaded} ->
{ nodeId
, chart: div [][]
, chart: div [][]
, tabType: TabCorpus TabTrash
, tabType: TabCorpus TabTrash
, totalRecords: 4736}) $ noState DT.docViewSpec
, totalRecords: 4736
, listId: loaded.defaultListId}) $ noState DT.docViewSpec
ngramsViewSpec :: {mode :: Mode} -> Spec Tab.State Props Tab.Action
ngramsViewSpec :: {mode :: Mode} -> Spec Tab.State Props Tab.Action
...
...
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