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