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