From 6d0e4a5ee37dce2987970384c642ca808755aed0 Mon Sep 17 00:00:00 2001 From: Przemek Kaminski <pk@intrepidus.pl> Date: Mon, 18 May 2020 17:50:52 +0200 Subject: [PATCH] [ngrams] add pagination links, set DESC score by default --- src/Gargantext/Components/NgramsTable.purs | 24 ++++++++++++++----- .../Components/NgramsTable/Core.purs | 6 +++-- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Gargantext/Components/NgramsTable.purs b/src/Gargantext/Components/NgramsTable.purs index c939bf69..2cba9d4b 100644 --- a/src/Gargantext/Components/NgramsTable.purs +++ b/src/Gargantext/Components/NgramsTable.purs @@ -184,14 +184,26 @@ tableContainerCpt { dispatch ] ] , editor - , selectButtons (selectionsExist ngramsSelection) + , H.li {className: "list-group-item"} [ + selectButtons (selectionsExist ngramsSelection) + ] , H.div {id: "terms_table", className: "panel-body"} [ H.table {className: "table able"} [ H.thead {className: "tableHeader"} [props.tableHead] - , H.tbody {} props.tableBody] - ] + , H.tbody {} props.tableBody + ] - , selectButtons (selectionsExist ngramsSelection) + , H.li {className: "list-group-item"} [ + H.div { className: "row" } [ + H.div { className: "col-md-4" } [ + selectButtons (selectionsExist ngramsSelection) + ] + , H.div { className: "col-md-4 col-md-offset-4" } [ + props.paginationLinks + ] + ] + ] + ] ] ] ] @@ -224,7 +236,7 @@ tableContainerCpt { dispatch selectButtons false = H.div {} [] selectButtons true = - H.li {className: " list-group-item"} [ + H.div {} [ H.button { className: "btn btn-primary" , on: { click: const $ setSelection GraphTerm } } [ H.text "Map" ] @@ -281,7 +293,7 @@ loadedNgramsTableCpt = R.hooksComponent "G.C.NT.loadedNgramsTable" cpt , ngramsSelection } } - ] + ] <> resetSaveButtons where autoUpdate :: Array R.Element autoUpdate = if withAutoUpdate then [ R2.buff $ autoUpdateElt { duration: 5000, effect: performAction Synchronize } ] else [] diff --git a/src/Gargantext/Components/NgramsTable/Core.purs b/src/Gargantext/Components/NgramsTable/Core.purs index 1f294c9b..b50a56dc 100644 --- a/src/Gargantext/Components/NgramsTable/Core.purs +++ b/src/Gargantext/Components/NgramsTable/Core.purs @@ -76,7 +76,7 @@ import Data.Lens.Record (prop) import Data.List ((:), List(Nil)) import Data.Map (Map) import Data.Map as Map -import Data.Maybe (Maybe(..), isNothing, maybe) +import Data.Maybe (Maybe(..), maybe) import Data.Newtype (class Newtype) import Data.Set (Set) import Data.Set as Set @@ -126,7 +126,7 @@ initialPageParams :: Session -> Int -> Array Int -> TabType -> PageParams initialPageParams session nodeId listIds tabType = { nodeId , listIds - , params: T.initialParams + , params , tabType , termSizeFilter: Nothing , termListFilter: Just GraphTerm @@ -134,6 +134,8 @@ initialPageParams session nodeId listIds tabType = , scoreType: Occurrences , session } + where + params = T.initialParams { orderBy = Just (T.DESC $ T.ColumnName "Score") } newtype NgramsTerm = NormNgramsTerm String -- 2.21.0