Commit 972a2ab9 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-highlight-currently-selected-node-in-tree' of...

Merge branch 'dev-highlight-currently-selected-node-in-tree' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents bde26977 31a48770
...@@ -167,7 +167,7 @@ toHtml :: Record ToHtmlProps -> R.Element ...@@ -167,7 +167,7 @@ toHtml :: Record ToHtmlProps -> R.Element
toHtml p = R.createElement toHtmlCpt p [] toHtml p = R.createElement toHtmlCpt p []
toHtmlCpt :: R.Component ToHtmlProps toHtmlCpt :: R.Component ToHtmlProps
toHtmlCpt = R.hooksComponentWithModule thisModule "nodeView" cpt toHtmlCpt = R.hooksComponentWithModule thisModule "toHtml" cpt
where where
cpt p@{ asyncTasks cpt p@{ asyncTasks
, frontends , frontends
...@@ -199,7 +199,8 @@ toHtmlCpt = R.hooksComponentWithModule thisModule "nodeView" cpt ...@@ -199,7 +199,8 @@ toHtmlCpt = R.hooksComponentWithModule thisModule "nodeView" cpt
let withId (NTree (LNode {id: id'}) _) = id' let withId (NTree (LNode {id: id'}) _) = id'
pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $ pure $ H.li { className: if A.null ary then "no-children" else "with-children" } $
[ nodeMainSpan { asyncTasks [ nodeMainSpan
{ asyncTasks
, dispatch: pAction , dispatch: pAction
, folderOpen , folderOpen
, frontends , frontends
...@@ -223,6 +224,10 @@ toHtmlCpt = R.hooksComponentWithModule thisModule "nodeView" cpt ...@@ -223,6 +224,10 @@ toHtmlCpt = R.hooksComponentWithModule thisModule "nodeView" cpt
, handed , handed
} }
) )
where
commonProps = RecordE.pick p :: Record CommonProps
pAction a = performAction a (RecordE.pick p :: Record PerformActionProps)
type ChildNodesProps = type ChildNodesProps =
......
...@@ -6,6 +6,7 @@ import Data.Set (Set) ...@@ -6,6 +6,7 @@ import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.String as S import Data.String as S
import Data.String.CodeUnits as DSCU import Data.String.CodeUnits as DSCU
import Data.Tuple (snd)
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (Aff, launchAff, launchAff_) import Effect.Aff (Aff, launchAff, launchAff_)
...@@ -294,7 +295,7 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt ...@@ -294,7 +295,7 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt
popoverRef <- R.useRef null popoverRef <- R.useRef null
pure $ pure $
H.div { on: { click: \_ -> setFolderOpen $ not } } H.div { on: { click: onClick } }
[ H.a { data: { for: tooltipId [ H.a { data: { for: tooltipId
, tip: true , tip: true
} }
...@@ -313,6 +314,12 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt ...@@ -313,6 +314,12 @@ nodeLinkCpt = R.hooksComponentWithModule thisModule "nodeLink" cpt
] ]
where where
-- NOTE Don't toggle tree if it is not selected
-- This prevents some irritating behaviour
onClick _ = if isSelected then
setFolderOpen not
else
pure unit
tooltipId = "node-link-" <> show id tooltipId = "node-link-" <> show id
-- END node link -- END node link
......
...@@ -30,6 +30,7 @@ import Gargantext.Types (NodeType(..), AffTableResult) ...@@ -30,6 +30,7 @@ import Gargantext.Types (NodeType(..), AffTableResult)
import Gargantext.Utils.Crypto as Crypto import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
thisModule :: String
thisModule = "Gargantext.Components.Nodes.Corpus" thisModule = "Gargantext.Components.Nodes.Corpus"
type Props = type Props =
......
...@@ -10,27 +10,27 @@ import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType, ...@@ -10,27 +10,27 @@ import Gargantext.Types (ChartOpts, ChartType, CorpusMetricOpts, CTabNgramType,
import Gargantext.Types as GT import Gargantext.Types as GT
data AppRoute data AppRoute
= Home = Annuaire SessionId Int
| Login | ContactPage SessionId Int Int
| Corpus SessionId Int
| CorpusDocument SessionId Int Int Int
| Dashboard SessionId Int
| Document SessionId Int Int
| Folder SessionId Int | Folder SessionId Int
| FolderPrivate SessionId Int | FolderPrivate SessionId Int
| FolderPublic SessionId Int | FolderPublic SessionId Int
| FolderShared SessionId Int | FolderShared SessionId Int
| Team SessionId Int | Home
| Corpus SessionId Int
| Document SessionId Int Int
| CorpusDocument SessionId Int Int Int
| PGraphExplorer SessionId Int
| Dashboard SessionId Int
| Texts SessionId Int
| Lists SessionId Int | Lists SessionId Int
| Annuaire SessionId Int | Login
| UserPage SessionId Int | PGraphExplorer SessionId Int
| ContactPage SessionId Int Int | RouteFile SessionId Int
| RouteFrameWrite SessionId Int
| RouteFrameCalc SessionId Int | RouteFrameCalc SessionId Int
| RouteFrameCode SessionId Int | RouteFrameCode SessionId Int
| RouteFile SessionId Int | RouteFrameWrite SessionId Int
| Team SessionId Int
| Texts SessionId Int
| UserPage SessionId Int
derive instance eqAppRoute :: Eq AppRoute derive instance eqAppRoute :: Eq AppRoute
...@@ -108,14 +108,17 @@ appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i ...@@ -108,14 +108,17 @@ appPath (RouteFile s i) = "file/" <> show s <> "/" <> show i
nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute nodeTypeAppRoute :: NodeType -> SessionId -> Int -> Maybe AppRoute
nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i nodeTypeAppRoute GT.Annuaire s i = Just $ Annuaire s i
nodeTypeAppRoute GT.NodeContact s i = Just $ Annuaire s i
nodeTypeAppRoute GT.Corpus s i = Just $ Corpus s i nodeTypeAppRoute GT.Corpus s i = Just $ Corpus s i
nodeTypeAppRoute GT.Dashboard s i = Just $ Dashboard s i nodeTypeAppRoute GT.Dashboard s i = Just $ Dashboard s i
nodeTypeAppRoute GT.Graph s i = Just $ PGraphExplorer s i nodeTypeAppRoute GT.Folder s i = Just $ Folder s i
nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.FolderPrivate s i = Just $ FolderPrivate s i nodeTypeAppRoute GT.FolderPrivate s i = Just $ FolderPrivate s i
nodeTypeAppRoute GT.FolderPublic s i = Just $ FolderPublic s i nodeTypeAppRoute GT.FolderPublic s i = Just $ FolderPublic s i
nodeTypeAppRoute GT.FolderShared s i = Just $ FolderShared s i nodeTypeAppRoute GT.FolderShared s i = Just $ FolderShared s i
nodeTypeAppRoute GT.Graph s i = Just $ PGraphExplorer s i
nodeTypeAppRoute GT.NodeContact s i = Just $ Annuaire s i
nodeTypeAppRoute GT.NodeFile s i = Just $ RouteFile s i
nodeTypeAppRoute GT.NodeList s i = Just $ Lists s i
nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i nodeTypeAppRoute GT.NodeUser s i = Just $ UserPage s i
nodeTypeAppRoute GT.Team s i = Just $ Team s i
nodeTypeAppRoute GT.Texts s i = Just $ Texts s i nodeTypeAppRoute GT.Texts s i = Just $ Texts s i
nodeTypeAppRoute _ _ _ = Nothing nodeTypeAppRoute _ _ _ = Nothing
...@@ -136,29 +136,32 @@ instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where ...@@ -136,29 +136,32 @@ instance encodeJsonTabPostQuery :: EncodeJson TabPostQuery where
~> "query" := post.query ~> "query" := post.query
~> jsonEmptyObject ~> jsonEmptyObject
data NodeType = NodeUser data NodeType = Annuaire
| Folder | FolderPrivate | FolderShared | FolderPublic
| Annuaire
| NodeContact
| Corpus | Corpus
| Team
| Url_Document
| Dashboard | Dashboard
| Error | Error
| Folder
| FolderPrivate
| FolderPublic
| FolderShared
| Graph | Graph
| Phylo
| Individu | Individu
| Node | Node
| Nodes | NodeContact
| Tree
| NodeList | NodeList
| NodeUser
| Nodes
| Phylo
| Team
| Texts | Texts
| Tree
| Url_Document
-- TODO Optional Nodes -- TODO Optional Nodes
| NodeFrameWrite | NodeFile
| NodeFrameCalc | NodeFrameCalc
| NodeFrameNotebook | NodeFrameNotebook
| NodeFrameWrite
| NodePublic NodeType | NodePublic NodeType
| NodeFile
derive instance eqNodeType :: Eq NodeType derive instance eqNodeType :: Eq NodeType
......
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