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
10f470b7
Commit
10f470b7
authored
Jan 27, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tree] async query fixes
parent
212708d7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
15 deletions
+23
-15
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+1
-1
SearchField.purs
src/Gargantext/Components/Search/SearchField.purs
+11
-7
Types.purs
src/Gargantext/Components/Search/Types.purs
+11
-7
No files found.
src/Gargantext/Components/Forest/Tree.purs
View file @
10f470b7
...
@@ -152,7 +152,7 @@ performAction session (_ /\ setReload) (s@{tree: NTree (LNode {id}) _} /\ setTre
...
@@ -152,7 +152,7 @@ performAction session (_ /\ setReload) (s@{tree: NTree (LNode {id}) _} /\ setTre
performAction session _ ({tree: NTree (LNode {id}) _} /\ setTree) (SearchQuery task) = do
performAction session _ ({tree: NTree (LNode {id}) _} /\ setTree) (SearchQuery task) = do
liftEffect $ setTree $ \t@{asyncTasks} -> t { asyncTasks = A.cons task asyncTasks }
liftEffect $ setTree $ \t@{asyncTasks} -> t { asyncTasks = A.cons task asyncTasks }
liftEffect $ log2 "
search query,
task:" task
liftEffect $ log2 "
[performAction] SearchQuery
task:" task
performAction session _ ({tree: NTree (LNode {id}) _} /\ setTree) (Submit name) = do
performAction session _ ({tree: NTree (LNode {id}) _} /\ setTree) (Submit name) = do
void $ renameNode session id $ RenameValue {name}
void $ renameNode session id $ RenameValue {name}
...
...
src/Gargantext/Components/Search/SearchField.purs
View file @
10f470b7
...
@@ -29,23 +29,26 @@ select :: forall props.
...
@@ -29,23 +29,26 @@ select :: forall props.
-> R.Element
-> R.Element
select = R.createElement "select"
select = R.createElement "select"
type Search = { data
field :: Maybe DataField
type Search = { data
bases :: Array Database
,
term :: String
,
datafield :: Maybe DataField
, lang :: Maybe Lang
, lang :: Maybe Lang
, node_id :: Maybe Int
, node_id :: Maybe Int
, term :: String
}
}
eqSearch :: Search -> Search -> Boolean
eqSearch :: Search -> Search -> Boolean
eqSearch s s' = (s.datafield == s'.datafield)
eqSearch s s' = (s.databases == s'.databases)
&& (s.datafield == s'.datafield)
&& (s.term == s'.term)
&& (s.term == s'.term)
&& (s.lang == s'.lang)
&& (s.lang == s'.lang)
&& (s.node_id == s'.node_id)
&& (s.node_id == s'.node_id)
defaultSearch :: Search
defaultSearch :: Search
defaultSearch = { datafield: Nothing
defaultSearch = { databases: []
, term: ""
, datafield: Nothing
, lang: Nothing
, node_id: Nothing
, node_id: Nothing
, lang: Nothing
, term: ""
}
}
type Props =
type Props =
...
@@ -368,7 +371,8 @@ searchQuery :: Search -> SearchQuery
...
@@ -368,7 +371,8 @@ searchQuery :: Search -> SearchQuery
searchQuery {datafield: Nothing, term} =
searchQuery {datafield: Nothing, term} =
over SearchQuery (_ {query=term}) defaultSearchQuery
over SearchQuery (_ {query=term}) defaultSearchQuery
searchQuery {databases, datafield, lang, term, node_id} =
searchQuery {databases, datafield, lang, term, node_id} =
over SearchQuery (_ { datafield=datafield
over SearchQuery (_ { databases=databases
, datafield=datafield
, lang=lang
, lang=lang
, query=term
, query=term
, node_id=node_id
, node_id=node_id
...
...
src/Gargantext/Components/Search/Types.purs
View file @
10f470b7
...
@@ -304,14 +304,16 @@ instance showSearchOrder :: Show SearchOrder where
...
@@ -304,14 +304,16 @@ instance showSearchOrder :: Show SearchOrder where
show ScoreDesc = "ScoreDesc"
show ScoreDesc = "ScoreDesc"
------------------------------------------------------------------------
------------------------------------------------------------------------
newtype SearchQuery = SearchQuery
newtype SearchQuery = SearchQuery
{ query :: String
{ query :: String
, databases :: Array Database
, datafield :: Maybe DataField
, datafield :: Maybe DataField
, files_id :: Array String
, lang :: Maybe Lang
, lang :: Maybe Lang
, limit :: Maybe Int
, node_id :: Maybe Int
, node_id :: Maybe Int
, files_id :: Array String
, offset :: Maybe Int
, offset :: Maybe Int
, limit :: Maybe Int
, order :: Maybe SearchOrder
, order :: Maybe SearchOrder
}
}
...
@@ -320,12 +322,13 @@ derive instance newtypeSearchQuery :: Newtype SearchQuery _
...
@@ -320,12 +322,13 @@ derive instance newtypeSearchQuery :: Newtype SearchQuery _
defaultSearchQuery :: SearchQuery
defaultSearchQuery :: SearchQuery
defaultSearchQuery = SearchQuery
defaultSearchQuery = SearchQuery
{ query: ""
{ query: ""
, databases: []
, datafield: Nothing
, datafield: Nothing
, files_id : []
, lang : Nothing
, lang : Nothing
, limit: Nothing
, node_id : Nothing
, node_id : Nothing
, files_id : []
, offset: Nothing
, offset: Nothing
, limit: Nothing
, order: Nothing
, order: Nothing
}
}
...
@@ -344,12 +347,13 @@ instance searchQueryToQuery :: GT.ToQuery SearchQuery where
...
@@ -344,12 +347,13 @@ instance searchQueryToQuery :: GT.ToQuery SearchQuery where
[ QP.keyFromString k /\ Just (QP.valueFromString $ show v) ]
[ QP.keyFromString k /\ Just (QP.valueFromString $ show v) ]
instance encodeJsonSearchQuery :: EncodeJson SearchQuery where
instance encodeJsonSearchQuery :: EncodeJson SearchQuery where
encodeJson (SearchQuery {query, datafield, node_id, lang})
encodeJson (SearchQuery {query, data
bases, data
field, node_id, lang})
= "query" := query
= "query" := query
~> "datafield" := "" -- fromMaybe "" datafield
-- ~> "datafield" := "" -- fromMaybe "" datafield
~> "databases" := databases
~> "lang" := maybe "EN" show lang
~> "node_id" := fromMaybe 0 node_id
~> "node_id" := fromMaybe 0 node_id
-- ~> "files_id" := files_id
-- ~> "files_id" := files_id
~> "lang" := maybe "EN" show lang
~> jsonEmptyObject
~> jsonEmptyObject
performSearch :: Session -> Int -> SearchQuery -> Aff GT.AsyncTaskWithType
performSearch :: Session -> Int -> SearchQuery -> Aff GT.AsyncTaskWithType
...
...
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