Commit 414815aa authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch 'dev' into dev-doc-table-cache-issue

parents 99fe38ff 0372a7ed
...@@ -4511,4 +4511,4 @@ ...@@ -4511,4 +4511,4 @@
"repo": "https://github.com/athanclark/purescript-zeta-extra.git", "repo": "https://github.com/athanclark/purescript-zeta-extra.git",
"version": "v0.0.1" "version": "v0.0.1"
} }
} }
\ No newline at end of file
{ {
"name": "Gargantext", "name": "Gargantext",
"version": "0.0.1.91.2", "version": "0.0.1.91.3",
"scripts": { "scripts": {
"rebase-set": "spago package-set-upgrade && spago psc-package-insdhall", "rebase-set": "spago package-set-upgrade && spago psc-package-insdhall",
"rebuild-set": "spago psc-package-insdhall", "rebuild-set": "spago psc-package-insdhall",
......
let mkPackage =
https://raw.githubusercontent.com/purescript/package-sets/psc-0.13.8-20200822/src/mkPackage.dhall sha256:0b197efa1d397ace6eb46b243ff2d73a3da5638d8d0ac8473e8e4a8fc528cf57
--let upstream =
-- https://github.com/purescript/package-sets/releases/download/psc-0.13.8-20200822/packages.dhall sha256:2230fc547841b54bca815eb0058414aa03ed7b675042f8b3dda644e1952824e5
let upstream = let upstream =
./packages-0.13.8-20200822.dhall ./packages-0.13.8-20200822.dhall
let overrides = let overrides =
{ thermite = { thermite =
mkPackage { dependencies =
[ "aff" [ "aff"
, "coroutines" , "coroutines"
, "web-dom" , "web-dom"
, "freet" , "freet"
, "profunctor-lenses" , "profunctor-lenses"
, "react" , "react"
, "react-dom" , "react-dom"
] ]
"https://github.com/poorscript/purescript-thermite.git" , repo = "https://github.com/poorscript/purescript-thermite.git"
"hide-2020-03-04" , version = "hide-2020-03-04"
}
, globals = , globals =
mkPackage { dependencies = [ "functions", "maybe" ]
[ "functions", "maybe" ] , repo = "https://github.com/purescript/purescript-globals"
"https://github.com/purescript/purescript-globals" , version = "v4.1.0"
"v4.1.0" }
} }
let additions = let additions =
{ sequences = { sequences =
mkPackage { dependencies =
[ "prelude" [ "prelude"
, "unsafe-coerce" , "unsafe-coerce"
, "partial" , "partial"
...@@ -41,20 +36,23 @@ let additions = ...@@ -41,20 +36,23 @@ let additions =
, "tuples" , "tuples"
, "newtype" , "newtype"
] ]
"https://github.com/hdgarrood/purescript-sequences.git" , repo = "https://github.com/hdgarrood/purescript-sequences.git"
"v2.1.0" , version = "v2.1.0"
}
, spec-discovery = , spec-discovery =
mkPackage { dependencies =
[ "prelude", "effect", "arrays", "spec", "node-fs" ] [ "prelude", "effect", "arrays", "spec", "node-fs" ]
"https://github.com/purescript-spec/purescript-spec-discovery" , repo = "https://github.com/purescript-spec/purescript-spec-discovery"
"v4.0.0" , version = "v4.0.0"
}
, spec-quickcheck = , spec-quickcheck =
mkPackage { dependencies =
[ "prelude", "aff", "random", "quickcheck", "spec" ] [ "prelude", "aff", "random", "quickcheck", "spec" ]
"https://github.com/purescript-spec/purescript-spec-quickcheck" , repo = "https://github.com/purescript-spec/purescript-spec-quickcheck"
"v3.1.0" , version = "v3.1.0"
}
, ffi-simple = , ffi-simple =
mkPackage { dependencies =
[ "prelude" [ "prelude"
, "effect" , "effect"
, "maybe" , "maybe"
...@@ -62,10 +60,11 @@ let additions = ...@@ -62,10 +60,11 @@ let additions =
, "nullable" , "nullable"
, "unsafe-coerce" , "unsafe-coerce"
] ]
"https://github.com/irresponsible/purescript-ffi-simple" , repo = "https://github.com/irresponsible/purescript-ffi-simple"
"v0.2.10" , version = "v0.2.10"
}
, dom-simple = , dom-simple =
mkPackage { dependencies =
[ "arrays" [ "arrays"
, "console" , "console"
, "effect" , "effect"
...@@ -75,30 +74,35 @@ let additions = ...@@ -75,30 +74,35 @@ let additions =
, "prelude" , "prelude"
, "unsafe-coerce" , "unsafe-coerce"
] ]
"https://github.com/irresponsible/purescript-dom-simple" , repo = "https://github.com/irresponsible/purescript-dom-simple"
"v0.2.7" , version = "v0.2.7"
}
, dom-filereader = , dom-filereader =
mkPackage { dependencies =
[ "aff", "arraybuffer-types", "web-file", "web-html" ] [ "aff", "arraybuffer-types", "web-file", "web-html" ]
"https://github.com/nwolverson/purescript-dom-filereader" , repo = "https://github.com/nwolverson/purescript-dom-filereader"
"v5.0.0" , version = "v5.0.0"
}
, markdown = , markdown =
mkPackage { dependencies =
[ "precise" ] [ "precise" ]
"https://github.com/poorscript/purescript-markdown" , repo = "https://github.com/poorscript/purescript-markdown"
"2020-03-04" , version = "2020-03-04"
}
, markdown-smolder = , markdown-smolder =
mkPackage { dependencies =
[ "markdown", "smolder" ] [ "markdown", "smolder" ]
"https://github.com/poorscript/purescript-markdown-smolder" , repo = "https://github.com/poorscript/purescript-markdown-smolder"
"2020-03-04" , version = "2020-03-04"
}
, precise = , precise =
mkPackage { dependencies =
[ "prelude" ] [ "prelude" ]
"https://github.com/purescript-contrib/purescript-precise" , repo = "https://github.com/purescript-contrib/purescript-precise"
"v4.0.0" , version = "v4.0.0"
}
, reactix = , reactix =
mkPackage { dependencies =
[ "aff" [ "aff"
, "dom-simple" , "dom-simple"
, "effect" , "effect"
...@@ -108,20 +112,23 @@ let additions = ...@@ -108,20 +112,23 @@ let additions =
, "prelude" , "prelude"
, "unsafe-coerce" , "unsafe-coerce"
] ]
"https://github.com/irresponsible/purescript-reactix" , repo = "https://github.com/irresponsible/purescript-reactix"
"v0.4.6" , version = "v0.4.6"
}
, tuples-native = , tuples-native =
mkPackage { dependencies =
[ "generics-rep", "prelude", "typelevel", "unsafe-coerce" ] [ "generics-rep", "prelude", "typelevel", "unsafe-coerce" ]
"https://github.com/athanclark/purescript-tuples-native" , repo = "https://github.com/athanclark/purescript-tuples-native"
"v2.0.1" , version = "v2.0.1"
}
, uint = , uint =
mkPackage { dependencies =
[ "maybe", "math", "generics-rep" ] [ "maybe", "math", "generics-rep" ]
"https://github.com/zaquest/purescript-uint" , repo = "https://github.com/zaquest/purescript-uint"
"v5.1.1" , version = "v5.1.1"
}
, uri = , uri =
mkPackage { dependencies =
[ "these" [ "these"
, "arrays" , "arrays"
, "profunctor-lenses" , "profunctor-lenses"
...@@ -131,23 +138,27 @@ let additions = ...@@ -131,23 +138,27 @@ let additions =
, "globals" , "globals"
, "generics-rep" , "generics-rep"
] ]
"https://github.com/slamdata/purescript-uri" , repo = "https://github.com/slamdata/purescript-uri"
"v7.0.0" , version = "v7.0.0"
}
, read = , read =
mkPackage { dependencies =
[ "prelude", "maybe", "strings" ] [ "prelude", "maybe", "strings" ]
"https://github.com/truqu/purescript-read" , repo = "https://github.com/truqu/purescript-read"
"v1.0.1" , version = "v1.0.1"
}
, versions = , versions =
mkPackage { dependencies =
[ "prelude" ] [ "prelude" ]
"https://github.com/hdgarrood/purescript-versions.git" , repo = "https://github.com/hdgarrood/purescript-versions.git"
"v5.0.1" , version = "v5.0.1"
}
, simplecrypto = , simplecrypto =
mkPackage { dependencies =
[ "prelude", "maybe", "node-buffer"] [ "prelude", "maybe", "node-buffer"]
"https://github.com/alpacaaa/purescript-simplecrypto" , repo = "https://github.com/alpacaaa/purescript-simplecrypto"
"v1.0.1" , version = "v1.0.1"
}
} }
in upstream ⫽ overrides ⫽ additions in upstream ⫽ overrides ⫽ additions
...@@ -381,7 +381,7 @@ pagePaintCpt = R.hooksComponentWithModule thisModule "pagePaintCpt" cpt where ...@@ -381,7 +381,7 @@ pagePaintCpt = R.hooksComponentWithModule thisModule "pagePaintCpt" cpt where
{ colNames { colNames
, container: T.defaultContainer { title: "Documents" } , container: T.defaultContainer { title: "Documents" }
, params , params
, rows: Seq.fromFoldable $ rows localCategories , rows: rows localCategories
, totalRecords , totalRecords
, wrapColElts , wrapColElts
} }
......
...@@ -9,6 +9,7 @@ import Data.Array (concat, filter) ...@@ -9,6 +9,7 @@ import Data.Array (concat, filter)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), fromMaybe) import Data.Maybe (Maybe(..), fromMaybe)
import Data.Sequence (Seq)
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
...@@ -182,7 +183,7 @@ type PagePath = { nodeId :: Int ...@@ -182,7 +183,7 @@ type PagePath = { nodeId :: Int
initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: SearchQuery} -> PagePath initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: SearchQuery} -> PagePath
initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams} initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams}
loadPage :: PagePath -> Aff (Array DocumentsView) loadPage :: PagePath -> Aff (Seq DocumentsView)
loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searchType}} = do loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searchType}} = do
let let
convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc
...@@ -198,80 +199,75 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searc ...@@ -198,80 +199,75 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy, searc
--SearchResult {result} <- post session p $ SearchQuery {query: concat query, expected:searchType} --SearchResult {result} <- post session p $ SearchQuery {query: concat query, expected:searchType}
SearchResult {result} <- post session p query SearchResult {result} <- post session p query
-- $ SearchQuery {query: concat query, expected: SearchDoc} -- $ SearchQuery {query: concat query, expected: SearchDoc}
pure $ case result of pure case result of
SearchResultDoc {docs} -> docs2view docs SearchResultDoc {docs} -> doc2view <$> Seq.fromFoldable docs
SearchResultContact {contacts} -> contacts2view contacts SearchResultContact {contacts} -> contact2view <$> Seq.fromFoldable contacts
errMessage -> err2view errMessage errMessage -> pure $ err2view errMessage
docs2view :: Array Document -> Array DocumentsView doc2view :: Document -> DocumentsView
docs2view docs = map toView docs doc2view ( Document { id
where , created: date
toView :: Document -> DocumentsView , hyperdata: HyperdataRowDocument { authors
toView ( Document { id , title
, created: date , source
, hyperdata: HyperdataRowDocument { authors , publication_year
, title , publication_month
, source , publication_day
, publication_year }
, publication_month , category
, publication_day , score
}
) = DocumentsView { id
, date
, title: fromMaybe "Title" title
, source: fromMaybe "Source" source
, score
, authors: fromMaybe "Authors" authors
, category: decodeCategory category
, pairs: []
, delete: false
, publication_year : fromMaybe 2020 publication_year
, publication_month: fromMaybe 1 publication_month
, publication_day : fromMaybe 1 publication_day
}
contact2view :: Contact -> DocumentsView
contact2view (Contact { c_id
, c_created: date
, c_hyperdata: HyperdataRowContact { firstname
, lastname
, labs
} }
, category , c_score
, score }
} ) = DocumentsView { id: c_id
) = DocumentsView { id , date
, date , title : firstname <> lastname
, title: fromMaybe "Title" title , source: labs
, source: fromMaybe "Source" source , score: c_score
, score , authors: labs
, authors: fromMaybe "Authors" authors , category: decodeCategory 1
, category: decodeCategory category , pairs: []
, pairs: [] , delete: false
, delete: false , publication_year: 2020
, publication_year : fromMaybe 2020 publication_year , publication_month: 10
, publication_month: fromMaybe 1 publication_month , publication_day: 1
, publication_day : fromMaybe 1 publication_day }
}
contacts2view contacts = map toView contacts
where
toView :: Contact -> DocumentsView
toView (Contact { c_id
, c_created: date
, c_hyperdata: HyperdataRowContact { firstname
, lastname
, labs
}
, c_score
}
) = DocumentsView { id: c_id
, date
, title : firstname <> lastname
, source: labs
, score: c_score
, authors: labs
, category: decodeCategory 1
, pairs: []
, delete: false
, publication_year: 2020
, publication_month: 10
, publication_day: 1
}
err2view message = err2view message =
[DocumentsView { id: 1 DocumentsView { id: 1
, date: "2020-01-01" , date: "2020-01-01"
, title : "SearchNoResult" , title : "SearchNoResult"
, source: "Source" , source: "Source"
, score: 1 , score: 1
, authors: "Authors" , authors: "Authors"
, category: decodeCategory 1 , category: decodeCategory 1
, pairs: [] , pairs: []
, delete: false , delete: false
, publication_year: 2020 , publication_year: 2020
, publication_month: 10 , publication_month: 10
, publication_day: 1 , publication_day: 1
} }
]
...@@ -285,7 +281,7 @@ type PageLayoutProps = ...@@ -285,7 +281,7 @@ type PageLayoutProps =
, path :: R.State PagePath , path :: R.State PagePath
) )
type PageProps = ( documents :: Array DocumentsView | PageLayoutProps ) type PageProps = ( documents :: Seq DocumentsView | PageLayoutProps )
-- | Loads and renders a page -- | Loads and renders a page
pageLayout :: Record PageLayoutProps -> R.Element pageLayout :: Record PageLayoutProps -> R.Element
...@@ -323,7 +319,7 @@ pageCpt = R.hooksComponentWithModule thisModule "page" cpt ...@@ -323,7 +319,7 @@ pageCpt = R.hooksComponentWithModule thisModule "page" cpt
documentUrl id = documentUrl id =
url frontends $ Routes.CorpusDocument (sessionId session) nodeId listId id url frontends $ Routes.CorpusDocument (sessionId session) nodeId listId id
comma = H.span {} [ H.text ", " ] comma = H.span {} [ H.text ", " ]
rows = Seq.fromFoldable $ row <$> filter (not <<< isDeleted) documents rows = row <$> Seq.filter (not <<< isDeleted) documents
row dv@(DocumentsView {id, score, title, source, authors, pairs, delete, category}) = row dv@(DocumentsView {id, score, title, source, authors, pairs, delete, category}) =
{ row: { row:
T.makeRow [ T.makeRow [
......
...@@ -156,6 +156,7 @@ treeCpt = R.hooksComponentWithModule thisModule "tree" cpt ...@@ -156,6 +156,7 @@ treeCpt = R.hooksComponentWithModule thisModule "tree" cpt
style = if leaf then {color: "#adb5bd"} else {color: ""} style = if leaf then {color: "#adb5bd"} else {color: ""}
open = not leaf || false {- TODO -} open = not leaf || false {- TODO -}
cs = ngramsTable ^.. ix ngramsDepth.ngrams <<< _NgramsRepoElement <<< _children <<< folded cs = ngramsTable ^.. ix ngramsDepth.ngrams <<< _NgramsRepoElement <<< _children <<< folded
-- cs has a list is ok, the length is the number of direct children of an ngram which is generally < 10.
forest = forest =
let depth = ngramsDepth.depth + 1 in let depth = ngramsDepth.depth + 1 in
......
module Gargantext.Utils.List where
import Data.Ord (class Ord, comparing)
import Data.List as List
import Data.Array as Array
import Gargantext.Prelude
-- same as
-- https://github.com/purescript/purescript-arrays/blob/v5.3.1/src/Data/Array.purs#L715-L715
sortWith :: forall a b. Ord b => (a -> b) -> List.List a -> List.List a
sortWith f l = Array.toUnfoldable $ Array.sortBy (comparing f) $ Array.fromFoldable l
...@@ -7,13 +7,6 @@ import Data.Tuple ...@@ -7,13 +7,6 @@ import Data.Tuple
import Gargantext.Prelude import Gargantext.Prelude
reverse :: forall a. Seq a -> Seq a
reverse s = case uncons s of
Nothing -> empty
Just (Tuple x xs) -> snoc (reverse xs) x
mapMaybe :: forall a b. (a -> Maybe b) -> Seq a -> Seq b mapMaybe :: forall a b. (a -> Maybe b) -> Seq a -> Seq b
mapMaybe f = go empty mapMaybe f = go empty
where where
......
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