Commit c4bee502 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Some more import warning fixes

parent b40297f0
...@@ -5,7 +5,7 @@ module Gargantext.Components.FacetsTable where ...@@ -5,7 +5,7 @@ module Gargantext.Components.FacetsTable where
import Prelude import Prelude
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>)) import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>))
import Data.Array (concat, filter, (!!)) import Data.Array (concat, filter)
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
...@@ -13,9 +13,7 @@ import Data.Set (Set) ...@@ -13,9 +13,7 @@ import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst, snd) import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log, log2)
import Effect (Effect) import Effect (Effect)
import Effect.Class (liftEffect)
import Effect.Aff (Aff, launchAff_) import Effect.Aff (Aff, launchAff_)
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
......
...@@ -19,7 +19,7 @@ import Data.Lens.Record (prop) ...@@ -19,7 +19,7 @@ import Data.Lens.Record (prop)
import Data.List as List import Data.List as List
import Data.Map (Map) import Data.Map (Map)
import Data.Map as Map import Data.Map as Map
import Data.Maybe (Maybe(..), maybe, fromJust) import Data.Maybe (Maybe(..), maybe)
import Data.Monoid.Additive (Additive(..)) import Data.Monoid.Additive (Additive(..))
import Data.Ord.Down (Down(..)) import Data.Ord.Down (Down(..))
import Data.Set (Set) import Data.Set (Set)
......
...@@ -50,14 +50,14 @@ import Control.Monad.Cont.Trans (lift) ...@@ -50,14 +50,14 @@ import Control.Monad.Cont.Trans (lift)
import Data.Array (head) import Data.Array (head)
import Data.Array as A import Data.Array as A
import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson
, jsonEmptyObject, (:=), (~>), (.:), (.??) ) , jsonEmptyObject, (:=), (~>), (.:), (.:!) )
import Data.Bifunctor (lmap) import Data.Bifunctor (lmap)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldMap, foldl, foldr) import Data.Foldable (class Foldable, foldMap, foldl, foldr)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex) import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex) import Data.FunctorWithIndex (class FunctorWithIndex, mapWithIndex)
import Data.Newtype (class Newtype) import Data.Newtype (class Newtype)
import Data.Lens (Iso', Lens', use, view, (%=), (.~), (?=), (^.), (^?)) import Data.Lens (Iso', Lens', use, view, (%=), (.~), (?=), (^?))
import Data.Lens.Common (_Just) import Data.Lens.Common (_Just)
import Data.Lens.At (class At, at) import Data.Lens.At (class At, at)
import Data.Lens.Index (class Index, ix) import Data.Lens.Index (class Index, ix)
...@@ -184,8 +184,8 @@ instance decodeJsonNgramsElement :: DecodeJson NgramsElement where ...@@ -184,8 +184,8 @@ instance decodeJsonNgramsElement :: DecodeJson NgramsElement where
ngrams <- obj .: "ngrams" ngrams <- obj .: "ngrams"
list <- obj .: "list" list <- obj .: "list"
occurrences <- obj .: "occurrences" occurrences <- obj .: "occurrences"
parent <- obj .?? "parent" parent <- obj .:! "parent"
root <- obj .?? "root" root <- obj .:! "root"
children' <- obj .: "children" children' <- obj .: "children"
let children = Set.fromFoldable (children' :: Array NgramsTerm) let children = Set.fromFoldable (children' :: Array NgramsTerm)
pure $ NgramsElement {ngrams, list, occurrences, parent, root, children} pure $ NgramsElement {ngrams, list, occurrences, parent, root, children}
...@@ -354,8 +354,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where ...@@ -354,8 +354,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where
instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
mold <- obj .?? "old" mold <- obj .:! "old"
mnew <- obj .?? "new" mnew <- obj .:! "new"
case Tuple mold mnew of case Tuple mold mnew of
Tuple (Just old) (Just new) -> pure $ replace old new Tuple (Just old) (Just new) -> pure $ replace old new
Tuple Nothing Nothing -> pure Keep Tuple Nothing Nothing -> pure Keep
......
...@@ -13,7 +13,6 @@ import Gargantext.Components.NgramsTable as NT ...@@ -13,7 +13,6 @@ import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.Tab as Tab import Gargantext.Components.Tab as Tab
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData) import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData)
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
import Gargantext.Types (TabType(..), TabSubType(..), CTabNgramType(..), PTabNgramType(..)) import Gargantext.Types (TabType(..), TabSubType(..), CTabNgramType(..), PTabNgramType(..))
......
...@@ -2,9 +2,8 @@ module Gargantext.Components.Search.SearchBar ...@@ -2,9 +2,8 @@ module Gargantext.Components.Search.SearchBar
( Props, searchBar, searchBarCpt ( Props, searchBar, searchBarCpt
) where ) where
import Prelude (Unit, bind, discard, not, pure, show, ($), (<>), map) import Prelude (Unit, bind, discard, pure, ($))
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Array (nub, concat)
import Data.Newtype (over) import Data.Newtype (over)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
......
module Gargantext.Components.Search.SearchField module Gargantext.Components.Search.SearchField
( Search, Props, defaultSearch, searchField, searchFieldComponent, isIsTex) where ( Search, Props, defaultSearch, searchField, searchFieldComponent, isIsTex) where
import Prelude import Prelude (const, map, pure, show, ($), (&&), (<), (<$>), (<>), (==))
import Data.Maybe (Maybe(..), maybe, isJust) import Data.Maybe (Maybe(..), maybe)
import Data.String (length) import Data.String (length)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst, Tuple(..)) import Data.Tuple (fst)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix.DOM.HTML as H
import FFI.Simple ((..)) import FFI.Simple ((..))
import Reactix as R import Reactix as R
import Reactix.DOM.HTML (text, button, div, input, span, ul, li, a, option, text, i) import Reactix.DOM.HTML as H
import Gargantext.Components.Search.Types -- (Database(..), readDatabase, Lang(..), readLang, Org(..), readOrg, allOrgs, allIMTorgs, HAL_Filters(..), IMT_org(..)) import Gargantext.Components.Search.Types -- (Database(..), readDatabase, Lang(..), readLang, Org(..), readOrg, allOrgs, allIMTorgs, HAL_Filters(..), IMT_org(..))
select :: forall props. select :: forall props.
...@@ -57,39 +55,39 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps ...@@ -57,39 +55,39 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps
where where
cpt props@{search: search@(s /\ _)} _ = do cpt props@{search: search@(s /\ _)} _ = do
pure $ pure $
div { className: "search-field-group", style: { width: "100%" } } H.div { className: "search-field-group", style: { width: "100%" } }
[ [
div { className: "row" } H.div { className: "row" }
[ [
div { className: "col-md-12" } H.div { className: "col-md-12" }
[ searchInput search [ searchInput search
, if length s.term < 3 , if length s.term < 3
then then
div {}[] H.div {}[]
else else
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 div {} [] else H.div {} []
, if isHAL s.datafield , if isHAL s.datafield
then orgInput search allOrgs then orgInput search allOrgs
else div {} [] else H.div {} []
, if isIMT s.datafield , if isIMT s.datafield
then componentIMT search then componentIMT search
else div {} [] else H.div {} []
, if isCNRS s.datafield , if isCNRS s.datafield
then componentCNRS search then componentCNRS search
else div {} [] else H.div {} []
] ]
] ]
] ]
, div { className : "panel-footer" } , H.div { className : "panel-footer" }
[ if needsLang s.datafield then langNav search props.langs else div {} [] [ if needsLang s.datafield then langNav search props.langs else H.div {} []
, div {} [] , H.div {} []
, div {className: "flex-center"} [submitButton search] , H.div {className: "flex-center"} [submitButton search]
] ]
] ]
eqProps p p' = (fst p.search == fst p'.search) eqProps p p' = (fst p.search == fst p'.search)
...@@ -99,25 +97,25 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps ...@@ -99,25 +97,25 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps
-- && (fst p.filters == fst p'.filters ) -- && (fst p.filters == fst p'.filters )
componentIMT (search /\ setSearch) = componentIMT (search /\ setSearch) =
R.fragment R.fragment
[ ul {} $ map liCpt allIMTorgs [ H.ul {} $ map liCpt allIMTorgs
--, filterInput fi --, filterInput fi
] ]
where where
liCpt org = liCpt org =
li {} H.li {}
[ input { type: "checkbox" [ H.input { type: "checkbox"
, checked: isIn org search.datafield , checked: isIn org search.datafield
, on: { , on: {
change: \_ -> (setSearch $ _ { datafield = updateFilter org search.datafield }) change: \_ -> (setSearch $ _ { datafield = updateFilter org search.datafield })
} }
} }
, if org == All_IMT , if org == All_IMT
then i {} [text $ " " <> show org] then H.i {} [H.text $ " " <> show org]
else text $ " " <> show org else H.text $ " " <> show org
] ]
componentCNRS (search /\ setSearch) = componentCNRS (search /\ setSearch) =
R.fragment [ R.fragment [
div {} [] H.div {} []
--, filterInput fi --, filterInput fi
] ]
...@@ -176,45 +174,45 @@ updateFilter org _ = (Just (External (Just (HAL (Just (IMT imtOrgs')))))) ...@@ -176,45 +174,45 @@ updateFilter org _ = (Just (External (Just (HAL (Just (IMT imtOrgs'))))))
------------------------------------------------------------------------ ------------------------------------------------------------------------
langList :: R.State Search -> Array Lang -> R.Element langList :: R.State Search -> Array Lang -> R.Element
langList (lang /\ setLang) langs = langList (lang /\ setLang) langs =
div { className: "form-group" } H.div { className: "form-group" }
[ div {className: "text-primary center"} [text "with lang"] [ H.div {className: "text-primary center"} [H.text "with lang"]
, R2.select { className: "form-control" , R2.select { className: "form-control"
, on: { change: \e -> setLang $ _ {lang = lang' e}} , on: { change: \e -> setLang $ _ {lang = lang' e}}
} (liItem <$> langs) } (liItem <$> langs)
] ]
where where
liItem :: Lang -> R.Element liItem :: Lang -> R.Element
liItem lang = option {className : "text-primary center"} [ text (show lang) ] liItem l = H.option {className : "text-primary center"} [ H.text (show l) ]
lang' e = readLang $ e .. "target" .. "value" lang' e = readLang $ e .. "target" .. "value"
langNav :: R.State Search -> Array Lang -> R.Element langNav :: R.State Search -> Array Lang -> R.Element
langNav ({lang} /\ setSearch) langs = langNav ({lang} /\ setSearch) langs =
R.fragment [ div {className: "text-primary center"} [text "with lang"] R.fragment [ H.div {className: "text-primary center"} [H.text "with lang"]
, div { className: "nav nav-tabs"} (liItem <$> langs) , H.div { className: "nav nav-tabs"} (liItem <$> langs)
] ]
where where
liItem :: Lang -> R.Element liItem :: Lang -> R.Element
liItem lang' = liItem lang' =
div { className : "nav-item nav-link" <> if (Just lang') == lang then " active" else "" H.div { className : "nav-item nav-link" <> if (Just lang') == lang then " active" else ""
, on: { click: \_ -> setSearch $ _ { lang = Just lang' } } , on: { click: \_ -> setSearch $ _ { lang = Just lang' } }
} [ text (show lang') ] } [ H.text (show lang') ]
------------------------------------------------------------------------ ------------------------------------------------------------------------
dataFieldNav :: R.State Search -> Array DataField -> R.Element dataFieldNav :: R.State Search -> Array DataField -> R.Element
dataFieldNav ({datafield} /\ setSearch) datafields = dataFieldNav ({datafield} /\ setSearch) datafields =
R.fragment [ div {className: "text-primary center"} [text "with DataField"] R.fragment [ H.div {className: "text-primary center"} [H.text "with DataField"]
, div { className: "nav nav-tabs"} (liItem <$> dataFields) , H.div { className: "nav nav-tabs"} (liItem <$> dataFields)
, div {className:"center"} [ text $ maybe "" doc datafield ] , H.div {className:"center"} [ H.text $ maybe "" doc datafield ]
] ]
where where
liItem :: DataField -> R.Element liItem :: DataField -> R.Element
liItem df' = liItem df' =
div { className : "nav-item nav-link" <> if (Just df') == datafield then " active" else "" H.div { className : "nav-item nav-link" <> if (Just df') == datafield then " active" else ""
, on: { click: \_ -> setSearch $ _ { datafield = Just df'} } , on: { click: \_ -> setSearch $ _ { datafield = Just df'} }
} [ text (show df') ] } [ H.text (show df') ]
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -223,9 +221,9 @@ databaseNav :: R.State Search ...@@ -223,9 +221,9 @@ databaseNav :: R.State Search
-> Array Database -> Array Database
-> R.Element -> R.Element
databaseNav ({datafield} /\ setSearch) dbs = databaseNav ({datafield} /\ setSearch) dbs =
R.fragment [ div {className: "text-primary center"} [text "with DataField"] R.fragment [ H.div {className: "text-primary center"} [H.text "with DataField"]
, div { className: "nav nav-tabs"} (liItem <$> dbs) , H.div { className: "nav nav-tabs"} (liItem <$> dbs)
, div {className:"center"} [ text $ maybe "" doc db ] , H.div {className:"center"} [ H.text $ maybe "" doc db ]
] ]
where where
...@@ -235,9 +233,9 @@ databaseNav ({datafield} /\ setSearch) dbs = ...@@ -235,9 +233,9 @@ databaseNav ({datafield} /\ setSearch) dbs =
liItem :: Database -> R.Element liItem :: Database -> R.Element
liItem df' = liItem df' =
div { className : "nav-item nav-link" <> if (Just $ External $ Just df') == datafield then " active" else "" H.div { className : "nav-item nav-link" <> if (Just $ External $ Just df') == datafield then " active" else ""
, on: { click: \_ -> setSearch $ _ { datafield = Just $ External $ Just df' } } , on: { click: \_ -> setSearch $ _ { datafield = Just $ External $ Just df' } }
} [ text (show df') ] } [ H.text (show df') ]
...@@ -245,12 +243,12 @@ databaseInput :: R.State Search ...@@ -245,12 +243,12 @@ databaseInput :: R.State Search
-> Array Database -> Array Database
-> R.Element -> R.Element
databaseInput ({datafield} /\ setSearch) dbs = databaseInput ({datafield} /\ setSearch) dbs =
div { className: "form-group" } H.div { className: "form-group" }
[ div {className: "text-primary center"} [text "in database"] [ H.div {className: "text-primary center"} [H.text "in database"]
, R2.select { className: "form-control" , R2.select { className: "form-control"
, on: { change: onChange } , on: { change: onChange }
} (liItem <$> dbs) } (liItem <$> dbs)
, div {className:"center"} [ text $ maybe "" doc db ] , H.div {className:"center"} [ H.text $ maybe "" doc db ]
] ]
where where
db = case datafield of db = case datafield of
...@@ -258,7 +256,7 @@ databaseInput ({datafield} /\ setSearch) dbs = ...@@ -258,7 +256,7 @@ databaseInput ({datafield} /\ setSearch) dbs =
_ -> Nothing _ -> Nothing
liItem :: Database -> R.Element liItem :: Database -> R.Element
liItem db = option {className : "text-primary center"} [ text (show db) ] liItem db' = H.option {className : "text-primary center"} [ H.text (show db') ]
onChange e = do onChange e = do
let value = e .. "target" .. "value" let value = e .. "target" .. "value"
...@@ -267,22 +265,22 @@ databaseInput ({datafield} /\ setSearch) dbs = ...@@ -267,22 +265,22 @@ databaseInput ({datafield} /\ setSearch) dbs =
orgInput :: R.State Search -> Array Org -> R.Element orgInput :: R.State Search -> Array Org -> R.Element
orgInput ({datafield} /\ setSearch) orgs = orgInput ({datafield} /\ setSearch) orgs =
div { className: "form-group" } H.div { className: "form-group" }
[ div {className: "text-primary center"} [text "filter with organization: "] [ H.div {className: "text-primary center"} [H.text "filter with organization: "]
, R2.select { className: "form-control" , R2.select { className: "form-control"
, on: { change: onChange } , on: { change: onChange }
} (liItem <$> orgs) } (liItem <$> orgs)
] ]
where where
liItem :: Org -> R.Element liItem :: Org -> R.Element
liItem org = option {className : "text-primary center"} [ text (show org) ] liItem org = H.option {className : "text-primary center"} [ H.text (show org) ]
onChange e = do onChange e = do
let value = e .. "target" .. "value" let value = e .. "target" .. "value"
setSearch $ _ { datafield = Just $ External $ Just $ HAL $ readOrg value } setSearch $ _ { datafield = Just $ External $ Just $ HAL $ readOrg value }
filterInput :: R.State String -> R.Element filterInput :: R.State String -> R.Element
filterInput (term /\ setTerm) = filterInput (term /\ setTerm) =
div {className: "form-group"} [ input { defaultValue: term H.div {className: "form-group"} [ H.input { defaultValue: term
, className: "form-control" , className: "form-control"
, type: "text" , type: "text"
, on: { change: \e -> setTerm , on: { change: \e -> setTerm
...@@ -300,12 +298,12 @@ filterInput (term /\ setTerm) = ...@@ -300,12 +298,12 @@ filterInput (term /\ setTerm) =
searchInput :: R.State Search -> R.Element searchInput :: R.State Search -> R.Element
searchInput ({term} /\ setSearch) = searchInput ({term} /\ setSearch) =
div { className : "" } H.div { className : "" }
[ input { defaultValue: term [ H.input { defaultValue: term
, className: "form-control" , className: "form-control"
, type: "text" , type: "text"
, on: { change : onChange } , on: { change : onChange }
, placeholder: "Your Query here" } , placeholder: "Your Query here" }
] ]
where where
onChange e = do onChange e = do
...@@ -316,11 +314,11 @@ searchInput ({term} /\ setSearch) = ...@@ -316,11 +314,11 @@ searchInput ({term} /\ setSearch) =
submitButton :: R.State Search submitButton :: R.State Search
-> R.Element -> R.Element
submitButton (search /\ setSearch) = submitButton (search /\ setSearch) =
button { className: "btn btn-primary" H.button { className: "btn btn-primary"
, type: "button" , type: "button"
, on: {click: doSearch} , on: {click: doSearch}
, style: { width: "100%" } , style: { width: "100%" }
} [ text "Launch Search" ] } [ H.text "Launch Search" ]
where where
doSearch = \_ -> do doSearch = \_ -> do
case search.term of case search.term of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment