Commit 266175af authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[ngramsTable] add score column

Based on ngramsCount.
parent d9a55b09
...@@ -19,6 +19,7 @@ import DOM.Simple.Console (log, log2) ...@@ -19,6 +19,7 @@ import DOM.Simple.Console (log, log2)
import DOM.Simple.Event as DE import DOM.Simple.Event as DE
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -274,7 +275,11 @@ pageLayoutCpt = R.hooksComponentWithModule thisModule "pageLayout" cpt where ...@@ -274,7 +275,11 @@ pageLayoutCpt = R.hooksComponentWithModule thisModule "pageLayout" cpt where
localCategories <- R.useState' (mempty :: LocalCategories) localCategories <- R.useState' (mempty :: LocalCategories)
paramsS <- R.useState' params paramsS <- R.useState' params
let loader p = do let loader p = do
res <- get session $ tableRouteWithPage (p { params = fst paramsS, query = query }) let route = tableRouteWithPage (p { params = fst paramsS, query = query })
res <- get session $ route
liftEffect $ do
log2 "[pageLayout] table route" route
log2 "[pageLayout] table res" res
pure $ handleResponse res pure $ handleResponse res
render (Tuple count documents) = pagePaintRaw { documents render (Tuple count documents) = pagePaintRaw { documents
, layout: props { params = fst paramsS , layout: props { params = fst paramsS
...@@ -372,7 +377,7 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh ...@@ -372,7 +377,7 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
corpusDocument corpusDocument
| Just cid <- mCorpusId = Routes.CorpusDocument sid cid listId | Just cid <- mCorpusId = Routes.CorpusDocument sid cid listId
| otherwise = Routes.Document sid listId | otherwise = Routes.Document sid listId
colNames = T.ColumnName <$> [ "Tag", "Date", "Title", "Source"] colNames = T.ColumnName <$> [ "Tag", "Date", "Title", "Source", "Score"]
wrapColElts = const identity wrapColElts = const identity
getCategory (lc /\ _) {_id, category} = fromMaybe category (lc ^. at _id) getCategory (lc /\ _) {_id, category} = fromMaybe category (lc ^. at _id)
rows reload lc@(_ /\ setLocalCategories) = row <$> A.toUnfoldable documents rows reload lc@(_ /\ setLocalCategories) = row <$> A.toUnfoldable documents
...@@ -391,6 +396,7 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh ...@@ -391,6 +396,7 @@ pagePaintRawCpt = R.hooksComponentWithModule thisModule "pagePaintRawCpt" cpt wh
H.a { href: url frontends $ corpusDocument r._id, target: "_blank"} [ H.text r.title ] H.a { href: url frontends $ corpusDocument r._id, target: "_blank"} [ H.text r.title ]
] ]
, H.div { className: tClassName } [ H.text $ if r.source == "" then "Source" else r.source ] , H.div { className: tClassName } [ H.text $ if r.source == "" then "Source" else r.source ]
, H.div {} [ H.text $ show r.ngramCount ]
] ]
, delete: true } , delete: true }
where where
......
...@@ -20,7 +20,6 @@ import Gargantext.Components.InputWithEnter (inputWithEnter) ...@@ -20,7 +20,6 @@ import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser) import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Lists.Types as LT import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==)) import Gargantext.Prelude (Unit, bind, const, discard, pure, show, unit, ($), (+), (<$>), (<<<), (<>), (==))
......
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