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
8602174e
Commit
8602174e
authored
Nov 08, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SEARCH FORM] adding node_id.
parent
8c5aa0b4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
10 deletions
+15
-10
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+1
-1
SearchBar.purs
src/Gargantext/Components/Search/SearchBar.purs
+5
-4
SearchField.purs
src/Gargantext/Components/Search/SearchField.purs
+9
-5
No files found.
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
8602174e
...
...
@@ -317,7 +317,7 @@ panelAction d {id,name,nodeType,action, session} p = case action of
(Just Download) -> R.fragment [ H.p {} [H.text $ "Soon, you will be able to dowload your file here"]]
(Just SearchBox) -> R.fragment [ H.p {} [ H.text $ "Search and create a private corpus with the search query as corpus name." ]
, searchBar {session, databases:allDatabases, langs:allLangs}
, searchBar {session, databases:allDatabases, langs:allLangs
, node_id: (Just id)
}
]
(Just Delete) -> case nodeType of
NodeUser -> R.fragment [ H.div {} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."]]
...
...
src/Gargantext/Components/Search/SearchBar.purs
View file @
8602174e
...
...
@@ -23,6 +23,7 @@ import Gargantext.Sessions (Session)
type Props = ( session :: Session
, databases :: Array Database
, langs :: Array Lang
, node_id :: Maybe Int
)
searchBar :: Record Props -> R.Element
...
...
@@ -31,10 +32,10 @@ searchBar props = R.createElement searchBarCpt props []
searchBarCpt :: R.Component Props
searchBarCpt = R.hooksComponent "G.C.Node.SearchBar.searchBar" cpt
where
cpt {session, databases, langs} _ = do
cpt {session, databases, langs
, node_id
} _ = do
search <- R.useState' Nothing
onSearchChange session search
pure $ H.div { className: "" } [ searchField {databases, langs, search}]
pure $ H.div { className: "" } [ searchField {databases, langs, search
, node_id
}]
onSearchChange :: Session -> R.State (Maybe Search) -> R.Hooks Unit
...
...
@@ -58,8 +59,8 @@ onSearchChange session (search /\ setSearch) =
searchQuery {database: Nothing, lang, term} =
over SearchQuery (_ {query=term}) defaultSearchQuery
searchQuery {database: Just db, lang, term, filters} =
over SearchQuery (_ {databases=[db], lang=lang, query=term, filters=filters'}) defaultSearchQuery
searchQuery {database: Just db, lang, term, filters
, node_id
} =
over SearchQuery (_ {databases=[db], lang=lang, query=term, filters=filters'
, node_id=node_id
}) defaultSearchQuery
where
filters' = toInt filters
toInt (Just (HAL_StructId {structIds})) = Set.toUnfoldable structIds
...
...
src/Gargantext/Components/Search/SearchField.purs
View file @
8602174e
...
...
@@ -24,6 +24,7 @@ type Search = { database :: Maybe Database
, lang :: Maybe Lang
, org :: Maybe Org
, filters :: Maybe HAL_Filters
, node_id :: Maybe Int
}
defaultSearch :: Search
...
...
@@ -32,6 +33,7 @@ defaultSearch = { database: Nothing
, lang: Nothing
, org : Nothing
, filters: Nothing
, node_id: Nothing
}
type Props =
...
...
@@ -40,6 +42,7 @@ type Props =
, langs :: Array Lang
-- State hook for a search, how we get data in and out
, search :: R.State (Maybe Search)
, node_id :: Maybe Int
)
searchField :: Record Props -> R.Element
...
...
@@ -48,7 +51,7 @@ searchField p = R.createElement searchFieldComponent p []
searchFieldComponent :: R.Memo Props
searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
where
cpt props _ = do
cpt props
@{node_id}
_ = do
let search = maybe defaultSearch identity (fst props.search)
term <- R.useState' search.term
db@(curDb /\ setDb) <- R.useState' (Nothing :: Maybe Database)
...
...
@@ -99,7 +102,7 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
else
div {} []
, div { className: "" }
[ submitButton db term lang org filters props.search ]
[ submitButton
node_id
db term lang org filters props.search ]
]
hasChanged p p' = (fst p.search /= fst p'.search)
|| (p.databases /= p'.databases )
...
...
@@ -220,14 +223,15 @@ searchInput (term /\ setTerm) =
]
submitButton :: R.State (Maybe Database)
submitButton :: Maybe Int
-> R.State (Maybe Database)
-> R.State String
-> R.State (Maybe Lang)
-> R.State (Maybe Org)
-> R.State (Maybe HAL_Filters)
-> R.State (Maybe Search)
-> R.Element
submitButton (database /\ _) (term /\ _) (lang /\ _) (org/\_) (filters /\ _) (_ /\ setSearch) =
submitButton
node_id
(database /\ _) (term /\ _) (lang /\ _) (org/\_) (filters /\ _) (_ /\ setSearch) =
R.fragment [ div { className : "" } []
, button { className: "btn btn-primary"
, type: "button"
...
...
@@ -238,4 +242,4 @@ submitButton (database /\ _) (term /\ _) (lang /\ _) (org/\_) (filters /\ _) (_
doSearch = \_ -> do
case term of
"" -> setSearch $ const Nothing
_ -> setSearch $ const $ Just { database, lang, filters, term, org}
_ -> setSearch $ const $ Just { database, lang, filters, term, org
, node_id
}
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