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
-- R.useEffectOnce' $ do
-- T.listen (\_ -> TT.changePage 1 params) searchQuery
-- filteredRows :: 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
let rows :: PreConversionRows
rows = orderWith (
Seq.mapMaybe (\(Tuple ng nre) ->
let Additive s = ng_scores ^. at ng <<< _Just in
......@@ -347,6 +327,26 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
Just TermDesc -> sortWith \x -> Down $ x ^. _NgramsElement <<< _ngrams
_ -> 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
performAction = mkDispatch { filteredRows
......@@ -380,23 +380,23 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
, NTC.searchInput { key: "search-input"
, searchQuery }
, TT.table
{ colNames
, container: tableContainer
{ dispatch: performAction
, ngramsChildren
, ngramsParent
, ngramsSelection
, ngramsTable
, path
{ colNames
, container: tableContainer
{ dispatch: performAction
, ngramsChildren
, ngramsParent
, ngramsSelection
, ngramsTable
, path
, syncResetButton: [ syncResetButton path' ]
, tabNgramType }
, params
, rows: filteredConvertedRows
, syncResetButton: [ syncResetButton path' ]
, tabNgramType }
, params
, rows: filteredConvertedRows
, syncResetButton: [ syncResetButton path' ]
, totalRecords
, wrapColElts:
wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection }
}
, totalRecords
, wrapColElts:
wrapColElts { allNgramsSelected, dispatch: performAction, ngramsSelection }
}
, 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