Commit 0ec239cd authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-forest' of...

Merge branch 'dev-forest' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-forest
parents 98c5ef02 3cf9b707
...@@ -185,25 +185,31 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [ ...@@ -185,25 +185,31 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [
nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' {id, name, nodeType, action} nodePopupState@(nodePopup /\ setNodePopup) <- R.useState' {id, name, nodeType, action}
pure $ H.div tooltipProps $ pure $ H.div tooltipProps $
[ H.div {id: "arrow"} [] [ H.div {id: "arrow"} []
, H.div { className: "panel panel-default" , H.div { style: {display: "flex", "flex-direction": "colum"} }
, style: { border : "1px solid rgba(0,0,0,0.2)" [ H.div { className: "panel panel-default"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)" , style: { border : "1px solid rgba(0,0,0,0.2)"
} , boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
} }
[ H.div {className: ""} }
[ H.div { className : "col-md-11"} [ H.div {className: ""}
[ H.h3 { className: fldr nodeType true} [ H.div { className : "col-md-11"}
[ H.text $ show nodeType] [ H.h3 { className: fldr nodeType true}
] [ H.text $ show nodeType]
] ]
, panelHeading renameBoxOpen ]
, panelBody nodePopupState d , panelHeading renameBoxOpen
, if isJust nodePopup.action , panelBody nodePopupState d
then H.div { className: glyphicon "remove-circle" , removeCircleGeneral nodePopup.action setNodePopup
, onClick : setNodePopup $ const {id,name,nodeType,action :Nothing} , panelAction d {id,name,nodeType,action:nodePopup.action, session} mPop
} [] ]
else H.div {} [] , if nodePopup.action == Just SearchBox then
, panelAction d {id,name,nodeType,action:nodePopup.action, session} mPop H.div {}
[
searchPanel id session
, removeCircle setNodePopup
]
else
H.div {} []
] ]
] ]
where where
...@@ -216,6 +222,14 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [ ...@@ -216,6 +222,14 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [
SettingsBox {edit, buttons} = settingsBox nodeType SettingsBox {edit, buttons} = settingsBox nodeType
removeCircleGeneral (Just SearchBox) _ = H.div {} []
removeCircleGeneral (Just _) setNodePopup = removeCircle setNodePopup
removeCircleGeneral Nothing _ = H.div {} []
removeCircle setNodePopup =
H.div { className: glyphicon "remove-circle"
, onClick : setNodePopup $ const {id, name, nodeType, action :Nothing}
} []
panelHeading renameBoxOpen@(open /\ _) = panelHeading renameBoxOpen@(open /\ _) =
H.div {className: "panel-heading"} H.div {className: "panel-heading"}
[ -- H.h1 {className : "col-md-12"} [H.text "Settings Box"] [ -- H.h1 {className : "col-md-12"} [H.text "Settings Box"]
...@@ -256,6 +270,19 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [ ...@@ -256,6 +270,19 @@ nodePopupView d p mPop@(Just NodePopup /\ setPopupOpen) = R.createElement el p [
[H.div {className: "col-md-1"} []] [H.div {className: "col-md-1"} []]
<> <>
(map (buttonClick nodePopupState d) buttons) (map (buttonClick nodePopupState d) buttons)
searchPanel id session =
H.div { className: "panel panel-default"
, style: { border : "1px solid rgba(0,0,0,0.2)"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
, width : "1300px"
}
}
[
H.h3 { className: fldr nodeType true} []
, searchBar {session, datafield:Nothing, langs:allLangs, node_id: (Just id)}
]
nodePopupView _ p _ = R.createElement el p [] nodePopupView _ p _ = R.createElement el p []
where where
el = R.hooksComponent "CreateNodeView" cpt el = R.hooksComponent "CreateNodeView" cpt
...@@ -284,10 +311,6 @@ buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-2 ...@@ -284,10 +311,6 @@ buttonClick (node@{action} /\ setNodePopup) _ todo = H.div {className: "col-md-2
buttonClick _ _ _ = H.div {} [] buttonClick _ _ _ = H.div {} []
-- END Popup View -- END Popup View
type NodeProps = type NodeProps =
...@@ -308,23 +331,25 @@ panelAction d {id,name,nodeType,action, session} p = case action of ...@@ -308,23 +331,25 @@ panelAction d {id,name,nodeType,action, session} p = case action of
, H.p {} [ H.text "See the instances terms of uses."] , H.p {} [ H.text "See the instances terms of uses."]
] ]
] ]
(Just (Documentation FolderPrivate)) -> R.fragment [H.p {} [H.text $ "This folder and its children are private only!"]] (Just (Documentation FolderPrivate)) -> fragmentPT "This folder and its children are private only!"
(Just (Documentation FolderPublic)) -> R.fragment [H.p {} [H.text $ "Soon, you will be able to build public folders to share your work with the world!"]] (Just (Documentation FolderPublic)) -> fragmentPT "Soon, you will be able to build public folders to share your work with the world!"
(Just (Documentation FolderShared)) -> R.fragment [H.p {} [H.text $ "Soon, you will be able to build teams folders to share your work"]] (Just (Documentation FolderShared)) -> fragmentPT "Soon, you will be able to build teams folders to share your work"
(Just (Documentation x)) -> R.fragment [ H.p {} [H.text $ "More information on" <> show nodeType]] (Just (Documentation x)) -> fragmentPT $ "More information on" <> show nodeType
(Just (Link _)) -> R.fragment [ H.p {} [H.text $ "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)."]] (Just (Link _)) -> fragmentPT "Soon, you will be able to link the corpus with your Annuaire (and reciprocally)."
(Just Upload) -> R.fragment [ H.p {} [H.text $ "Soon, you will be able to upload your file here"]] (Just Upload) -> fragmentPT "Soon, you will be able to upload your file here"
(Just Download) -> R.fragment [ H.p {} [H.text $ "Soon, you will be able to dowload your file here"]] (Just Download) -> fragmentPT "Soon, you will be able to dowload your file here"
(Just SearchBox) -> R.fragment [ H.p {} [ H.text $ "Search and create a private corpus with the search query as corpus name." ] (Just SearchBox) -> R.fragment [ H.p {} [ H.text $ "Search and create a private corpus with the search query as corpus name." ]
, searchBar {session, datafield:Nothing, langs:allLangs, node_id: (Just id)} -- , searchBar {session, datafield:Nothing, langs:allLangs, node_id: (Just id)}
] ]
(Just Delete) -> case nodeType of (Just Delete) -> case nodeType of
NodeUser -> R.fragment [ H.div {} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."]] NodeUser -> R.fragment [ H.div {} [H.text "Yes, we are RGPD compliant! But you can not delete User Node yet (we are still on development). Thanks for your comprehensin."]]
_ -> R.fragment [ H.div {} (map (\t -> H.p {} [H.text t]) ["Are your sure you want to delete it ?", "If yes, click again below."]), reallyDelete d] _ -> R.fragment [ H.div {} (map (\t -> H.p {} [H.text t]) ["Are your sure you want to delete it ?", "If yes, click again below."]), reallyDelete d]
(Just (Add xs)) -> createNodeView d {id, name, nodeType} p xs (Just (Add xs)) -> createNodeView d {id, name, nodeType} p xs
_ -> H.div {} [] _ -> H.div {} []
where
fragmentPT text = R.fragment [H.p {} [H.text text]]
infoTitle :: NodeType -> R.Element infoTitle :: NodeType -> R.Element
......
...@@ -35,7 +35,8 @@ searchBarCpt = R.hooksComponent "G.C.Node.SearchBar.searchBar" cpt ...@@ -35,7 +35,8 @@ searchBarCpt = R.hooksComponent "G.C.Node.SearchBar.searchBar" cpt
cpt {session, datafield, langs, node_id} _ = do cpt {session, datafield, langs, node_id} _ = do
search <- R.useState' Nothing search <- R.useState' Nothing
onSearchChange session search onSearchChange session search
pure $ H.div {} [ searchField {databases:allDatabases, langs, search, node_id}] pure $ H.div { style: {width: "100%"} }
[ searchField {databases:allDatabases, langs, search, node_id}]
onSearchChange :: Session -> R.State (Maybe Search) -> R.Hooks Unit onSearchChange :: Session -> R.State (Maybe Search) -> R.Hooks Unit
......
...@@ -5,13 +5,15 @@ import Prelude (bind, const, identity, pure, show, ($), (/=), (<$>), (||), (==), ...@@ -5,13 +5,15 @@ import Prelude (bind, const, identity, pure, show, ($), (/=), (<$>), (||), (==),
import Data.Maybe (Maybe(..), maybe, isJust) import Data.Maybe (Maybe(..), maybe, isJust)
import Data.String (length) import Data.String (length)
import Data.Set as Set import Data.Set as Set
import Data.Tuple (fst) import Data.Tuple (fst, Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix.DOM.HTML as H 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 (text, button, div, input, span, ul, li, a, option, text, i)
import URI.Extra.QueryPairs as NQP
import URI.Query as Query
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.
...@@ -56,78 +58,103 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged ...@@ -56,78 +58,103 @@ searchFieldComponent = R.memo (R.hooksComponent "SearchField" cpt) hasChanged
lang@(curLg /\ _) <- R.useState' (Nothing :: Maybe Lang) lang@(curLg /\ _) <- R.useState' (Nothing :: Maybe Lang)
fi <- R.useState' "" fi <- R.useState' ""
pure $ pure $
div { className: "search-field-group" } div { className: "search-field-group", style: { width: "100%" } }
[ searchInput term [
, if length curTerm < 3 div { className: "row" }
[
div { className: "col-md-3" }
[ searchInput term
, if length curTerm < 3
then then
div {}[] div {}[]
else else
div {} [ langNav lang props.langs div {} [ langNav lang props.langs
, if curLg == Nothing , if curLg == Nothing
then then
div {}[] div {}[]
else else
div {} [ dataFieldNav df dataFields div {} [ dataFieldNav df dataFields
, if isExternal curDf , if isExternal curDf
then databaseInput df props.databases then databaseInput df props.databases
else div {} [] else div {} []
, if isHAL curDf , if isHAL curDf
then orgInput df allOrgs then orgInput df allOrgs
else div {} [] else div {} []
, if isIMT curDf , if isIMT curDf
then then
R.fragment componentIMT df fi
[ ul {} $ map ( \org -> li {} else div {} []
[ input { type: "checkbox"
, checked: isIn org curDf , if isCNRS curDf
, on: {change: \_ -> (setDf then
$ const componentCNRS df fi
$ updateFilter org curDf) else
} div {} []
} ]
, if org == All_IMT ]
then i {} [text $ " " <> show org] ]
else text $ " " <> show org
] , div { className: "col-md-9" }
) allIMTorgs [
, filterInput fi if isIsTex curDf
] then
else div {} [] componentIsTex df fi curTerm
else
, if isCNRS curDf H.div {} []
then ]
R.fragment [ div {} [], filterInput fi]
else
div {} []
, if isIsTex curDf
then H.div { className: ""
, id: "search-popup-tooltip"
, title: "Node settings"
, data: { toggle: "tooltip"
, placement: "right"
}
}
[ H.div {id: "arrow"} []
, H.div { className: "panel panel-default"
, style: { border : "1px solid rgba(0,0,0,0.2)"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
}
} [ H.iframe { src: "https://istex.gargantext.org", width: "100%", height: "100%"} []
]
]
else H.div {} []
]
]
, submitButton node_id df term lang props.search
] ]
, submitButton node_id df term lang props.search
]
hasChanged p p' = (fst p.search /= fst p'.search) hasChanged p p' = (fst p.search /= fst p'.search)
|| (p.databases /= p'.databases ) || (p.databases /= p'.databases )
|| (p.langs /= p'.langs ) || (p.langs /= p'.langs )
-- || (fst p.filters /= fst p'.filters ) -- || (fst p.filters /= fst p'.filters )
componentIMT (curDf /\ setDf) fi =
R.fragment
[ ul {} $ map ( \org -> li {}
[ input { type: "checkbox"
, checked: isIn org curDf
, on: {change: \_ -> (setDf
$ const
$ updateFilter org curDf)
}
}
, if org == All_IMT
then i {} [text $ " " <> show org]
else text $ " " <> show org
]
) allIMTorgs
, filterInput fi
]
componentCNRS (df /\ setDf) fi = R.fragment [ div {} [], filterInput fi]
componentIsTex (df /\ setDf) fi curTerm =
H.div { className: ""
, id: "search-popup-tooltip"
, title: "Node settings"
, data: { toggle: "tooltip"
, placement: "right"
}
}
[ H.div {id: "arrow"} []
, H.div { className: "panel panel-default"
, style: { border : "1px solid rgba(0,0,0,0.2)"
, boxShadow : "0 2px 5px rgba(0,0,0,0.2)"
}
} [ H.iframe { src: isTexTermUrl curTerm , width: "100%", height: "100%"} []
]
]
isTexUrl = "https://istex.gargantext.org"
isTexLocalUrl = "http://localhost:8083"
isTexTermUrl term = isTexLocalUrl <> query
where
query = Query.print $ NQP.print identity identity qp
qp = NQP.QueryPairs [
Tuple (NQP.keyFromString "query") (Just (NQP.valueFromString term))
]
isExternal :: Maybe DataField -> Boolean isExternal :: Maybe DataField -> Boolean
...@@ -286,13 +313,13 @@ filterInput (term /\ setTerm) = ...@@ -286,13 +313,13 @@ filterInput (term /\ setTerm) =
searchInput :: R.State String -> R.Element searchInput :: R.State String -> R.Element
searchInput (term /\ setTerm) = searchInput (term /\ setTerm) =
div { className : "" } div { className : "" }
[ input { defaultValue: term [ input { defaultValue: term
, className: "form-control" , className: "form-control"
, type: "text" , type: "text"
, on: { change : \e -> setTerm $ const $ e .. "target" .. "value" } , on: { change : \e -> setTerm $ const $ e .. "target" .. "value" }
, placeholder: "Your Query here" } , placeholder: "Your Query here" }
] ]
submitButton :: Maybe Int submitButton :: Maybe Int
......
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