Commit d15f7da9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FOREST][SEARCH] CSS fix + warnings.

parent fe34b637
...@@ -10,7 +10,6 @@ import Gargantext.Routes (AppRoute) ...@@ -10,7 +10,6 @@ import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), Sessions, unSessions) import Gargantext.Sessions (Session(..), Sessions, unSessions)
import Gargantext.Components.Forest.Tree (treeView) import Gargantext.Components.Forest.Tree (treeView)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils (glyphicon)
type Props = type Props =
( sessions :: Sessions ( sessions :: Sessions
......
module Gargantext.Components.Forest.Tree where module Gargantext.Components.Forest.Tree where
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>)) import Data.Maybe (Maybe)
import Data.Array (filter, null) -- import Data.Newtype (class Newtype)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff, runAff) import Effect.Aff (Aff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..))
import Gargantext.Components.Forest.Tree.Node.Action import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action.Add import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile)
import Gargantext.Components.Forest.Tree.Node.Action.Rename import Gargantext.Components.Forest.Tree.Node.Box (nodeMainSpan)
import Gargantext.Components.Forest.Tree.Node.Action.Upload
import Gargantext.Components.Forest.Tree.Node
import Gargantext.Components.Forest.Tree.Node.Box
import Gargantext.Ends (Frontends) import Gargantext.Ends (Frontends)
import Gargantext.Components.Loader (loader) import Gargantext.Components.Loader (loader)
import Gargantext.Routes (AppRoute) import Gargantext.Routes (AppRoute)
......
module Gargantext.Components.Forest.Tree.Node.Box where module Gargantext.Components.Forest.Tree.Node.Box where
import DOM.Simple.Console (log2) import DOM.Simple.Console (log2)
import Data.Array (filter, null) import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe(..), fromJust, isJust) import Data.Tuple (Tuple(..))
import Data.Tuple (fst, Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff, runAff) import Effect.Aff (Aff, launchAff, runAff)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
import Effect.Uncurried (mkEffectFn1) import Effect.Uncurried (mkEffectFn1)
import FFI.Simple ((..)) import FFI.Simple ((..))
import Gargantext.Components.Forest.Tree.Node import Gargantext.Components.Forest.Tree.Node (NodeAction(..), SettingsBox(..), glyphiconNodeAction, settingsBox)
import Gargantext.Components.Forest.Tree.Node.Action import Gargantext.Components.Forest.Tree.Node.Action (Action(..), DroppedFile(..), FileType(..), ID, Name, UploadFileContents(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), createNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Rename import Gargantext.Components.Forest.Tree.Node.Action.Rename (renameBox)
import Gargantext.Components.Forest.Tree.Node.Action.Upload import Gargantext.Components.Forest.Tree.Node.Action.Upload (fileTypeView)
import Gargantext.Components.Search.Types import Gargantext.Components.Search.Types (allLangs)
import Gargantext.Components.Search.SearchBar import Gargantext.Components.Search.SearchBar (searchBar)
import Gargantext.Components.Search.SearchField (Search, defaultSearch, isIsTex) import Gargantext.Components.Search.SearchField (Search, defaultSearch, isIsTex)
import Gargantext.Ends (Frontends, url) import Gargantext.Ends (Frontends, url)
import Gargantext.Routes (AppRoute, SessionRoute(..)) import Gargantext.Routes (AppRoute)
import Gargantext.Routes as Routes import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, get, put, post, postWwwUrlencoded, delete) import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (class ToQuery, toQuery, NodeType(..), NodePath(..), readNodeType, fldr) import Gargantext.Types (NodeType(..), NodePath(..), fldr)
import Gargantext.Utils (id, glyphicon, glyphiconActive) import Gargantext.Utils (glyphicon, glyphiconActive)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Partial.Unsafe (unsafePartial) import Partial.Unsafe (unsafePartial)
import Prelude hiding (div) import Prelude (Unit, bind, const, discard, identity, map, pure, show, unit, void, ($), (<>), (==))
import React.SyntheticEvent as E import React.SyntheticEvent as E
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
...@@ -173,6 +172,7 @@ type NodePopupProps = ...@@ -173,6 +172,7 @@ type NodePopupProps =
, session :: Session , session :: Session
) )
iconAStyle :: { color :: String, paddingTop :: String, paddingBottom :: String}
iconAStyle = { color : "black" iconAStyle = { color : "black"
, paddingTop : "6px" , paddingTop : "6px"
, paddingBottom : "6px" , paddingBottom : "6px"
...@@ -200,7 +200,7 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [ ...@@ -200,7 +200,7 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [
] ]
] ]
, panelHeading renameBoxOpen , panelHeading renameBoxOpen
, panelBody nodePopupState d , panelBody nodePopupState d
, panelAction d {id, name, nodeType, action:nodePopup.action, session, search} mPop , panelAction d {id, name, nodeType, action:nodePopup.action, session, search} mPop
] ]
, if nodePopup.action == Just SearchBox then , if nodePopup.action == Just SearchBox then
...@@ -258,11 +258,11 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [ ...@@ -258,11 +258,11 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [
] ]
editIcon (true /\ _) = H.div {} [] editIcon (true /\ _) = H.div {} []
panelBody nodePopupState d = panelBody nodePopupState d' =
H.div {className: "panel-body flex-center"} H.div {className: "panel-body flex-center"}
$ map (buttonClick nodePopupState d) buttons $ map (buttonClick nodePopupState d') buttons
searchIsTexIframe id session search@(search' /\ _) = searchIsTexIframe _id _session search@(search' /\ _) =
if isIsTex search'.datafield then if isIsTex search'.datafield then
H.div { className: "istex-search panel panel-default" } H.div { className: "istex-search panel panel-default" }
[ [
...@@ -290,8 +290,14 @@ nodePopupView _ p _ = R.createElement el p [] ...@@ -290,8 +290,14 @@ nodePopupView _ p _ = R.createElement el p []
cpt _ _ = pure $ H.div {} [] cpt _ _ = pure $ H.div {} []
buttonClick :: R.State { id :: ID
-- buttonAction :: NodeAction -> R.Element , name :: Name
, nodeType :: NodeType
, action :: Maybe NodeAction
}
-> (Action -> Aff Unit)
-> NodeAction
-> R.Element
buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-1"} buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-1"}
[ H.a { style: iconAStyle [ H.a { style: iconAStyle
, className: glyphiconActive (glyphiconNodeAction todo) , className: glyphiconActive (glyphiconNodeAction todo)
...@@ -309,8 +315,6 @@ buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-1 ...@@ -309,8 +315,6 @@ buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-1
then Nothing then Nothing
else (Just todo) else (Just todo)
buttonClick _ _ _ = H.div {} []
-- END Popup View -- END Popup View
...@@ -367,7 +371,7 @@ infoTitle nt = H.div {} [ H.h3 {} [H.text "Documentation about " ] ...@@ -367,7 +371,7 @@ infoTitle nt = H.div {} [ H.h3 {} [H.text "Documentation about " ]
, H.h3 {className: fldr nt true} [ H.text $ show nt ] , H.h3 {className: fldr nt true} [ H.text $ show nt ]
] ]
reallyDelete :: (Action -> Aff Unit) -> R.Element
reallyDelete d = H.div {className: "panel-footer"} reallyDelete d = H.div {className: "panel-footer"}
[ H.a { type: "button" [ H.a { type: "button"
, className: "btn glyphicon glyphicon-trash" , className: "btn glyphicon glyphicon-trash"
...@@ -377,6 +381,3 @@ reallyDelete d = H.div {className: "panel-footer"} ...@@ -377,6 +381,3 @@ reallyDelete d = H.div {className: "panel-footer"}
[H.text " Yes, delete!"] [H.text " Yes, delete!"]
] ]
...@@ -5,7 +5,6 @@ import Gargantext.Prelude hiding (max,min) ...@@ -5,7 +5,6 @@ import Gargantext.Prelude hiding (max,min)
import Data.FoldableWithIndex (foldMapWithIndex) import Data.FoldableWithIndex (foldMapWithIndex)
import Data.Foldable (foldMap) import Data.Foldable (foldMap)
import Data.Int (toNumber) import Data.Int (toNumber)
import Data.Map as Map
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Nullable (null, Nullable) import Data.Nullable (null, Nullable)
import Data.Sequence as Seq import Data.Sequence as Seq
......
...@@ -96,14 +96,14 @@ chooserCpt :: R.Component ChooserProps ...@@ -96,14 +96,14 @@ chooserCpt :: R.Component ChooserProps
chooserCpt = R.staticComponent "G.C.Login.chooser" cpt where chooserCpt = R.staticComponent "G.C.Login.chooser" cpt where
cpt :: Record ChooserProps -> Array R.Element -> R.Element cpt :: Record ChooserProps -> Array R.Element -> R.Element
cpt {backend, backends, sessions} _ = cpt {backend, backends, sessions} _ =
R.fragment $ new <> active R.fragment $ active <> new <> search
where where
active = if DS.length ss > 0 then [ H.h3 {} [H.text "Active connection(s)"] active = if DS.length ss > 0 then [ H.h3 {} [H.text "Active connection(s)"]
, H.ul {} [ renderSessions sessions] , H.ul {} [ renderSessions sessions]
] else [] where ] else [] where
Sessions {sessions:ss} = fst sessions Sessions {sessions:ss} = fst sessions
new = [ H.input {className: "form-control", type:"text", placeholder: "Search for your institute"} search = [ H.input {className: "form-control", type:"text", placeholder: "Search for your institute"}]
, H.h3 {} [H.text "Last connection(s)"] new = [ H.h3 {} [H.text "Last connection(s)"]
, H.table {className : "table"} , H.table {className : "table"}
[ H.thead {className: "thead-dark"} [ H.tr {} [ H.th {} [H.text "Label of instance"] [ H.thead {className: "thead-dark"} [ H.tr {} [ H.th {} [H.text "Label of instance"]
, H.th {} [H.text "Gargurl"] , H.th {} [H.text "Gargurl"]
...@@ -118,7 +118,7 @@ renderSessions :: R2.Reductor Sessions Sessions.Action -> R.Element ...@@ -118,7 +118,7 @@ renderSessions :: R2.Reductor Sessions Sessions.Action -> R.Element
renderSessions sessions = R.fragment (renderSession sessions <$> unSessions (fst sessions)) renderSessions sessions = R.fragment (renderSession sessions <$> unSessions (fst sessions))
where where
renderSession :: R2.Reductor Sessions Sessions.Action -> Session -> R.Element renderSession :: R2.Reductor Sessions Sessions.Action -> Session -> R.Element
renderSession sessions' session = H.li {} $ [ H.text $ "Active session: " <> show session ] renderSession sessions' session = H.li {} $ [ H.text $ show session ]
<> [ H.a { on : {click} <> [ H.a { on : {click}
, className: "glyphitem glyphicon glyphicon-log-out" , className: "glyphitem glyphicon glyphicon-log-out"
, id : "log-out" , id : "log-out"
......
...@@ -5,10 +5,7 @@ module Gargantext.Components.Search.SearchBar ...@@ -5,10 +5,7 @@ module Gargantext.Components.Search.SearchBar
import Prelude (Unit, bind, discard, not, pure, show, ($), (<>), map) import Prelude (Unit, bind, discard, not, pure, show, ($), (<>), map)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Data.Array (nub, concat) import Data.Array (nub, concat)
import Data.Set as Set
import Data.Newtype (over) import Data.Newtype (over)
import Data.Traversable (traverse_)
import Data.Tuple (snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Class (liftEffect) import Effect.Class (liftEffect)
...@@ -18,7 +15,7 @@ import Effect.Aff (Aff, launchAff_) ...@@ -18,7 +15,7 @@ import Effect.Aff (Aff, launchAff_)
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Gargantext.Components.Search.Types -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..)) import Gargantext.Components.Search.Types -- (Database, SearchQuery(..), defaultSearchQuery, performSearch, Lang(..))
import Gargantext.Components.Modals.Modal (modalShow) import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Components.Search.SearchField (Search, defaultSearch, searchField) import Gargantext.Components.Search.SearchField (Search, searchField)
import Gargantext.Sessions (Session) import Gargantext.Sessions (Session)
type Props = ( session :: Session type Props = ( session :: Session
......
...@@ -67,35 +67,30 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps ...@@ -67,35 +67,30 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) eqProps
then then
div {}[] div {}[]
else else
div {} [ langNav search props.langs div {} [ dataFieldNav search dataFields
, if s.lang == Nothing , if isExternal s.datafield
then then databaseInput search props.databases
div {} [] else div {} []
else
div {} [ dataFieldNav search dataFields , if isHAL s.datafield
, if isExternal s.datafield then orgInput search allOrgs
then databaseInput search props.databases else div {} []
else div {} []
, if isHAL s.datafield , if isIMT s.datafield
then orgInput search allOrgs then componentIMT search
else div {} [] else div {} []
, if isIMT s.datafield , if isCNRS s.datafield
then then componentCNRS search
componentIMT search else div {} []
else div {} []
, if isCNRS s.datafield
then
componentCNRS search
else
div {} []
]
] ]
]
] ]
] , div { className : "panel-footer" }
[ if needsLang s.datafield then langNav search props.langs else div {} []
, submitButton search , div {} []
, div {className: "flex-center"} [submitButton search]
]
] ]
eqProps p p' = (fst p.search == fst p'.search) eqProps p p' = (fst p.search == fst p'.search)
&& (p.databases == p'.databases ) && (p.databases == p'.databases )
...@@ -147,7 +142,11 @@ isCNRS :: Maybe DataField -> Boolean ...@@ -147,7 +142,11 @@ isCNRS :: Maybe DataField -> Boolean
isCNRS (Just ( External ( Just ( HAL ( Just ( CNRS _)))))) = true isCNRS (Just ( External ( Just ( HAL ( Just ( CNRS _)))))) = true
isCNRS _ = false isCNRS _ = false
needsLang :: Maybe DataField -> Boolean
needsLang (Just Gargantext) = true
needsLang (Just Web) = true
needsLang (Just ( External ( Just (HAL _)))) = true
needsLang _ = false
isIn :: IMT_org -> Maybe DataField -> Boolean isIn :: IMT_org -> Maybe DataField -> Boolean
...@@ -175,22 +174,21 @@ updateFilter org _ = (Just (External (Just (HAL (Just (IMT imtOrgs')))))) ...@@ -175,22 +174,21 @@ updateFilter org _ = (Just (External (Just (HAL (Just (IMT imtOrgs'))))))
else Set.fromFoldable [org] else Set.fromFoldable [org]
------------------------------------------------------------------------ ------------------------------------------------------------------------
langList :: R.State (Maybe Lang) -> Array Lang -> R.Element langList :: R.State Search -> Array Lang -> R.Element
langList (lang /\ setLang) langs = langList (lang /\ setLang) langs =
div { className: "form-group" } div { className: "form-group" }
[ div {className: "text-primary center"} [text "with lang"] [ div {className: "text-primary center"} [text "with lang"]
, R2.select { className: "form-control" , R2.select { className: "form-control"
, on: { change: \e -> setLang , on: { change: \e -> setLang $ _ {lang = lang' e}}
$ const
$ readLang
$ e .. "target" .. "value"
}
} (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 lang = option {className : "text-primary center"} [ text (show lang) ]
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 [ div {className: "text-primary center"} [text "with lang"]
...@@ -318,12 +316,11 @@ searchInput ({term} /\ setSearch) = ...@@ -318,12 +316,11 @@ searchInput ({term} /\ setSearch) =
submitButton :: R.State Search submitButton :: R.State Search
-> R.Element -> R.Element
submitButton (search /\ setSearch) = submitButton (search /\ setSearch) =
div { className : "panel-footer" } button { className: "btn btn-primary"
[ button { className: "btn btn-primary" , type: "button"
, type: "button" , on: {click: doSearch}
, on: {click: doSearch} , style: { width: "100%" }
} [ text "Launch Search" ] } [ text "Launch Search" ]
]
where where
doSearch = \_ -> do doSearch = \_ -> do
case search.term of case search.term of
......
...@@ -40,16 +40,16 @@ data Lang = FR | EN | Universal | No_extraction ...@@ -40,16 +40,16 @@ data Lang = FR | EN | Universal | No_extraction
instance showLang :: Show Lang where instance showLang :: Show Lang where
show FR = "FR" show FR = "FR"
show EN = "EN" show EN = "EN"
show Universal = "Universal" show Universal = "All"
show No_extraction = "No_extraction" show No_extraction = "Nothing"
derive instance eqLang :: Eq Lang derive instance eqLang :: Eq Lang
readLang :: String -> Maybe Lang readLang :: String -> Maybe Lang
readLang "FR" = Just FR readLang "FR" = Just FR
readLang "EN" = Just EN readLang "EN" = Just EN
readLang "Universal" = Just Universal readLang "All" = Just Universal
readLang "No_extraction" = Just No_extraction readLang "Nothing" = Just No_extraction
readLang _ = Nothing readLang _ = Nothing
instance encodeJsonLang :: EncodeJson Lang where instance encodeJsonLang :: EncodeJson Lang where
......
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