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
8c872d4b
Commit
8c872d4b
authored
Jun 20, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev-refact' into dev
parents
0457a589
1f854b04
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
84 additions
and
90 deletions
+84
-90
Login.css
dist/styles/Login.css
+2
-1
Login.sass
dist/styles/Login.sass
+2
-1
Frame.purs
...text/Components/Forest/Tree/Node/Action/Search/Frame.purs
+32
-9
SearchField.purs
...omponents/Forest/Tree/Node/Action/Search/SearchField.purs
+33
-58
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+1
-1
Types.purs
...text/Components/Forest/Tree/Node/Action/Upload/Types.purs
+2
-2
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+7
-9
REST.purs
src/Gargantext/Config/REST.purs
+3
-5
Prelude.purs
src/Gargantext/Prelude.purs
+1
-1
Popover.purs
src/Gargantext/Utils/Popover.purs
+1
-3
No files found.
dist/styles/Login.css
View file @
8c872d4b
...
@@ -78,9 +78,10 @@ li#rename #rename-a {
...
@@ -78,9 +78,10 @@ li#rename #rename-a {
background-color
:
white
;
background-color
:
white
;
border
:
none
;
border
:
none
;
}
}
#node-popup-tooltip
.popup-container
.
istex
-search.panel
{
#node-popup-tooltip
.popup-container
.
frame
-search.panel
{
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.2
);
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
0
2px
5px
rgba
(
0
,
0
,
0
,
0.2
);
box-shadow
:
0
2px
5px
rgba
(
0
,
0
,
0
,
0.2
);
height
:
600px
;
width
:
1300px
;
width
:
1300px
;
}
}
...
...
dist/styles/Login.sass
View file @
8c872d4b
...
@@ -70,9 +70,10 @@ li#rename
...
@@ -70,9 +70,10 @@ li#rename
justify-content
:
center
justify-content
:
center
background-color
:
white
background-color
:
white
border
:
none
border
:
none
.
istex
-search.panel
.
frame
-search.panel
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0
.2
)
border
:
1px
solid
rgba
(
0
,
0
,
0
,
0
.2
)
box-shadow
:
0
2px
5px
rgba
(
0
,
0
,
0
,
0
.2
)
box-shadow
:
0
2px
5px
rgba
(
0
,
0
,
0
,
0
.2
)
height
:
600px
width
:
1300px
width
:
1300px
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Frame.purs
View file @
8c872d4b
...
@@ -4,33 +4,56 @@ import DOM.Simple as DOM
...
@@ -4,33 +4,56 @@ import DOM.Simple as DOM
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.Event (MessageEvent)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
import DOM.Simple.EventListener (Callback, addEventListener, callback)
import DOM.Simple.Window (window)
import DOM.Simple.Window (window)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (Nullable)
import Data.Nullable (Nullable)
import Data.String (toLower)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Components.Forest.Tree.Node.Action.Search.Types (DataField(..), Search, isIsTex_Advanced)
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==))
import Gargantext.Prelude (discard, identity, pure, unit, ($), (<>), (==)
, class Show, show
)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import URI.Extra.QueryPairs as NQP
import URI.Extra.QueryPairs as NQP
import URI.Query as Query
import URI.Query as Query
--------------------
data FrameSource = Istex | Searx
derive instance genericFrameSource :: Generic FrameSource _
instance showFrameSource :: Show FrameSource where
show = genericShow
--------------------
--------------------
-- | Iframes
-- | Iframes
searchIframes :: R.State Search
searchIframes :: R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Ref (Nullable DOM.Element)
-> R.Element
-> R.Element
searchIframes search@(search' /\ _) iframeRef =
searchIframes search@(search' /\ _) iframeRef =
if isIsTex_Advanced search'.datafield then
if isIsTex_Advanced search'.datafield
H.div { className: "istex-search panel panel-default" }
then divIframe Istex search iframeRef
[ iframeWith "https://istex.gargantext.org" search iframeRef ]
else
else
if Just Web == search'.datafield then
if Just Web == search'.datafield
H.div { className: "istex-search panel panel-default" }
then divIframe Searx search iframeRef
[ iframeWith "https://searx.gargantext.org" search iframeRef ]
else H.div {} []
else
H.div {} []
divIframe :: FrameSource
-> R.State Search
-> R.Ref (Nullable DOM.Element)
-> R.Element
divIframe frameSource search@(search' /\ _) iframeRef =
H.div { className: "frame-search panel panel-default" }
[ iframeWith (frameUrl frameSource)search iframeRef ]
frameUrl :: FrameSource -> String
frameUrl frameSource = frameUrl' (toLower $ show frameSource)
where
frameUrl' s = "https://" <> s <> ".frame.gargantext.org"
iframeWith :: String
iframeWith :: String
-> R.State Search
-> R.State Search
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/SearchField.purs
View file @
8c872d4b
...
@@ -7,14 +7,14 @@ import Data.Nullable (null)
...
@@ -7,14 +7,14 @@ 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)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
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.Tools (panel)
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.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.Components.Forest.Tree.Node.Action.Search.Frame (searchIframes)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -22,20 +22,6 @@ import Gargantext.Utils.Reactix as R2
...
@@ -22,20 +22,6 @@ import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
select :: forall props.
R.IsComponent String props (Array R.Element)
=> Record props
-> Array R.Element
-> R.Element
select = R.createElement "select"
eqSearch :: Search -> Search -> Boolean
eqSearch s s' = (s.databases == s'.databases)
&& (s.datafield == s'.datafield)
&& (s.lang == s'.lang)
&& (s.node_id == s'.node_id)
&& (s.term == s'.term)
defaultSearch :: Search
defaultSearch :: Search
defaultSearch = { databases: Empty
defaultSearch = { databases: Empty
, datafield: Nothing
, datafield: Nothing
...
@@ -65,12 +51,7 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -65,12 +51,7 @@ 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
iframeRef <- R.useRef null
pure $
let params =
H.div { className: "search-field-group", style: { width: "100%" } }
[
H.div { className: "row" }
[
H.div { className: "col-md-12" }
[ searchInput {search}
[ searchInput {search}
, if length s.term < 3 -- search with love : <3
, if length s.term < 3 -- search with love : <3
then
then
...
@@ -96,47 +77,41 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
...
@@ -96,47 +77,41 @@ searchFieldComponent = R.hooksComponent "G.C.S.SearchField" cpt
, H.div {} [ searchIframes search iframeRef ]
, H.div {} [ searchIframes search iframeRef ]
, if needsLang s.datafield
then langNav search props.langs
else H.div {} []
]
]
]
]
]
let button = submitButton {onSearch, search, session: props.session}
, H.div { className : "panel-footer" }
[ if needsLang s.datafield
pure $ panel params button
then langNav search props.langs
else H.div {} []
, H.div {} []
componentIMT (search /\ setSearch) =
, H.div {className: "flex-center"}
R.fragment
[submitButton {onSearch, search, session: props.session}]
[ H.ul {} $ map liCpt allIMTorgs
]
--, filterInput fi
]
]
eqProps :: Record Props -> Record Props -> Boolean
where
eqProps p p' = (p.databases == p'.databases )
liCpt org =
&& (p.langs == p'.langs )
H.li {}
&& (eqSearch (fst p.search) (fst p'.search))
[ H.input { type: "checkbox"
-- && (fst p.filters == fst p'.filters )
, checked: isIn org search.datafield
componentIMT (search /\ setSearch) =
, on: { change: \_ -> ( setSearch $ _ { datafield = updateFilter org search.datafield })
R.fragment
}
[ H.ul {} $ map liCpt allIMTorgs
}
--, filterInput fi
, if org == All_IMT
]
then H.i {} [H.text $ " " <> show org]
where
else H.text $ " " <> show org
liCpt org =
H.li {}
[ H.input { type: "checkbox"
, checked: isIn org search.datafield
, on: { change: \_ -> ( setSearch $ _ { datafield = updateFilter org search.datafield })
}
}
, if org == All_IMT
then H.i {} [H.text $ " " <> show org]
else H.text $ " " <> show org
]
componentCNRS (search /\ setSearch) =
R.fragment [
H.div {} []
--, filterInput fi
]
]
componentCNRS (search /\ setSearch) =
R.fragment [
H.div {} []
--, filterInput fi
]
isExternal :: Maybe DataField -> Boolean
isExternal :: Maybe DataField -> Boolean
isExternal (Just (External _)) = true
isExternal (Just (External _)) = true
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
8c872d4b
...
@@ -154,7 +154,7 @@ uploadButtonCpt = R.hooksComponent "G.C.F.T.N.A.U.uploadButton" cpt
...
@@ -154,7 +154,7 @@ uploadButtonCpt = R.hooksComponent "G.C.F.T.N.A.U.uploadButton" cpt
where
where
disabled = case mFile of
disabled = case mFile of
Nothing -> "1"
Nothing -> "1"
Just _ -> ""
Just _
-> ""
onClick e = do
onClick e = do
let {name, contents} = unsafePartial $ fromJust mFile
let {name, contents} = unsafePartial $ fromJust mFile
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload/Types.purs
View file @
8c872d4b
module Gargantext.Components.Forest.Tree.Node.Action.Upload.Types where
module Gargantext.Components.Forest.Tree.Node.Action.Upload.Types where
import Gargantext.Prelude (class Read, class Show, class Eq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), fromMaybe, maybe)
import Data.Maybe (Maybe(..))
import Gargantext.Prelude (class Read, class Show, class Eq)
data FileType = CSV | CSV_HAL | WOS | PresseRIS
data FileType = CSV | CSV_HAL | WOS | PresseRIS
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
8c872d4b
...
@@ -179,18 +179,16 @@ formButton nodeType setNodeType =
...
@@ -179,18 +179,16 @@ formButton nodeType setNodeType =
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
submitButton :: Action -> (Action -> Aff Unit) -> R.Element
submitButton :: Action -> (Action -> Aff Unit) -> R.Element
submitButton action dispatch =
submitButton action dispatch =
H.button { className : "btn btn-primary fa fa-" <> icon action
H.button { className : "btn btn-primary fa fa-" <> icon action
, type: "button"
, type: "button"
, style : { width: "50%" }
, style : { width: "50%" }
, id: S.toLower $ show action
, id: S.toLower $ show action
, title: show action
, title: show action
, on: {click: \_ -> launchAff $ dispatch action}
, on: {click: \_ -> launchAff $ dispatch action}
}
}
[ H.text $ " " <> text action]
[ H.text $ " " <> text action]
type Href = String
type Href = String
...
...
src/Gargantext/Config/REST.purs
View file @
8c872d4b
module Gargantext.Config.REST where
module Gargantext.Config.REST where
import Affjax (defaultRequest, printResponseFormatError, request)
import Affjax (defaultRequest, printResponseFormatError, request)
import Affjax.RequestBody (RequestBody(..), formData, formURLEncoded
, string
)
import Affjax.RequestBody (RequestBody(..), formData, formURLEncoded)
import Affjax.RequestHeader as ARH
import Affjax.RequestHeader as ARH
import Affjax.ResponseFormat as ResponseFormat
import Affjax.ResponseFormat as ResponseFormat
import DOM.Simple.Console (log)
import DOM.Simple.Console (log)
import Data.Argonaut (class DecodeJson, decodeJson, class EncodeJson, encodeJson)
import Data.Argonaut (class DecodeJson, decodeJson, class EncodeJson, encodeJson)
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Foldable (foldMap)
import Data.Foldable (foldMap)
import Data.FormURLEncoded as FormURLEncoded
import Data.FormURLEncoded as FormURLEncoded
import Data.HTTP.Method (Method(..))
import Data.HTTP.Method (Method(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON, multipartFormData)
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON, multipartFormData)
import Data.Tuple (Tuple
(..)
)
import Data.Tuple (Tuple)
import Effect.Aff (Aff, throwError)
import Effect.Aff (Aff, throwError)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Web.XHR.FormData as XHRFormData
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Web.XHR.FormData as XHRFormData
type Token = String
type Token = String
...
...
src/Gargantext/Prelude.purs
View file @
8c872d4b
module Gargantext.Prelude (module Prelude, logs, id, class Read, read)
module Gargantext.Prelude (module Prelude, logs, id, class Read, read)
where
where
import Data.Maybe (Maybe
(..)
)
import Data.Maybe (Maybe)
import Prelude (class Applicative, class Apply, class Bind, class BooleanAlgebra, class Bounded, class Category, class CommutativeRing, class Discard, class DivisionRing, class Eq, class EuclideanRing, class Field, class Functor, class HeytingAlgebra, class Monad, class Monoid, class Ord, class Ring, class Semigroup, class Semigroupoid, class Semiring, class Show, type (~>), Ordering(..), Unit, Void, absurd, add, ap, append, apply, between, bind, bottom, clamp, compare, comparing, compose, conj, const, degree, discard, disj, eq, flap, flip, gcd, identity, ifM, join, lcm, liftA1, liftM1, map, max, mempty, min, mod, mul, negate, not, notEq, one, otherwise, pure, recip, show, sub, top, unit, unless, unlessM, void, when, whenM, zero, (#), ($), ($>), (&&), (*), (*>), (+), (-), (/), (/=), (<), (<#>), (<$), (<$>), (<*), (<*>), (<<<), (<=), (<=<), (<>), (<@>), (=<<), (==), (>), (>=), (>=>), (>>=), (>>>), (||))
import Prelude (class Applicative, class Apply, class Bind, class BooleanAlgebra, class Bounded, class Category, class CommutativeRing, class Discard, class DivisionRing, class Eq, class EuclideanRing, class Field, class Functor, class HeytingAlgebra, class Monad, class Monoid, class Ord, class Ring, class Semigroup, class Semigroupoid, class Semiring, class Show, type (~>), Ordering(..), Unit, Void, absurd, add, ap, append, apply, between, bind, bottom, clamp, compare, comparing, compose, conj, const, degree, discard, disj, eq, flap, flip, gcd, identity, ifM, join, lcm, liftA1, liftM1, map, max, mempty, min, mod, mul, negate, not, notEq, one, otherwise, pure, recip, show, sub, top, unit, unless, unlessM, void, when, whenM, zero, (#), ($), ($>), (&&), (*), (*>), (+), (-), (/), (/=), (<), (<#>), (<$), (<$>), (<*), (<*>), (<<<), (<=), (<=<), (<>), (<@>), (=<<), (==), (>), (>=), (>=>), (>>=), (>>>), (||))
import Effect.Console (log)
import Effect.Console (log)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Class (class MonadEffect, liftEffect)
...
...
src/Gargantext/Utils/Popover.purs
View file @
8c872d4b
module Gargantext.Utils.Popover where
module Gargantext.Utils.Popover where
import Data.Maybe (
Maybe(..),
maybe)
import Data.Maybe (maybe)
import Data.Nullable (Nullable, toMaybe)
import Data.Nullable (Nullable, toMaybe)
import DOM.Simple as DOM
import DOM.Simple as DOM
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import Effect.Uncurried (EffectFn2, runEffectFn2)
import FFI.Simple ((..), (...))
import Reactix as R
import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
...
...
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