Commit c5b11698 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[toestand] some NgramsTable work

parent 38f1fe6f
...@@ -306,27 +306,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where ...@@ -306,27 +306,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
-- R.useEffectOnce' $ do -- R.useEffectOnce' $ do
-- T.listen (\_ -> TT.changePage 1 params) searchQuery -- T.listen (\_ -> TT.changePage 1 params) searchQuery
-- filteredRows :: PreConversionRows let rows :: PreConversionRows
-- no need to filter offset if cache is off
let filteredRows = if cacheState == NT.CacheOn then TT.filterRows { params: params' } rows else rows
filteredConvertedRows :: TT.Rows
filteredConvertedRows = convertRow <$> filteredRows
convertRow ngramsElement =
{ row: NTC.renderNgramsItem { dispatch: performAction
, ngrams: ngramsElement ^. _NgramsElement <<< _ngrams
, ngramsElement
, ngramsLocalPatch
, ngramsParent
, ngramsSelection
, ngramsTable
, sidePanelTriggers } []
, delete: false
}
allNgramsSelected = allNgramsSelectedOnFirstPage ngramsSelection filteredRows
rows :: PreConversionRows
rows = orderWith ( rows = orderWith (
Seq.mapMaybe (\(Tuple ng nre) -> Seq.mapMaybe (\(Tuple ng nre) ->
let Additive s = ng_scores ^. at ng <<< _Just in let Additive s = ng_scores ^. at ng <<< _Just in
...@@ -347,6 +327,26 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where ...@@ -347,6 +327,26 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
Just TermDesc -> sortWith \x -> Down $ x ^. _NgramsElement <<< _ngrams Just TermDesc -> sortWith \x -> Down $ x ^. _NgramsElement <<< _ngrams
_ -> identity -- the server ordering is enough here _ -> identity -- the server ordering is enough here
-- filteredRows :: PreConversionRows
-- no need to filter offset if cache is off
filteredRows = if cacheState == NT.CacheOn then TT.filterRows { params: params' } rows else rows
filteredConvertedRows :: TT.Rows
filteredConvertedRows = convertRow <$> filteredRows
convertRow ngramsElement =
{ row: NTC.renderNgramsItem { dispatch: performAction
, ngrams: ngramsElement ^. _NgramsElement <<< _ngrams
, ngramsElement
, ngramsLocalPatch
, ngramsParent
, ngramsSelection
, ngramsTable
, sidePanelTriggers } []
, delete: false
}
allNgramsSelected = allNgramsSelectedOnFirstPage ngramsSelection filteredRows
totalRecords = fromMaybe (Seq.length rows) mTotalRows totalRecords = fromMaybe (Seq.length rows) mTotalRows
performAction = mkDispatch { filteredRows performAction = mkDispatch { filteredRows
...@@ -380,23 +380,23 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where ...@@ -380,23 +380,23 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
, NTC.searchInput { key: "search-input" , NTC.searchInput { key: "search-input"
, searchQuery } , searchQuery }
, TT.table , TT.table
{ colNames { colNames
, container: tableContainer , container: tableContainer
{ dispatch: performAction { dispatch: performAction
, ngramsChildren , ngramsChildren
, ngramsParent , ngramsParent
, ngramsSelection , ngramsSelection
, ngramsTable , ngramsTable
, path , path
, syncResetButton: [ syncResetButton path' ]
, tabNgramType }
, params
, rows: filteredConvertedRows
, syncResetButton: [ syncResetButton path' ] , syncResetButton: [ syncResetButton path' ]
, tabNgramType } , totalRecords
, params , wrapColElts:
, rows: filteredConvertedRows wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection }
, syncResetButton: [ syncResetButton path' ] }
, totalRecords
, wrapColElts:
wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection }
}
, syncResetButton path' , syncResetButton path'
] ]
......
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