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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
b1c31559
Commit
b1c31559
authored
Jul 03, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] adding database to query.
parent
c05e1431
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
12 deletions
+17
-12
SearchField.purs
src/Gargantext/Components/Search/SearchField.purs
+3
-4
Types.purs
src/Gargantext/Components/Search/Types.purs
+14
-8
No files found.
src/Gargantext/Components/Search/SearchField.purs
View file @
b1c31559
...
...
@@ -60,9 +60,8 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
databaseInput :: R.State (Maybe Database) -> Array Database -> R.Element
databaseInput (db /\ setDB) dbs =
div { className: "input-group-btn search-panel dropdown" }
[
dropdownBtn db
, ul {className: "dropdown-menu", role: "menu"} (liItem <$> dbs)
[ dropdownBtn db
, ul {className: "dropdown-menu", role: "menu"} (liItem <$> dbs)
]
where
liItem db = li { onClick }
...
...
@@ -92,4 +91,4 @@ submitButton (database /\ _) (term /\ _) (_ /\ setSearch) =
click = mkEffectFn1 $ \_ -> do
case term of
"" -> setSearch (const Nothing)
_ -> setSearch (const $ Just { database, term })
_
-> setSearch (const $ Just { database, term })
src/Gargantext/Components/Search/Types.purs
View file @
b1c31559
module Gargantext.Components.Search.Types where
import Control.Monad.Cont.Trans (lift)
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>)
, encodeJson
)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Array (head)
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
...
...
@@ -22,10 +23,10 @@ import URI.Extra.QueryPairs as QP
data Database = All | PubMed | HAL | IsTex
instance showDatabase :: Show Database where
show All = "All"
show All
= "All"
show PubMed = "PubMed"
show HAL = "HAL"
show IsTex = "IsTex"
show HAL
= "HAL"
show IsTex
= "IsTex"
readDatabase :: String -> Maybe Database
readDatabase "All" = Just All
...
...
@@ -36,6 +37,10 @@ readDatabase _ = Nothing
derive instance eqDatabase :: Eq Database
instance encodeJsonDatabase :: EncodeJson Database where
encodeJson a = encodeJson (show a)
allDatabases :: Array Database
allDatabases = [All, HAL, IsTex, PubMed]
...
...
@@ -85,8 +90,9 @@ instance searchQueryToQuery :: ToQuery SearchQuery where
[ QP.keyFromString k /\ Just (QP.valueFromString $ show v) ]
instance encodeJsonSearchQuery :: EncodeJson SearchQuery where
encodeJson (SearchQuery {query, corpus_id, files_id})
= "query" := query
~> "corpus_id" := fromMaybe 0 corpus_id
~> "files_id" := files_id
encodeJson (SearchQuery {query, databases, corpus_id, files_id})
= "query" := query
~> "databases" := databases
~> "corpus_id" := fromMaybe 0 corpus_id
~> "files_id" := files_id
~> jsonEmptyObject
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