Commit 1f4462b0 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[Graph][FacetsTable] add authors to table & fix other table columns

parent a8ce0a41
...@@ -83,6 +83,7 @@ newtype DocumentsView = ...@@ -83,6 +83,7 @@ newtype DocumentsView =
, date :: String , date :: String
, title :: String , title :: String
, source :: String , source :: String
, authors :: String
, score :: Int , score :: Int
, pairs :: Array Pair , pairs :: Array Pair
, delete :: Boolean , delete :: Boolean
...@@ -106,7 +107,8 @@ newtype Response = Response ...@@ -106,7 +107,8 @@ newtype Response = Response
} }
newtype Hyperdata = Hyperdata newtype Hyperdata = Hyperdata
{ title :: String { authors :: String
, title :: String
, source :: String , source :: String
} }
...@@ -127,9 +129,10 @@ instance decodePair :: DecodeJson Pair where ...@@ -127,9 +129,10 @@ instance decodePair :: DecodeJson Pair where
instance decodeHyperdata :: DecodeJson Hyperdata where instance decodeHyperdata :: DecodeJson Hyperdata where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
authors <- obj .| "authors"
title <- obj .| "title" title <- obj .| "title"
source <- obj .| "source" source <- obj .| "source"
pure $ Hyperdata { title,source } pure $ Hyperdata { authors, title,source }
{- {-
instance decodeResponse :: DecodeJson Response where instance decodeResponse :: DecodeJson Response where
...@@ -239,8 +242,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do ...@@ -239,8 +242,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do
where where
res2corpus :: Response -> DocumentsView res2corpus :: Response -> DocumentsView
res2corpus (Response { id, created: date, ngramCount: score, category res2corpus (Response { id, created: date, ngramCount: score, category
, hyperdata: Hyperdata {title, source} }) = , hyperdata: Hyperdata {authors, title, source} }) =
DocumentsView { id, date, title, source, score, category, pairs: [], delete: false } DocumentsView { id, date, title, source, score, authors, category, pairs: [], delete: false }
convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc
convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc convOrderBy (T.DESC (T.ColumnName "Date")) = DateDesc
convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc convOrderBy (T.ASC (T.ColumnName "Title")) = TitleAsc
...@@ -293,13 +296,14 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt ...@@ -293,13 +296,14 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
| otherwise = H.text label | otherwise = H.text label
comma = H.span {} [ H.text ", " ] comma = H.span {} [ H.text ", " ]
rows = row <$> filter (not <<< isDeleted) documents rows = row <$> filter (not <<< isDeleted) documents
where row dv@(DocumentsView {id,score,title,source,date, authors,pairs,delete,category}) =
row (DocumentsView {id,score,title,source,date,pairs,delete,category}) =
{ row: { row:
[ H.a { className, on: {click: markClick} } [] [ H.a { className: gi category, on: {click: markClick} } []
-- TODO show date: Year-Month-Day only -- TODO show date: Year-Month-Day only
, maybeStricken [ H.text date ] , maybeStricken delete [ H.text date ]
, maybeStricken [ H.text source ] , maybeStricken delete [ H.text title ]
, maybeStricken delete [ H.text source ]
, maybeStricken delete [ H.text authors ]
-- , maybeStricken $ intercalate [comma] (pairUrl <$> pairs) -- , maybeStricken $ intercalate [comma] (pairUrl <$> pairs)
, H.input { type: "checkbox", checked: isChecked id, on: { click: toggleClick } } , H.input { type: "checkbox", checked: isChecked id, on: { click: toggleClick } }
] ]
...@@ -307,8 +311,7 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt ...@@ -307,8 +311,7 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
where where
markClick _ = markCategory session nodeId category [id] markClick _ = markCategory session nodeId category [id]
toggleClick _ = togglePendingDeletion deletions id toggleClick _ = togglePendingDeletion deletions id
className = gi category maybeStricken delete
maybeStricken
| delete = H.div { style: { textDecoration: "line-through" } } | delete = H.div { style: { textDecoration: "line-through" } }
| otherwise = H.div {} | otherwise = H.div {}
......
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