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
Christian Merten
purescript-gargantext
Commits
fe9e6a7a
Commit
fe9e6a7a
authored
Jun 19, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REFACT|FIX] iframe search with more space
parent
ad0ed0bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
53 deletions
+51
-53
Frame.purs
...text/Components/Forest/Tree/Node/Action/Search/Frame.purs
+13
-17
SearchBar.purs
.../Components/Forest/Tree/Node/Action/Search/SearchBar.purs
+1
-1
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+10
-20
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+19
-0
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+4
-4
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+4
-11
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Frame.purs
View file @
fe9e6a7a
...
@@ -8,9 +8,7 @@ import Data.Maybe (Maybe(..))
...
@@ -8,9 +8,7 @@ import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Nullable (Nullable)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (Search, isIsTex_Advanced)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..))
import Gargantext.Components.Forest.Tree.Node.Box.Types
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==))
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -20,11 +18,10 @@ import URI.Query as Query
...
@@ -20,11 +18,10 @@ import URI.Query as Query
--------------------
--------------------
-- | Iframes
-- | Iframes
searchIframes :: Record NodePopupProps
searchIframes :: R.State Search
-> R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Ref (Nullable DOM.Element)
-> R.Element
-> R.Element
searchIframes
{nodeType}
search@(search' /\ _) iframeRef =
searchIframes search@(search' /\ _) iframeRef =
if isIsTex_Advanced search'.datafield then
if isIsTex_Advanced search'.datafield then
H.div { className: "istex-search panel panel-default" }
H.div { className: "istex-search panel panel-default" }
[ iframeWith "https://istex.gargantext.org" search iframeRef ]
[ iframeWith "https://istex.gargantext.org" search iframeRef ]
...
@@ -41,15 +38,14 @@ iframeWith :: String
...
@@ -41,15 +38,14 @@ iframeWith :: String
-> R.Element
-> R.Element
iframeWith url (search /\ setSearch) iframeRef =
iframeWith url (search /\ setSearch) iframeRef =
H.iframe { src: isTexTermUrl search.term
H.iframe { src: isTexTermUrl search.term
,width: "100%"
, width: "100%"
,height: "100%"
, height: "100%"
,ref: iframeRef
, ref: iframeRef
,on: {
, on: { load: \_ -> do
load: \_ -> do
addEventListener window "message" (changeSearchOnMessage url)
addEventListener window "message" (changeSearchOnMessage url)
R2.postMessage iframeRef search.term
R2.postMessage iframeRef search.term
}
}
} []
} []
where
where
changeSearchOnMessage :: String -> Callback MessageEvent
changeSearchOnMessage :: String -> Callback MessageEvent
changeSearchOnMessage url' =
changeSearchOnMessage url' =
...
@@ -63,7 +59,7 @@ iframeWith url (search /\ setSearch) iframeRef =
...
@@ -63,7 +59,7 @@ iframeWith url (search /\ setSearch) iframeRef =
where
where
query = Query.print $ NQP.print identity identity qp
query = Query.print $ NQP.print identity identity qp
qp = NQP.QueryPairs [
qp = NQP.QueryPairs [
Tuple (NQP.keyFromString "query")
Tuple (NQP.keyFromString "query")
(Just (NQP.valueFromString term))
(Just (NQP.valueFromString term))
]
]
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchBar.purs
View file @
fe9e6a7a
...
@@ -4,7 +4,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar
...
@@ -4,7 +4,7 @@ module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (
Search,
searchField)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (searchField)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.Lang (Lang)
import Gargantext.Prelude (Unit, pure, ($))
import Gargantext.Prelude (Unit, pure, ($))
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
fe9e6a7a
module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField
module Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField
( Search, Props, defaultSearch, searchField, searchFieldComponent, isIsTex, isIsTex_Advanced)
where
where
import DOM.Simple.Console (log, log2)
import DOM.Simple.Console (log, log2)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Nullable (null)
import Data.Newtype (over)
import Data.Newtype (over)
import Data.Set as Set
import Data.Set as Set
import Data.String (length)
import Data.String (length)
...
@@ -11,10 +12,11 @@ import Data.Tuple.Nested ((/\))
...
@@ -11,10 +12,11 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch, datafield2database)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Database(..), IMT_org(..), Org(..), SearchQuery(..), allIMTorgs, allOrgs, dataFields, defaultSearchQuery, doc, performSearch, datafield2database
, Search
)
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.Lang (Lang)
import Gargantext.Prelude (Unit, bind, discard, map, pure, show, ($), (&&), (<), (<$>), (<>), (==), read)
import Gargantext.Prelude (Unit, bind, discard, map, pure, show, ($), (&&), (<), (<$>), (<>), (==), read)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Frame (searchIframes)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
...
@@ -27,14 +29,6 @@ select :: forall props.
...
@@ -27,14 +29,6 @@ select :: forall props.
-> R.Element
-> R.Element
select = R.createElement "select"
select = R.createElement "select"
type Search = { databases :: Database
, datafield :: Maybe DataField
, url :: String
, lang :: Maybe Lang
, node_id :: Maybe Int
, term :: String
}
eqSearch :: Search -> Search -> Boolean
eqSearch :: Search -> Search -> Boolean
eqSearch s s' = (s.databases == s'.databases)
eqSearch s s' = (s.databases == s'.databases)
&& (s.datafield == s'.datafield)
&& (s.datafield == s'.datafield)
...
@@ -70,6 +64,7 @@ searchFieldComponent :: R.Component Props
...
@@ -70,6 +64,7 @@ searchFieldComponent :: R.Component Props
searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
where
where
cpt props@{onSearch, search: search@(s /\ _)} _ = do
cpt props@{onSearch, search: search@(s /\ _)} _ = do
iframeRef <- R.useRef null
pure $
pure $
H.div { className: "search-field-group", style: { width: "100%" } }
H.div { className: "search-field-group", style: { width: "100%" } }
[
[
...
@@ -82,6 +77,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -82,6 +77,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
H.div {}[]
H.div {}[]
else
else
H.div {} [ dataFieldNav search dataFields
H.div {} [ dataFieldNav search dataFields
, if isExternal s.datafield
, if isExternal s.datafield
then databaseInput search props.databases
then databaseInput search props.databases
else H.div {} []
else H.div {} []
...
@@ -97,7 +93,11 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -97,7 +93,11 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
, if isCNRS s.datafield
, if isCNRS s.datafield
then componentCNRS search
then componentCNRS search
else H.div {} []
else H.div {} []
, H.div {} [ searchIframes search iframeRef ]
]
]
]
]
]
]
, H.div { className : "panel-footer" }
, H.div { className : "panel-footer" }
...
@@ -160,16 +160,6 @@ isIsTex ( Just
...
@@ -160,16 +160,6 @@ isIsTex ( Just
) = true
) = true
isIsTex _ = false
isIsTex _ = false
isIsTex_Advanced :: Maybe DataField -> Boolean
isIsTex_Advanced ( Just
( External
( Just ( IsTex_Advanced)
)
)
) = true
isIsTex_Advanced _ = false
isIMT :: Maybe DataField -> Boolean
isIMT :: Maybe DataField -> Boolean
isIMT ( Just
isIMT ( Just
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
fe9e6a7a
...
@@ -18,6 +18,25 @@ import Gargantext.Types as GT
...
@@ -18,6 +18,25 @@ import Gargantext.Types as GT
import URI.Extra.QueryPairs as QP
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import URI.Query as Q
type Search = { databases :: Database
, datafield :: Maybe DataField
, url :: String
, lang :: Maybe Lang
, node_id :: Maybe Int
, term :: String
}
isIsTex_Advanced :: Maybe DataField -> Boolean
isIsTex_Advanced ( Just
( External
( Just ( IsTex_Advanced)
)
)
) = true
isIsTex_Advanced _ = false
------------------------------------------------------------------------
------------------------------------------------------------------------
class Doc a where
class Doc a where
doc :: a -> String
doc :: a -> String
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
fe9e6a7a
...
@@ -18,25 +18,25 @@ import Reactix.DOM.HTML as H
...
@@ -18,25 +18,25 @@ import Reactix.DOM.HTML as H
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff GT.AsyncTaskWithType
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff GT.AsyncTaskWithType
updateRequest (UpdateNodeParamsList meth) session nodeId = do
updateRequest (UpdateNodeParamsList meth) session nodeId = do
task <- post session p meth
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsGraph meth) session nodeId = do
updateRequest (UpdateNodeParamsGraph meth) session nodeId = do
task <- post session p meth
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsTexts meth) session nodeId = do
updateRequest (UpdateNodeParamsTexts meth) session nodeId = do
task <- post session p meth
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsBoard meth) session nodeId = do
updateRequest (UpdateNodeParamsBoard meth) session nodeId = do
task <- post session p meth
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
fe9e6a7a
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node.Box where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node.Box where
import Data.Array (length)
import Data.Array (length)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (null)
import Data.String as S
import Data.String as S
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
...
@@ -15,7 +14,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
...
@@ -15,7 +14,6 @@ import Gargantext.Components.Forest.Tree.Node.Action.Documentation (actionDoc)
import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload)
import Gargantext.Components.Forest.Tree.Node.Action.Download (actionDownload)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameAction)
import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameAction)
import Gargantext.Components.Forest.Tree.Node.Action.Search (actionSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Search (actionSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Frame (searchIframes)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
...
@@ -52,10 +50,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
...
@@ -52,10 +50,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
where
where
cpt p _ = do
cpt p _ = do
isOpen <- R.useState' false
isOpen <- R.useState' false
iframeRef <- R.useRef null
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' { action : Nothing
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' { action: Nothing
, id : p.id
, id: p.id
, name : p.name
, name: p.name
, nodeType: p.nodeType
, nodeType: p.nodeType
}
}
search <- R.useState' $ defaultSearch { node_id = Just p.id }
search <- R.useState' $ defaultSearch { node_id = Just p.id }
...
@@ -76,10 +73,6 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
...
@@ -76,10 +73,6 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
, panelBody nodePopupState p
, panelBody nodePopupState p
, mPanelAction nodePopupState p
, mPanelAction nodePopupState p
]
]
, if nodePopup.action == Just SearchBox then
H.div {} [ searchIframes p search iframeRef ]
else
H.div {} []
]
]
]
]
where
where
...
@@ -161,7 +154,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
...
@@ -161,7 +154,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
mPanelAction :: R.State (Record NodePopupS)
mPanelAction :: R.State (Record NodePopupS)
-> Record NodePopupProps
-> Record NodePopupProps
-> R.Element
-> R.Element
mPanelAction ({action: Nothing
} /\ _) _
= H.div {} []
mPanelAction ({action: Nothing
} /\ _) _
= H.div {} []
mPanelAction ({action: Just action} /\ _) props =
mPanelAction ({action: Just action} /\ _) props =
panelAction { action
panelAction { action
, dispatch : props.dispatch
, dispatch : props.dispatch
...
...
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