Commit dbb0fd41 authored by arturo's avatar arturo

>>> continue

parent ea829efa
...@@ -7,7 +7,7 @@ module Gargantext.Components.PhyloExplorer.Draw ...@@ -7,7 +7,7 @@ module Gargantext.Components.PhyloExplorer.Draw
import Gargantext.Prelude import Gargantext.Prelude
import DOM.Simple (Window) import DOM.Simple (Document, Window, querySelectorAll)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (for_) import Data.Foldable (for_)
import Data.FoldableWithIndex (forWithIndex_) import Data.FoldableWithIndex (forWithIndex_)
...@@ -17,7 +17,6 @@ import Effect.Class (liftEffect) ...@@ -17,7 +17,6 @@ import Effect.Class (liftEffect)
import Effect.Uncurried (EffectFn1, EffectFn7, runEffectFn1, runEffectFn7) import Effect.Uncurried (EffectFn1, EffectFn7, runEffectFn1, runEffectFn7)
import FFI.Simple (applyTo, getProperty, (..), (.=), (.?)) import FFI.Simple (applyTo, getProperty, (..), (.=), (.?))
import Gargantext.Components.PhyloExplorer.Types (AncestorLink, Branch, BranchLink, GlobalTerm(..), Group(..), Link, Period, PhyloDataSet(..)) import Gargantext.Components.PhyloExplorer.Types (AncestorLink, Branch, BranchLink, GlobalTerm(..), Group(..), Link, Period, PhyloDataSet(..))
import Gargantext.Utils.Reactix (getElementById)
import Graphics.D3.Base (D3, D3Eff) import Graphics.D3.Base (D3, D3Eff)
import Graphics.D3.Selection as D3S import Graphics.D3.Selection as D3S
import Graphics.D3.Util (ffi) import Graphics.D3.Util (ffi)
...@@ -135,18 +134,23 @@ setGlobalD3Reference window d3 = void $ pure $ (window .= "d3") d3 ...@@ -135,18 +134,23 @@ setGlobalD3Reference window d3 = void $ pure $ (window .= "d3") d3
----------------------------------------------------------- -----------------------------------------------------------
unhide :: String -> Effect Unit unhide :: Document -> String -> Effect Unit
unhide name = pure unit unhide d s = do
<* setText "phyloName" name setText s `toElements` "#phyloName"
<* turnVisible "phyloName" turnVisible `toElements` "#phyloName"
<* turnVisible "reset" turnVisible `toElements` ".reset"
<* turnVisible "label" turnVisible `toElements` ".label"
<* turnVisible "heading" turnVisible `toElements` ".heading"
turnVisible `toElements` ".export"
where where
setText id n = getElementById id >>= \el -> pure $ (el .= "innerHTML") n toElements fn query = querySelectorAll d query >>= flip for_ fn
turnVisible id = getElementById id >>= \el -> pure $ (el .= "visibility")
"visible" turnVisible el = do
style <- pure $ (el .. "style")
pure $ (style .= "visibility") "visible"
setText name el = pure $ (el .= "innerHTML") name
----------------------------------------------------------- -----------------------------------------------------------
......
...@@ -66,27 +66,7 @@ type NodeData = ...@@ -66,27 +66,7 @@ type NodeData =
) )
data RawObject data RawObject
= Layer = GroupToNode
{ _gvid :: Int
, nodes :: Array Int
| GraphData
}
| BranchToNode
{ _gvid :: Int
, age :: String
, bId :: String
, birth :: String
, branchId :: String
, branch_x :: String
, branch_y :: String
, fillcolor :: String
, fontname :: String
, fontsize :: String
, size :: String
, style :: String
| NodeData
}
| GroupToNode
{ _gvid :: Int { _gvid :: Int
, bId :: String , bId :: String
, branchId :: String , branchId :: String
...@@ -106,6 +86,21 @@ data RawObject ...@@ -106,6 +86,21 @@ data RawObject
, weight :: String , weight :: String
| NodeData | NodeData
} }
| BranchToNode
{ _gvid :: Int
, age :: String
, bId :: String
, birth :: String
, branchId :: String
, branch_x :: String
, branch_y :: String
, fillcolor :: String
, fontname :: String
, fontsize :: String
, size :: String
, style :: String
| NodeData
}
| PeriodToNode | PeriodToNode
{ _gvid :: Int { _gvid :: Int
, fontsize :: String , fontsize :: String
...@@ -115,6 +110,12 @@ data RawObject ...@@ -115,6 +110,12 @@ data RawObject
, to :: String , to :: String
| NodeData | NodeData
} }
| Layer
{ _gvid :: Int
, nodes :: Array Int
| GraphData
}
derive instance Generic RawObject _ derive instance Generic RawObject _
derive instance Eq RawObject derive instance Eq RawObject
......
...@@ -4,7 +4,7 @@ module Gargantext.Components.PhyloExplorer.Layout ...@@ -4,7 +4,7 @@ module Gargantext.Components.PhyloExplorer.Layout
import Gargantext.Prelude import Gargantext.Prelude
import DOM.Simple (window) import DOM.Simple (document, window)
import Data.Array as Array import Data.Array as Array
import Gargantext.Components.PhyloExplorer.Draw (drawPhylo, highlightSource, setGlobalD3Reference, setGlobalDependencies, unhide) import Gargantext.Components.PhyloExplorer.Draw (drawPhylo, highlightSource, setGlobalD3Reference, setGlobalDependencies, unhide)
import Gargantext.Components.PhyloExplorer.Types (PhyloDataSet(..)) import Gargantext.Components.PhyloExplorer.Types (PhyloDataSet(..))
...@@ -29,7 +29,7 @@ layoutCpt = here.component "layout" cpt where ...@@ -29,7 +29,7 @@ layoutCpt = here.component "layout" cpt where
} _ = do } _ = do
-- States -- States
R.useEffectOnce' $ do R.useEffectOnce' $ do
unhide o.name unhide document o.name
setGlobalD3Reference window d3 setGlobalD3Reference window d3
setGlobalDependencies window (PhyloDataSet o) setGlobalDependencies window (PhyloDataSet o)
drawPhylo drawPhylo
......
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