[NGRAMS-TABLE] loadPage with more params

parent 4a16a891
...@@ -127,12 +127,21 @@ pathUrl c (Tab t o l s) i = ...@@ -127,12 +127,21 @@ pathUrl c (Tab t o l s) i =
pathUrl c (Children n o l s) i = pathUrl c (Children n o l s) i =
pathUrl c (NodeAPI Node) i <> pathUrl c (NodeAPI Node) i <>
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s "/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
pathUrl c (GetNgrams t o l listIds listTypeId) i = pathUrl c (GetNgrams
{ tabType: t
, offset: o
, limit: l
, listIds
, termListFilter: tlf
, termTypeFilter: ttf
, searchQuery: q
}) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsGet t pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsGet t
<> offsetUrl o <> limitUrl l <> listIds' <> listTypeId' <> offsetUrl o <> limitUrl l
where <> foldMap (\x -> "&list=" <> show x) listIds
listIds' = foldMap (\x -> "&list=" <> show x) listIds <> foldMap (\x -> "&listType=" <> show x) tlf
listTypeId' = foldMap (\x -> "&listType=" <> show x) listTypeId <> foldMap (\x -> "&termType=" <> show x) ttf
<> if q == "" then "" else ("&search=" <> q)
pathUrl c (PutNgrams t listid) i = pathUrl c (PutNgrams t listid) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsPut t <> listid' pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgramsPut t <> listid'
where where
...@@ -203,7 +212,16 @@ data Path ...@@ -203,7 +212,16 @@ data Path
= Auth = Auth
| Tab TabType Offset Limit (Maybe OrderBy) | Tab TabType Offset Limit (Maybe OrderBy)
| Children NodeType Offset Limit (Maybe OrderBy) | Children NodeType Offset Limit (Maybe OrderBy)
| GetNgrams TabType Offset Limit (Array ListId) (Maybe TermList) | GetNgrams
{ tabType :: TabType
, offset :: Offset
, limit :: Limit
, orderBy :: Maybe OrderBy
, listIds :: Array ListId
, termListFilter :: Maybe TermList
, termTypeFilter :: Maybe TermType
, searchQuery :: String
}
| PutNgrams TabType (Maybe ListId) | PutNgrams TabType (Maybe ListId)
| NodeAPI NodeType | NodeAPI NodeType
| Search { {-id :: Int | Search { {-id :: Int
......
...@@ -13,7 +13,7 @@ import Thermite (Render, Spec, createClass, defaultPerformAction, simpleSpec) ...@@ -13,7 +13,7 @@ import Thermite (Render, Spec, createClass, defaultPerformAction, simpleSpec)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (PTabNgramType(..), Offset, Limit, End(..), Path(..), TabSubType(..), TabType(..), toUrl) import Gargantext.Config (PTabNgramType(..), Offset, Limit, OrderBy(..), End(..), Path(..), TabSubType(..), TabType(..), toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact) import Gargantext.Pages.Annuaire.User.Contacts.Types (Contact)
...@@ -34,11 +34,19 @@ modeTabType Communication = PTabCommunication ...@@ -34,11 +34,19 @@ modeTabType Communication = PTabCommunication
type Props = NT.Props Contact Mode type Props = NT.Props Contact Mode
-- TODO: Move to Components.NgramsTable -- TODO: Move to Components.NgramsTable?
loadPage :: NT.PageParams -> Aff NT.VersionedNgramsTable loadPage :: NT.PageParams -> Aff NT.VersionedNgramsTable
loadPage {nodeId, listIds, tabType, params: {offset, limit}} = loadPage { nodeId, listIds, termListFilter, termTypeFilter
get $ toUrl Back (GetNgrams tabType offset limit listIds Nothing) (Just nodeId) , searchQuery, tabType, params: {offset, limit, orderBy}} =
-- TODO this ignores orderBy get $ toUrl Back
(GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, termListFilter, termTypeFilter
, searchQuery
})
(Just nodeId)
where
convOrderBy _ = DateAsc -- TODO
-- TODO: Move to Components.NgramsTable? -- TODO: Move to Components.NgramsTable?
ngramsLoaderClass :: Loader.LoaderClass NT.PageParams NT.VersionedNgramsTable ngramsLoaderClass :: Loader.LoaderClass NT.PageParams NT.VersionedNgramsTable
......
...@@ -13,7 +13,7 @@ import Thermite (Render, Spec, createClass, defaultPerformAction, simpleSpec) ...@@ -13,7 +13,7 @@ import Thermite (Render, Spec, createClass, defaultPerformAction, simpleSpec)
import Gargantext.Components.Node (NodePoly) import Gargantext.Components.Node (NodePoly)
import Gargantext.Components.NgramsTable as NT import Gargantext.Components.NgramsTable as NT
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config (CTabNgramType(..), End(..), Offset, Limit, Path(..), TabSubType(..), TabType(..), toUrl) import Gargantext.Config (CTabNgramType(..), End(..), Offset, Limit, OrderBy(..), Path(..), TabSubType(..), TabType(..), toUrl)
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
import Gargantext.Components.Loader as Loader import Gargantext.Components.Loader as Loader
import Gargantext.Pages.Corpus.Tabs.Types (CorpusData) import Gargantext.Pages.Corpus.Tabs.Types (CorpusData)
...@@ -37,9 +37,17 @@ modeTabType Terms = CTabTerms ...@@ -37,9 +37,17 @@ modeTabType Terms = CTabTerms
-- TODO: Move to Components.NgramsTable? -- TODO: Move to Components.NgramsTable?
loadPage :: NT.PageParams -> Aff NT.VersionedNgramsTable loadPage :: NT.PageParams -> Aff NT.VersionedNgramsTable
loadPage {nodeId, listIds, tabType, params: {offset, limit}} = loadPage { nodeId, listIds, termListFilter, termTypeFilter
get $ toUrl Back (GetNgrams tabType offset limit listIds Nothing) (Just nodeId) , searchQuery, tabType, params: {offset, limit, orderBy}} =
-- TODO this ignores orderBy get $ toUrl Back
(GetNgrams { tabType, offset, limit, listIds
, orderBy: convOrderBy <$> orderBy
, termListFilter, termTypeFilter
, searchQuery
})
(Just nodeId)
where
convOrderBy _ = DateAsc -- TODO
-- TODO: Move to Components.NgramsTable? -- TODO: Move to Components.NgramsTable?
ngramsLoaderClass :: Loader.LoaderClass NT.PageParams NT.VersionedNgramsTable ngramsLoaderClass :: Loader.LoaderClass NT.PageParams NT.VersionedNgramsTable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment