Commit 61907ea6 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[docstable, score] fix various merge issues

parent 3ea34423
...@@ -43,6 +43,7 @@ import Gargantext.Utils (sortWith) ...@@ -43,6 +43,7 @@ import Gargantext.Utils (sortWith)
import Gargantext.Utils.CacheAPI as GUC import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS) import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as GUT
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Simple.JSON as JSON import Simple.JSON as JSON
...@@ -407,17 +408,14 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -407,17 +408,14 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel (\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
mCurrentDocId' <- T.useLive T.unequal mCurrentDocId mCurrentDocId' <- T.useLive T.unequal mCurrentDocId
<<<<<<< HEAD reload <- T.useBox GUT.newReload
reload <- GUR.new
=======
localCategories' <- T.useLive T.unequal localCategories localCategories' <- T.useLive T.unequal localCategories
>>>>>>> dev
pure $ TT.table pure $ TT.table
{ colNames { colNames
, container: TT.defaultContainer , container: TT.defaultContainer
, params , params
, rows: rows localCategories' mCurrentDocId' , rows: rows reload localCategories' mCurrentDocId'
, syncResetButton : [ H.div {} [] ] , syncResetButton : [ H.div {} [] ]
, totalRecords , totalRecords
, wrapColElts , wrapColElts
...@@ -432,19 +430,10 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -432,19 +430,10 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
| otherwise = Routes.Document sid listId | otherwise = Routes.Document sid listId
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ] colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
wrapColElts = const identity wrapColElts = const identity
rows localCategories' mCurrentDocId' = row <$> A.toUnfoldable documents rows reload localCategories' mCurrentDocId' = row reload <$> A.toUnfoldable documents
where where
row dv@(DocumentsView r@{ _id, category }) = row reload dv@(DocumentsView r@{ _id, category }) =
{ row: { row:
<<<<<<< HEAD
T.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
H.div { className: "" }
[ docChooser { listId, mCorpusId, nodeId: r._id, selected, sidePanelTriggers, tableReload: reload } []
]
--, H.div { className: "column-tag flex" } [ caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } [] ]
, H.div { className: "column-tag flex" }
[ rating { score: cat, nodeId, row: dv, session, setLocalCategories } [] ]
=======
TT.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ] TT.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
H.div { className: "" } H.div { className: "" }
[ docChooser { boxes [ docChooser { boxes
...@@ -460,7 +449,6 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where ...@@ -460,7 +449,6 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
, score: cat , score: cat
, setLocalCategories: \lc -> T.modify_ lc localCategories , setLocalCategories: \lc -> T.modify_ lc localCategories
, session } [] ] , session } [] ]
>>>>>>> dev
--, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} } --, H.input { type: "checkbox", defaultValue: checked, on: {click: click Trash} }
-- TODO show date: Year-Month-Day only -- TODO show date: Year-Month-Day only
, H.div { className: tClassName } [ R2.showText r.date ] , H.div { className: tClassName } [ R2.showText r.date ]
......
...@@ -2,21 +2,24 @@ module Gargantext.Components.Score where ...@@ -2,21 +2,24 @@ module Gargantext.Components.Score where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>), encodeJson) import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>), encodeJson)
import Data.Int (fromString) import Data.Int (fromString)
import Data.Either (Either)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Effect.Aff (Aff, launchAff_) import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Config.REST (RESTError)
import Gargantext.Routes (SessionRoute(NodeAPI)) import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, sessionId, get, delete, put) import Gargantext.Sessions (Session, sessionId, get, delete, put)
import Gargantext.Types as GT import Gargantext.Types as GT
import Gargantext.Utils.Array as GUA import Gargantext.Utils.Array as GUA
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reload as GUR import Gargantext.Utils.Toestand as GUT
type Score = Int type Score = Int
type DocID = Int type DocID = Int
...@@ -30,7 +33,7 @@ type Props = ( ...@@ -30,7 +33,7 @@ type Props = (
, nodeId :: GT.NodeID , nodeId :: GT.NodeID
, score :: Maybe Score , score :: Maybe Score
, session :: Session , session :: Session
, tableReload :: GUR.ReloadS , tableReload :: GUT.ReloadS
) )
type Choice = Maybe Score type Choice = Maybe Score
...@@ -53,7 +56,7 @@ scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt ...@@ -53,7 +56,7 @@ scoreElCpt = R.hooksComponentWithModule thisModule "scoreEl" cpt
, score: readChoice $ R.unsafeEventValue e } , score: readChoice $ R.unsafeEventValue e }
launchAff_ $ do launchAff_ $ do
_ <- putScore session nodeId query _ <- putScore session nodeId query
liftEffect $ GUR.bump reloadS liftEffect $ GUT.reload reloadS
option :: Choice -> R.Element option :: Choice -> R.Element
option c = H.option { value: showChoice c } [ H.text $ showChoice c ] option c = H.option { value: showChoice c } [ H.text $ showChoice c ]
...@@ -72,13 +75,11 @@ newtype ScoreQuery = ...@@ -72,13 +75,11 @@ newtype ScoreQuery =
, score :: Choice , score :: Choice
} }
instance encodeJsonScoreQuery :: EncodeJson ScoreQuery where instance JSON.WriteForeign ScoreQuery where
encodeJson (ScoreQuery post) = writeImpl (ScoreQuery post) = JSON.writeImpl { nts_nodesId: post.nodeIds
"nts_nodesId" := post.nodeIds , nts_score: post.score }
~> "nts_score" := encodeJson post.score
~> jsonEmptyObject
putScore :: Session -> GT.NodeID -> ScoreQuery -> Aff (Array Int) putScore :: Session -> GT.NodeID -> ScoreQuery -> Aff (Either RESTError (Array Int))
putScore session nodeId = put session $ scoreRoute nodeId putScore session nodeId = put session $ scoreRoute nodeId
where where
scoreRoute :: GT.NodeID -> SessionRoute scoreRoute :: GT.NodeID -> SessionRoute
......
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