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
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
performAction session _ ({tree: NTree (LNode {id}) _} /\ setTree) (SearchQuery task) = do
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
void $ renameNode session id $ RenameValue {name}
...
...
src/Gargantext/Components/Search/SearchField.purs
View file @
10f470b7
...
...
@@ -29,23 +29,26 @@ select :: forall props.
-> R.Element
select = R.createElement "select"
type Search = { data
field :: Maybe DataField
,
term :: String
type Search = { data
bases :: Array Database
,
datafield :: Maybe DataField
, lang :: Maybe Lang
, node_id :: Maybe Int
, term :: String
}
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.lang == s'.lang)
&& (s.node_id == s'.node_id)
defaultSearch :: Search
defaultSearch = { datafield: Nothing
, term: ""
, lang: Nothing
defaultSearch = { databases: []
, datafield: Nothing
, node_id: Nothing
, lang: Nothing
, term: ""
}
type Props =
...
...
@@ -368,7 +371,8 @@ searchQuery :: Search -> SearchQuery
searchQuery {datafield: Nothing, term} =
over SearchQuery (_ {query=term}) defaultSearchQuery
searchQuery {databases, datafield, lang, term, node_id} =
over SearchQuery (_ { datafield=datafield
over SearchQuery (_ { databases=databases
, datafield=datafield
, lang=lang
, query=term
, node_id=node_id
...
...
src/Gargantext/Components/Search/Types.purs
View file @
10f470b7
...
...
@@ -304,14 +304,16 @@ instance showSearchOrder :: Show SearchOrder where
show ScoreDesc = "ScoreDesc"
------------------------------------------------------------------------
newtype SearchQuery = SearchQuery
{ query :: String
, databases :: Array Database
, datafield :: Maybe DataField
, files_id :: Array String
, lang :: Maybe Lang
, limit :: Maybe Int
, node_id :: Maybe Int
, files_id :: Array String
, offset :: Maybe Int
, limit :: Maybe Int
, order :: Maybe SearchOrder
}
...
...
@@ -320,12 +322,13 @@ derive instance newtypeSearchQuery :: Newtype SearchQuery _
defaultSearchQuery :: SearchQuery
defaultSearchQuery = SearchQuery
{ query: ""
, databases: []
, datafield: Nothing
, files_id : []
, lang : Nothing
, limit: Nothing
, node_id : Nothing
, files_id : []
, offset: Nothing
, limit: Nothing
, order: Nothing
}
...
...
@@ -344,12 +347,13 @@ instance searchQueryToQuery :: GT.ToQuery SearchQuery where
[ QP.keyFromString k /\ Just (QP.valueFromString $ show v) ]
instance encodeJsonSearchQuery :: EncodeJson SearchQuery where
encodeJson (SearchQuery {query, datafield, node_id, lang})
encodeJson (SearchQuery {query, data
bases, data
field, node_id, lang})
= "query" := query
~> "datafield" := "" -- fromMaybe "" datafield
-- ~> "datafield" := "" -- fromMaybe "" datafield
~> "databases" := databases
~> "lang" := maybe "EN" show lang
~> "node_id" := fromMaybe 0 node_id
-- ~> "files_id" := files_id
~> "lang" := maybe "EN" show lang
~> jsonEmptyObject
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