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
Grégoire Locqueville
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(..))
import Data.Nullable (Nullable)
import Data.Tuple (Tuple(..))
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(..))
import Gargantext.Components.Forest.Tree.Node.Box.Types
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==))
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -20,11 +18,10 @@ import URI.Query as Query
--------------------
-- | Iframes
searchIframes :: Record NodePopupProps
-> R.State Search
searchIframes :: R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Element
searchIframes
{nodeType}
search@(search' /\ _) iframeRef =
searchIframes search@(search' /\ _) iframeRef =
if isIsTex_Advanced search'.datafield then
H.div { className: "istex-search panel panel-default" }
[ iframeWith "https://istex.gargantext.org" search iframeRef ]
...
...
@@ -41,15 +38,14 @@ iframeWith :: String
-> R.Element
iframeWith url (search /\ setSearch) iframeRef =
H.iframe { src: isTexTermUrl search.term
,width: "100%"
,height: "100%"
,ref: iframeRef
,on: {
load: \_ -> do
addEventListener window "message" (changeSearchOnMessage url)
R2.postMessage iframeRef search.term
, width: "100%"
, height: "100%"
, ref: iframeRef
, on: { load: \_ -> do
addEventListener window "message" (changeSearchOnMessage url)
R2.postMessage iframeRef search.term
}
} []
} []
where
changeSearchOnMessage :: String -> Callback MessageEvent
changeSearchOnMessage url' =
...
...
@@ -63,7 +59,7 @@ iframeWith url (search /\ setSearch) iframeRef =
where
query = Query.print $ NQP.print identity identity qp
qp = NQP.QueryPairs [
Tuple (NQP.keyFromString "query")
(Just (NQP.valueFromString term))
]
qp = NQP.QueryPairs [
Tuple (NQP.keyFromString "query")
(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
import Data.Tuple.Nested ((/\))
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.Lang (Lang)
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
( Search, Props, defaultSearch, searchField, searchFieldComponent, isIsTex, isIsTex_Advanced)
where
where
import DOM.Simple.Console (log, log2)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Nullable (null)
import Data.Newtype (over)
import Data.Set as Set
import Data.String (length)
...
...
@@ -11,10 +12,11 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect.Aff (launchAff_)
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.Prelude (Unit, bind, discard, map, pure, show, ($), (&&), (<), (<$>), (<>), (==), read)
import Gargantext.Sessions (Session)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Frame (searchIframes)
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Reactix as R
...
...
@@ -27,14 +29,6 @@ select :: forall props.
-> R.Element
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 s s' = (s.databases == s'.databases)
&& (s.datafield == s'.datafield)
...
...
@@ -70,6 +64,7 @@ searchFieldComponent :: R.Component Props
searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
where
cpt props@{onSearch, search: search@(s /\ _)} _ = do
iframeRef <- R.useRef null
pure $
H.div { className: "search-field-group", style: { width: "100%" } }
[
...
...
@@ -82,6 +77,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
H.div {}[]
else
H.div {} [ dataFieldNav search dataFields
, if isExternal s.datafield
then databaseInput search props.databases
else H.div {} []
...
...
@@ -97,7 +93,11 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
, if isCNRS s.datafield
then componentCNRS search
else H.div {} []
, H.div {} [ searchIframes search iframeRef ]
]
]
]
, H.div { className : "panel-footer" }
...
...
@@ -160,16 +160,6 @@ isIsTex ( Just
) = true
isIsTex _ = false
isIsTex_Advanced :: Maybe DataField -> Boolean
isIsTex_Advanced ( Just
( External
( Just ( IsTex_Advanced)
)
)
) = true
isIsTex_Advanced _ = false
isIMT :: Maybe DataField -> Boolean
isIMT ( Just
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
fe9e6a7a
...
...
@@ -18,6 +18,25 @@ import Gargantext.Types as GT
import URI.Extra.QueryPairs as QP
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
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
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff GT.AsyncTaskWithType
updateRequest (UpdateNodeParamsList meth) session nodeId = do
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsGraph meth) session nodeId = do
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsTexts meth) session nodeId = do
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
p = GR.NodeAPI GT.Node (Just nodeId) "update/nobody"
updateRequest (UpdateNodeParamsBoard meth) session nodeId = do
task <- post session p meth
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
-- TODO add NodeType
pure $ GT.AsyncTaskWithType {task, typ: GT.UpdateNode }
where
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
import Data.Array (length)
import Data.Maybe (Maybe(..))
import Data.Nullable (null)
import Data.String as S
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
...
...
@@ -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.Rename (renameAction)
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.Share as Share
import Gargantext.Components.Forest.Tree.Node.Action.Update (update)
...
...
@@ -52,10 +50,9 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
where
cpt p _ = do
isOpen <- R.useState' false
iframeRef <- R.useRef null
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' { action: Nothing
, id: p.id
, name: p.name
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' { action : Nothing
, id : p.id
, name : p.name
, nodeType: p.nodeType
}
search <- R.useState' $ defaultSearch { node_id = Just p.id }
...
...
@@ -76,10 +73,6 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
, panelBody nodePopupState p
, mPanelAction nodePopupState p
]
, if nodePopup.action == Just SearchBox then
H.div {} [ searchIframes p search iframeRef ]
else
H.div {} []
]
]
where
...
...
@@ -161,7 +154,7 @@ nodePopupCpt = R.hooksComponent "G.C.F.T.N.B.nodePopupView" cpt
mPanelAction :: R.State (Record NodePopupS)
-> Record NodePopupProps
-> R.Element
mPanelAction ({action: Nothing
} /\ _) _
= H.div {} []
mPanelAction ({action: Nothing
} /\ _) _
= H.div {} []
mPanelAction ({action: Just action} /\ _) props =
panelAction { action
, 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