Commit f5a32191 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[API Query] search connection ok

parent a5b594f6
...@@ -13,7 +13,7 @@ import Effect.Class (liftEffect) ...@@ -13,7 +13,7 @@ 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 Gargantext.Components.Data.Lang (LandingLang(..)) import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Forest (forest) import Gargantext.Components.Forest (forest)
import Gargantext.Components.GraphExplorer (explorerLayout) import Gargantext.Components.GraphExplorer (explorerLayout)
import Gargantext.Components.Login (login) import Gargantext.Components.Login (login)
......
...@@ -9,7 +9,7 @@ import Data.Newtype (class Newtype) ...@@ -9,7 +9,7 @@ import Data.Newtype (class Newtype)
import Effect.Aff (Aff) import Effect.Aff (Aff)
import Prelude hiding (div) import Prelude hiding (div)
import Gargantext.Components.Data.Lang (Lang) import Gargantext.Components.Lang (Lang)
import Gargantext.Routes (SessionRoute(..)) import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, put, post, delete) import Gargantext.Sessions (Session, get, put, post, delete)
import Gargantext.Types as GT import Gargantext.Types as GT
......
...@@ -18,7 +18,7 @@ import Web.File.FileReader.Aff (readAsText) ...@@ -18,7 +18,7 @@ import Web.File.FileReader.Aff (readAsText)
import Gargantext.Prelude (class Show, Unit, bind, const, discard, map, pure, show, unit, void, ($), (&&), (/=), (<>)) import Gargantext.Prelude (class Show, Unit, bind, const, discard, map, pure, show, unit, void, ($), (&&), (/=), (<>))
import Gargantext.Components.Data.Lang (readLang, Lang(..)) import Gargantext.Components.Lang (readLang, Lang(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FTree, FileType(..), ID, LNode(..), NTree(..), UploadFile, UploadFileContents(..), readFileType) import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FTree, FileType(..), ID, LNode(..), NTree(..), UploadFile, UploadFileContents(..), readFileType)
import Gargantext.Hooks.Loader (useLoader) import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as GR import Gargantext.Routes as GR
......
...@@ -18,7 +18,7 @@ import URI.Extra.QueryPairs as NQP ...@@ -18,7 +18,7 @@ import URI.Extra.QueryPairs as NQP
import URI.Query as Query import URI.Query as Query
import Web.File.FileReader.Aff (readAsText) import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Data.Lang (allLangs, Lang(EN)) import Gargantext.Components.Lang (allLangs, Lang(EN))
import Gargantext.Components.Forest.Tree.Node (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox) import Gargantext.Components.Forest.Tree.Node (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FileType(..), ID, Name, UploadFileContents(..)) import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FileType(..), ID, Name, UploadFileContents(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createNodeView) import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createNodeView)
......
module Gargantext.Components.Data.Lang where module Gargantext.Components.Lang where
import Data.Argonaut (class EncodeJson, encodeJson) import Data.Argonaut (class EncodeJson, encodeJson)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
......
...@@ -10,7 +10,7 @@ import Gargantext.Components.Lang.Landing.EnUS as En ...@@ -10,7 +10,7 @@ import Gargantext.Components.Lang.Landing.EnUS as En
import Gargantext.Components.Lang.Landing.FrFR as Fr import Gargantext.Components.Lang.Landing.FrFR as Fr
import Gargantext.Components.Data.Landing import Gargantext.Components.Data.Landing
(BlockText(..), BlockTexts(..), Button(..), LandingData(..)) (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Lang (LandingLang(..)) import Gargantext.Components.Lang (LandingLang(..))
type Props = () type Props = ()
......
...@@ -4,16 +4,14 @@ module Gargantext.Components.Search.SearchBar ...@@ -4,16 +4,14 @@ module Gargantext.Components.Search.SearchBar
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Reactix as R import Gargantext.Components.Lang (Lang)
import Reactix.DOM.HTML as H
import Gargantext.Prelude (Unit, pure, ($))
import Gargantext.Components.Data.Lang (Lang)
import Gargantext.Components.Search.Types (allDatabases) -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Components.Search.SearchField (Search, searchField) import Gargantext.Components.Search.SearchField (Search, searchField)
import Gargantext.Components.Search.Types (allDatabases) -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Prelude (Unit, pure, ($))
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types as GT import Gargantext.Types as GT
import Reactix as R
import Reactix.DOM.HTML as H
type Props = ( langs :: Array Lang type Props = ( langs :: Array Lang
, onSearch :: GT.AsyncTaskWithType -> Effect Unit , onSearch :: GT.AsyncTaskWithType -> Effect Unit
......
...@@ -14,7 +14,7 @@ import URI.Query as Q ...@@ -14,7 +14,7 @@ import URI.Query as Q
import Gargantext.Prelude (class Eq, class Ord, class Show, bind, map, pure, show, ($), (<>)) import Gargantext.Prelude (class Eq, class Ord, class Show, bind, map, pure, show, ($), (<>))
import Gargantext.Components.Data.Lang import Gargantext.Components.Lang
import Gargantext.Ends (class ToUrl, backendUrl) import Gargantext.Ends (class ToUrl, backendUrl)
import Gargantext.Routes as GR import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), post) import Gargantext.Sessions (Session(..), post)
...@@ -42,7 +42,7 @@ data DataField = Gargantext ...@@ -42,7 +42,7 @@ data DataField = Gargantext
instance showDataField :: Show DataField where instance showDataField :: Show DataField where
show Gargantext = "Gargantext" show Gargantext = "Gargantext"
show (External x) = "External" -- <> show x show (External _) = "Others" -- <> show x
show Web = "Web" show Web = "Web"
show Files = "Files" show Files = "Files"
...@@ -55,6 +55,11 @@ instance docDataField :: Doc DataField where ...@@ -55,6 +55,11 @@ instance docDataField :: Doc DataField where
derive instance eqDataField :: Eq DataField derive instance eqDataField :: Eq DataField
instance encodeJsonDataField :: EncodeJson DataField where
encodeJson Gargantext = encodeJson "Internal PubMed" -- later Internal Maybe Database
encodeJson (External (Just db)) = encodeJson $ "External " <> show db
encodeJson a = encodeJson (show a)
{- {-
instance eqDataField :: Eq DataField where instance eqDataField :: Eq DataField where
eq Gargantext Gargantext = true eq Gargantext Gargantext = true
...@@ -66,7 +71,8 @@ instance eqDataField :: Eq DataField where ...@@ -66,7 +71,8 @@ instance eqDataField :: Eq DataField where
-- | Database search specifications -- | Database search specifications
allDatabases :: Array Database allDatabases :: Array Database
allDatabases = [ PubMed allDatabases = [ Empty
, PubMed
, HAL Nothing , HAL Nothing
, IsTex , IsTex
, Isidore , Isidore
...@@ -76,6 +82,7 @@ allDatabases = [ PubMed ...@@ -76,6 +82,7 @@ allDatabases = [ PubMed
] ]
data Database = All_Databases data Database = All_Databases
| Empty
| PubMed | PubMed
| HAL (Maybe Org) | HAL (Maybe Org)
| IsTex | IsTex
...@@ -89,6 +96,7 @@ instance showDatabase :: Show Database where ...@@ -89,6 +96,7 @@ instance showDatabase :: Show Database where
show (HAL _)= "HAL" show (HAL _)= "HAL"
show IsTex = "IsTex" show IsTex = "IsTex"
show Isidore= "Isidore" show Isidore= "Isidore"
show Empty = "Empty"
-- show News = "News" -- show News = "News"
-- show SocialNetworks = "Social Networks" -- show SocialNetworks = "Social Networks"
...@@ -98,6 +106,7 @@ instance docDatabase :: Doc Database where ...@@ -98,6 +106,7 @@ instance docDatabase :: Doc Database where
doc (HAL _) = "All open science (archives ouvertes)" doc (HAL _) = "All open science (archives ouvertes)"
doc IsTex = "All Elsevier enriched by CNRS/INIST" doc IsTex = "All Elsevier enriched by CNRS/INIST"
doc Isidore = "All (French) Social Sciences" doc Isidore = "All (French) Social Sciences"
doc Empty = "Empty"
-- doc News = "Web filtered by News" -- doc News = "Web filtered by News"
-- doc SocialNetworks = "Web filtered by MicroBlogs" -- doc SocialNetworks = "Web filtered by MicroBlogs"
...@@ -116,6 +125,7 @@ derive instance eqDatabase :: Eq Database ...@@ -116,6 +125,7 @@ derive instance eqDatabase :: Eq Database
instance encodeJsonDatabase :: EncodeJson Database where instance encodeJsonDatabase :: EncodeJson Database where
encodeJson a = encodeJson (show a) encodeJson a = encodeJson (show a)
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | Organization specifications -- | Organization specifications
...@@ -279,7 +289,7 @@ instance showSearchOrder :: Show SearchOrder where ...@@ -279,7 +289,7 @@ instance showSearchOrder :: Show SearchOrder where
newtype SearchQuery = SearchQuery newtype SearchQuery = SearchQuery
{ query :: String { query :: String
, databases :: Array Database , databases :: Array DataField
, datafield :: Maybe DataField , datafield :: Maybe DataField
, files_id :: Array String , files_id :: Array String
, lang :: Maybe Lang , lang :: Maybe Lang
...@@ -298,10 +308,10 @@ defaultSearchQuery = SearchQuery ...@@ -298,10 +308,10 @@ defaultSearchQuery = SearchQuery
, datafield: Nothing , datafield: Nothing
, files_id : [] , files_id : []
, lang : Nothing , lang : Nothing
, limit: Nothing , limit : Nothing
, node_id : Nothing , node_id : Nothing
, offset: Nothing , offset : Nothing
, order: Nothing , order : Nothing
} }
instance toUrlSessionSearchQuery :: ToUrl Session SearchQuery where instance toUrlSessionSearchQuery :: ToUrl Session SearchQuery where
......
...@@ -468,7 +468,7 @@ derive instance genericAsyncTaskType :: Generic AsyncTaskType _ ...@@ -468,7 +468,7 @@ derive instance genericAsyncTaskType :: Generic AsyncTaskType _
asyncTaskTypePath :: AsyncTaskType -> String asyncTaskTypePath :: AsyncTaskType -> String
asyncTaskTypePath Form = "add/form/async/" asyncTaskTypePath Form = "add/form/async/"
asyncTaskTypePath GraphT = "async/nobody/" asyncTaskTypePath GraphT = "async/nobody/"
asyncTaskTypePath Query = "add/query/async/" asyncTaskTypePath Query = "add/query/async/nobody/"
type AsyncTaskID = String type AsyncTaskID = String
......
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