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
131
Issues
131
List
Board
Labels
Milestones
Merge Requests
3
Merge Requests
3
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
c10476e2
Commit
c10476e2
authored
Jul 27, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[search] searx: fix datafield serialization for web
parent
b5a59874
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
33 deletions
+34
-33
Search.purs
...Gargantext/Components/Forest/Tree/Node/Action/Search.purs
+3
-6
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+3
-3
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+3
-2
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+25
-22
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Search.purs
View file @
c10476e2
...
...
@@ -10,7 +10,6 @@ import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Lang (allLangs)
...
...
@@ -26,7 +25,6 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search"
type Props =
( dispatch :: Action -> Aff Unit
, id :: Maybe ID
, nodePopup :: Maybe NodePopup
, session :: Session )
-- | Action : Search
...
...
@@ -35,23 +33,22 @@ actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt
where
cpt { dispatch, id,
nodePopup,
session } _ = do
cpt { dispatch, id, session } _ = do
search <- T.useBox $ defaultSearch { node_id = id }
pure $ R.fragment [ H.p { className: "action-search" }
[ H.text $ "Search and create a private "
<> "corpus with the search query as corpus name." ]
, searchBar { langs: allLangs
, onSearch: searchOn dispatch
nodePopup
, onSearch: searchOn dispatch
, search
, session
} []
]
where
searchOn :: (Action -> Aff Unit)
-> Maybe NodePopup
-> GT.AsyncTaskWithType
-> Effect Unit
searchOn dispatch'
p
task = do
searchOn dispatch' task = do
_ <- launchAff $ dispatch' (DoSearch task)
-- close popup
_ <- launchAff $ dispatch' ClosePopover
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
c10476e2
...
...
@@ -32,7 +32,7 @@ defaultSearch = { databases: Empty
, node_id : Nothing
, lang : Nothing
, term : ""
, url: ""
, url
: ""
}
type Props =
...
...
@@ -130,7 +130,7 @@ componentCNRS = R.createElement componentCNRSCpt
componentCNRSCpt :: R.Component ComponentProps
componentCNRSCpt = here.component "componentCNRS" cpt
where
cpt
{ search }
_ = do
cpt
_
_ = do
pure $ R.fragment [
H.div {} []
--, filterInput fi
...
...
@@ -273,7 +273,7 @@ dataFieldNavCpt = here.component "dataFieldNav" cpt
search'@{ datafield } <- T.useLive T.unequal search
pure $ R.fragment [ H.div { className: "text-primary center"} [H.text "with DataField"]
, H.div {className: "nav nav-tabs"} ((liItem search') <$> data
F
ields)
, H.div {className: "nav nav-tabs"} ((liItem search') <$> data
f
ields)
, H.div {className: "center"} [ H.text
$ maybe "TODO: add Doc Instance" doc datafield
]
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
c10476e2
...
...
@@ -11,7 +11,6 @@ import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import URI.Extra.QueryPairs as QP
import URI.Query as Q
...
...
@@ -75,6 +74,7 @@ derive instance Eq DataField
instance JSON.WriteForeign DataField where
writeImpl Gargantext = JSON.writeImpl "Internal PubMed"
writeImpl (External (Just db)) = JSON.writeImpl $ "External " <> show db
writeImpl Web = JSON.writeImpl $ "Web"
writeImpl f = JSON.writeImpl $ show f
----------------------------------------
...
...
@@ -361,7 +361,8 @@ instance GT.ToQuery SearchQuery where
instance JSON.WriteForeign SearchQuery where
writeImpl (SearchQuery { datafield, databases, lang, node_id, query }) =
JSON.writeImpl { query: String.replace (String.Pattern "\"") (String.Replacement "\\\"") query
, databases: databases
, databases
, datafield
, lang: maybe "EN" show lang
, node_id: fromMaybe 0 node_id
}
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
c10476e2
...
...
@@ -5,8 +5,12 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Add (addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Contact as Contact
import Gargantext.Components.Forest.Tree.Node.Action.Delete (actionDelete)
import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
...
...
@@ -22,15 +26,12 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (actionUpload)
import Gargantext.Components.Forest.Tree.Node.Box.Types (NodePopupProps, NodePopupS)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Status (Status(..), hasStatus)
import Gargantext.Components.Forest.Tree.Node.Tools (
textInputBox, fragmentPT, panel
)
import Gargantext.Components.Forest.Tree.Node.Tools (
fragmentPT, textInputBox
)
import Gargantext.Sessions (Session)
import Gargantext.Types (Name, ID, prettyNodeType)
import Gargantext.Types as GT
import Gargantext.Utils.Glyphicon (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Box"
...
...
@@ -73,15 +74,14 @@ nodePopupCpt = here.component "nodePopupView" cpt where
, H.div { className: "col-1" } [ editIcon renameIsOpen open ]
, H.div { className: "col-1" }
[ H.a { type: "button", on: { click: closePopover p }, title: "Close"
, className: glyphicon "window-close" } [] ]]] where
SettingsBox { edit, doc, buttons } = settingsBox nodeType
, className: glyphicon "window-close" } [] ]]]
editIcon _ true = H.div {} []
editIcon isOpen false =
H.a { className: glyphicon "pencil", id: "rename1"
, title : "Rename", on: { click: \_ -> T.write_ true isOpen } } []
panelBody :: T.Box (Maybe NodeAction) -> Record NodePopupProps -> R.Element
panelBody nodePopupState {
dispatch: d, nodeType
} =
let (SettingsBox {
edit,
doc, buttons}) = settingsBox nodeType in
panelBody nodePopupState {
nodeType
} =
let (SettingsBox { doc, buttons}) = settingsBox nodeType in
H.div {className: "card-body flex-space-between"}
$ [ H.p { className: "spacer" } []
, H.div { className: "flex-center" }
...
...
@@ -95,8 +95,13 @@ nodePopupCpt = here.component "nodePopupView" cpt where
mPanelAction :: Record NodePopupS -> Record NodePopupProps -> R.Element
mPanelAction { action: Just action }
{ dispatch, id, name, nodeType, session, handed } =
panelAction { action, dispatch, id, name, nodeType, session
, handed, nodePopup: Just NodePopup }
panelAction { action
, dispatch
, handed
, id
, name
, nodeType
, session }
mPanelAction { action: Nothing } _ =
H.div { className: "card-footer" }
[ H.div {className:"center fa-hand-pointer-o"}
...
...
@@ -155,16 +160,14 @@ type PanelActionProps =
( id :: ID
, action :: NodeAction
, dispatch :: Action -> Aff Unit
, handed :: GT.Handed
, name :: Name
, nodePopup :: Maybe NodePopup
, nodeType :: GT.NodeType
, session :: Session
, handed :: GT.Handed
)
panelAction :: Record PanelActionProps -> R.Element
panelAction p = R.createElement panelActionCpt p []
panelActionCpt :: R.Component PanelActionProps
panelActionCpt = here.component "panelAction" cpt
where
...
...
@@ -172,10 +175,10 @@ panelActionCpt = here.component "panelAction" cpt
cpt {action: Download, id, nodeType, session} _ = pure $ actionDownload { id, nodeType, session } []
cpt {action: Upload, dispatch, id, nodeType, session} _ = pure $ actionUpload { dispatch, id, nodeType, session } []
cpt {action: Delete, nodeType, dispatch} _ = pure $ actionDelete { dispatch, nodeType } []
cpt {action: Add xs, dispatch, id, name, nodeType} _ =
cpt {action: Add xs, dispatch, id, name, nodeType} _
=
pure $ addNodeView {dispatch, id, name, nodeType, nodeTypes: xs} []
cpt {action: Refresh , dispatch,
id, nodeType, session} _
= pure $ update { dispatch, nodeType } []
cpt {action: Config
, dispatch, id, nodeType, session} _
=
cpt {action: Refresh , dispatch,
nodeType} _
= pure $ update { dispatch, nodeType } []
cpt {action: Config
, nodeType} _
=
pure $ fragmentPT $ "Config " <> show nodeType
-- Functions using SubTree
cpt {action: Merge {subTreeParams}, dispatch, id, nodeType, session, handed} _ =
...
...
@@ -184,10 +187,10 @@ panelActionCpt = here.component "panelAction" cpt
pure $ moveNode { dispatch, id, nodeType, session, subTreeParams, handed } []
cpt {action: Link {subTreeParams}, dispatch, id, nodeType, session, handed} _ =
pure $ linkNode {dispatch, id, nodeType, session, subTreeParams, handed} []
cpt {action : Share, dispatch, id
, name
} _ = pure $ Share.shareNode { dispatch, id } []
cpt {action : AddingContact, dispatch, id
, name
} _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt {action : Share, dispatch, id } _ = pure $ Share.shareNode { dispatch, id } []
cpt {action : AddingContact, dispatch, id } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt {action : Publish {subTreeParams}, dispatch, id, nodeType, session, handed} _ =
pure $ Share.publishNode { dispatch, handed, id, nodeType, session, subTreeParams } []
cpt
props@{action: SearchBox, id, session, dispatch, nodePopup
} _ =
pure $ actionSearch { dispatch, id: (Just id),
nodePopup,
session } []
cpt
{action: SearchBox, id, session, dispatch
} _ =
pure $ actionSearch { dispatch, id: (Just id), session } []
cpt _ _ = pure $ H.div {} []
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