Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grégoire Locqueville
purescript-gargantext
Commits
79a264e5
Commit
79a264e5
authored
Nov 17, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/208-dev-phylo-search-improvements' into dev
parents
7c64beb4
957458cc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
23 deletions
+32
-23
DocList.purs
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
+2
-2
DocList.purs
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
+30
-21
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar/DocList.purs
View file @
79a264e5
...
...
@@ -121,10 +121,10 @@ docListCpt = here.component "main" cpt where
-- | Helpers
-- |
errorHandler err = do
here.warn2 "[
pageLayou
t] RESTError" err
here.warn2 "[
docLis
t] RESTError" err
case err of
ReadJSONError err' ->
here.warn2 "[
pageLayou
t] ReadJSONError" $ show err'
here.warn2 "[
docLis
t] ReadJSONError" $ show err'
_ -> pure unit
-- | Component
-- |
...
...
src/Gargantext/Components/PhyloExplorer/Sidebar/DocList.purs
View file @
79a264e5
...
...
@@ -4,7 +4,7 @@ module Gargantext.Components.PhyloExplorer.Sidebar.DocList
import Gargantext.Prelude
import Data.Array
(concat)
import Data.Array
as A
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Sequence as Seq
...
...
@@ -12,10 +12,9 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (Variant(..))
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..),
initialPagePath, loadPage, publicationDate
)
import Gargantext.Components.FacetsTable (DocumentsView(..), Rows(..),
publicationDate, initialPageGQL, loadPageGQL
)
import Gargantext.Components.PhyloExplorer.Store as PhyloStore
import Gargantext.Components.PhyloExplorer.Types (CorpusId, DocId, FrameDoc(..), ListId)
import Gargantext.Components.RandomText (words)
import Gargantext.Components.Search (SearchQuery(..), SearchType(..))
import Gargantext.Config (defaultFrontends)
import Gargantext.Config.REST (RESTError(..))
...
...
@@ -25,7 +24,7 @@ import Gargantext.Hooks.Session (useSession)
import Gargantext.Hooks.UpdateEffect (useUpdateEffect1')
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Utils (
getter,
(?))
import Gargantext.Utils ((?))
import Gargantext.Utils.Reactix as R2
import React.SyntheticEvent as SE
import Reactix as R
...
...
@@ -51,6 +50,7 @@ docListWrapperCpt = here.component "wrapper" cpt where
extractedTerms <- R2.useLive' store.extractedTerms
corpusId <- R2.useLive' store.corpusId
listId <- R2.useLive' store.listId
selectedTerm <- R2.useLive' store.selectedTerm
query' /\ query <- R2.useBox' Nothing
...
...
@@ -58,15 +58,15 @@ docListWrapperCpt = here.component "wrapper" cpt where
-- |
let
toSearchQuery
items
= SearchQuery
toSearchQuery
t
= SearchQuery
{ expected: SearchDoc
, query:
concat $ words <$> (getter _.label) <$> items
, query:
A.catMaybes [t]
}
-- | Hooks
-- |
R.useEffect1'
extractedTerms
$
T.write_ (
extractedTerms
# toSearchQuery >>> Just) query
R.useEffect1'
selectedTerm
$
T.write_ (
selectedTerm
# toSearchQuery >>> Just) query
-- | Render
-- |
...
...
@@ -113,14 +113,14 @@ docListCpt = here.component "main" cpt where
-- | Helpers
-- |
errorHandler err = do
here.warn2 "[
pageLayou
t] RESTError" err
here.warn2 "[
docLis
t] RESTError" err
case err of
ReadJSONError err' ->
here.warn2 "[
pageLayou
t] ReadJSONError" $ show err'
here.warn2 "[
docLis
t] ReadJSONError" $ show err'
_ -> pure unit
-- | Component
-- |
cpt { query
cpt { query
: query@(SearchQuery { query: q' })
, session
, corpusId: nodeId
, listId
...
...
@@ -130,8 +130,10 @@ docListCpt = here.component "main" cpt where
-- | States
-- |
path' /\ path
<- R2.useBox' $ initialPagePath { nodeId, listId, query, session }
path' /\ path <- R2.useBox' $ initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session }
state' /\ state <-
R2.useBox' Nothing
...
...
@@ -148,7 +150,7 @@ docListCpt = here.component "main" cpt where
useLoaderEffect
{ errorHandler
, state
, loader: loadPage
, loader: loadPage
GQL
, path: path'
}
...
...
@@ -157,10 +159,13 @@ docListCpt = here.component "main" cpt where
-- (on query change, reload fetched docs)
useUpdateEffect1' query $
flip T.write_ path $ initialPagePath { nodeId, listId, query, session }
T.write_ (initialPageGQL { corpusId: nodeId
, ngramsTerms: q'
, session }) path
-- (on fetch success, extract existing docs)
useUpdateEffect1' state' case state' of
Nothing -> T.write_ (Just Seq.empty) rows
Just r -> case r of
Docs { docs } -> T.write_ (Just docs) rows
...
...
@@ -217,7 +222,10 @@ docListCpt = here.component "main" cpt where
]
,
R2.when (not $ eq results Seq.empty) $
H.div {}
[
H.h6 {} [ H.text $ show (Seq.length results) <> " related documents"]
,
H.ul
{ className: intercalate " "
[ "phylo-doc-list"
...
...
@@ -236,6 +244,7 @@ docListCpt = here.component "main" cpt where
, frontends
}
]
]
---------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment