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

Merge remote-tracking branch 'origin/465-dev-graph-explorer-recursion-error' into dev-merge

parents 2e4c9344 2ddee534
let upstream = let upstream =
https://github.com/garganscript/package-sets/releases/download/v0.1.4/release.dhall https://github.com/garganscript/package-sets/releases/download/v0.1.6/release.dhall sha256:443a37602d5b9353c4daf4349079a77d5dddf07a7b35219016b167404d1e1138
sha256:e03eafe0c7ea0ac143d07ec6d9f20c804bd6b6f95a8d89bf287c279e770584c8
let overrides = let overrides =
{ graphql-client = { graphql-client =
...@@ -61,8 +60,7 @@ let overrides = ...@@ -61,8 +60,7 @@ let overrides =
, version = "v9.2.2" , version = "v9.2.2"
} }
, jest = , jest =
{ -- markdown-it dependency { dependencies =
dependencies =
[ "aff" [ "aff"
, "aff-promise" , "aff-promise"
, "effect" , "effect"
...@@ -125,7 +123,7 @@ let additions = ...@@ -125,7 +123,7 @@ let additions =
, "unsafe-coerce" , "unsafe-coerce"
] ]
, repo = "https://github.com/garganscript/purescript-sequences.git" , repo = "https://github.com/garganscript/purescript-sequences.git"
, version = "7ad61fde5239fbf66ceeefc0b7608aa9cbc53701" , version = "recursion-fix"
} }
, spec-discovery = , spec-discovery =
{ dependencies = [ "prelude", "effect", "arrays", "spec", "node-fs" ] { dependencies = [ "prelude", "effect", "arrays", "spec", "node-fs" ]
...@@ -194,4 +192,4 @@ let additions = ...@@ -194,4 +192,4 @@ let additions =
} }
} }
in upstream // overrides // additions in upstream ⫽ overrides ⫽ additions
...@@ -70,7 +70,6 @@ to generate this file without the comments in this block. ...@@ -70,7 +70,6 @@ to generate this file without the comments in this block.
, "record" , "record"
, "record-extra" , "record-extra"
, "routing" , "routing"
, "sequences"
, "simple-json" , "simple-json"
, "simple-json-generics" , "simple-json-generics"
, "simplecrypto" , "simplecrypto"
......
...@@ -33,6 +33,9 @@ options = ...@@ -33,6 +33,9 @@ options =
, sustainingPhaseDuration : Nothing , sustainingPhaseDuration : Nothing
} }
cname :: String
cname = "b-cloak"
-- | Abstract component type easing the transition display between a content -- | Abstract component type easing the transition display between a content
-- | component and transitional (or cloak) component -- | component and transitional (or cloak) component
-- | -- |
...@@ -108,10 +111,6 @@ options = ...@@ -108,10 +111,6 @@ options =
-- | ``` -- | ```
cloak :: forall r. R2.OptLeaf Options Props r cloak :: forall r. R2.OptLeaf Options Props r
cloak = R2.optLeaf component options cloak = R2.optLeaf component options
cname :: String
cname = "b-cloak"
component :: R.Component Props component :: R.Component Props
component = R.hooksComponent cname cpt where component = R.hooksComponent cname cpt where
cpt props _ = do cpt props _ = do
......
...@@ -49,7 +49,6 @@ type GraphUpdateButtonProps = ...@@ -49,7 +49,6 @@ type GraphUpdateButtonProps =
graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element graphUpdateButton :: Record GraphUpdateButtonProps -> R.Element
graphUpdateButton p = R.createElement graphUpdateButtonCpt p [] graphUpdateButton p = R.createElement graphUpdateButtonCpt p []
graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps graphUpdateButtonCpt :: R.Component GraphUpdateButtonProps
graphUpdateButtonCpt = here.component "graphUpdateButton" cpt graphUpdateButtonCpt = here.component "graphUpdateButton" cpt
where where
......
...@@ -51,8 +51,8 @@ type Props = ...@@ -51,8 +51,8 @@ type Props =
layout :: R2.Leaf Props layout :: R2.Leaf Props
layout = R2.leaf layoutCpt layout = R2.leaf layoutCpt
layoutCpt :: R.Memo Props layoutCpt :: R.Component Props
layoutCpt = R.memo' $ here.component "explorerWriteGraph" cpt where layoutCpt = here.component "layout" cpt where
cpt { fa2Ref cpt { fa2Ref
, sigmaRef , sigmaRef
} _ = do } _ = do
......
...@@ -64,7 +64,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where ...@@ -64,7 +64,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
, edgeConfluence , edgeConfluence
, edgeWeight , edgeWeight
, forceAtlasState , forceAtlasState
, graph
, graphStage , graphStage
, hyperdataGraph , hyperdataGraph
, mouseSelectorSize , mouseSelectorSize
...@@ -78,7 +77,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where ...@@ -78,7 +77,6 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
edgeWeight' <- R2.useLive' edgeWeight edgeWeight' <- R2.useLive' edgeWeight
forceAtlasState' <- R2.useLive' forceAtlasState forceAtlasState' <- R2.useLive' forceAtlasState
graphStage' <- R2.useLive' graphStage graphStage' <- R2.useLive' graphStage
graph' <- R2.useLive' graph
startForceAtlas' <- R2.useLive' startForceAtlas startForceAtlas' <- R2.useLive' startForceAtlas
hyperdataGraph' <- R2.useLive' hyperdataGraph hyperdataGraph' <- R2.useLive' hyperdataGraph
...@@ -101,7 +99,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where ...@@ -101,7 +99,7 @@ drawGraphCpt = R.memo' $ here.component "graph" cpt where
here.log "[drawGraph (Cleanup)] sigma killed" here.log "[drawGraph (Cleanup)] sigma killed"
-- Stage Init -- Stage Init
R.useEffect1' graphStage' $ case graphStage' of R.useEffect2' hyperdataGraph' graphStage' $ case graphStage' of
GET.Init -> do GET.Init -> do
let mCamera = getter _.mCamera hyperdataGraph' let mCamera = getter _.mCamera hyperdataGraph'
......
...@@ -160,7 +160,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt where ...@@ -160,7 +160,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt where
sideTabData :: R2.Leaf Props sideTabData :: R2.Leaf Props
sideTabData = R2.leaf sideTabDataCpt sideTabData = R2.leaf sideTabDataCpt
sideTabDataCpt :: R.Component Props sideTabDataCpt :: R.Component Props
sideTabDataCpt = here.component "sideTabData" cpt where sideTabDataCpt = here.component "sideTabData" cpt where
cpt props _ = do cpt props _ = do
......
...@@ -31,7 +31,6 @@ type Props = ...@@ -31,7 +31,6 @@ type Props =
legend :: R2.Leaf Props legend :: R2.Leaf Props
legend = R2.leaf legendCpt legend = R2.leaf legendCpt
legendCpt :: R.Component Props legendCpt :: R.Component Props
legendCpt = here.component "legend" cpt where legendCpt = here.component "legend" cpt where
cpt { legendSeq cpt { legendSeq
......
...@@ -54,9 +54,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -54,9 +54,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
, edgeWeight , edgeWeight
, forceAtlasState , forceAtlasState
, graph , graph
, graphId
, graphStage , graphStage
, hyperdataGraph
, labelRenderedSizeThreshold , labelRenderedSizeThreshold
, labelSize , labelSize
, mouseSelectorSize , mouseSelectorSize
...@@ -71,9 +69,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -71,9 +69,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
forceAtlasState' <- R2.useLive' forceAtlasState forceAtlasState' <- R2.useLive' forceAtlasState
graph' <- R2.useLive' graph graph' <- R2.useLive' graph
graphId' <- R2.useLive' graphId
graphStage' <- R2.useLive' graphStage graphStage' <- R2.useLive' graphStage
hyperdataGraph' <- R2.useLive' hyperdataGraph
selectedNodeIds' <- R2.useLive' selectedNodeIds selectedNodeIds' <- R2.useLive' selectedNodeIds
showSidebar' <- R2.useLive' showSidebar showSidebar' <- R2.useLive' showSidebar
...@@ -89,7 +85,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where ...@@ -89,7 +85,7 @@ controlsCpt = R.memo' $ here.component "controls" cpt where
-- When graph is changed, cleanup the mFAPauseRef so that forceAtlas -- When graph is changed, cleanup the mFAPauseRef so that forceAtlas
-- timeout is retriggered. -- timeout is retriggered.
R.useEffect' $ do R.useEffect1' graphStage' $ do
case graphStage' of case graphStage' of
GET.Init -> R.setRef mFAPauseRef Nothing GET.Init -> R.setRef mFAPauseRef Nothing
_ -> pure unit _ -> pure unit
......
module Gargantext.Components.Nodes.Corpus.Graph module Gargantext.Components.Nodes.Graph
( node ( node
) where ) where
...@@ -6,7 +6,7 @@ import Gargantext.Prelude ...@@ -6,7 +6,7 @@ import Gargantext.Prelude
import DOM.Simple (document, querySelector) import DOM.Simple (document, querySelector)
import Data.Int as I import Data.Int as I
import Data.Maybe (Maybe(..), isJust, maybe) import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Sequence as Seq import Data.Sequence as Seq
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\)) import Data.Tuple.Nested ((/\))
...@@ -27,14 +27,16 @@ import Gargantext.Utils (getter) ...@@ -27,14 +27,16 @@ import Gargantext.Utils (getter)
import Gargantext.Utils.Range as Range import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record import Record as Record
import Toestand as T
type Props = type Props =
( graphId :: GET.GraphId ( graphId :: GET.GraphId
) )
here :: R2.Here here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Graph" here = R2.here "Gargantext.Components.Nodes.Graph"
node :: R2.Leaf ( key :: String | Props ) node :: R2.Leaf ( key :: String | Props )
node = R2.leaf nodeCpt node = R2.leaf nodeCpt
...@@ -49,8 +51,8 @@ nodeCpt = here.component "node" cpt where ...@@ -49,8 +51,8 @@ nodeCpt = here.component "node" cpt where
session <- useSession session <- useSession
graphVersion' <- R2.useLive' graphVersion graphVersion' <- R2.useLive' graphVersion
state' /\ state <- R2.useBox' Nothing state <- T.useBox Nothing
cache' /\ cache <- R2.useBox' (GET.defaultCacheParams :: GET.CacheParams) cache <- T.useBox (GET.defaultCacheParams :: GET.CacheParams)
-- | Computed -- | Computed
-- | -- |
...@@ -82,8 +84,23 @@ nodeCpt = here.component "node" cpt where ...@@ -82,8 +84,23 @@ nodeCpt = here.component "node" cpt where
-- | Render -- | Render
-- | -- |
pure $ pure $ renderNode { cache, graphId, state }
type RenderNodeProps = (
cache :: T.Box GET.CacheParams,
graphId :: GET.GraphId,
state :: T.Box (Maybe GET.HyperdataGraph)
)
renderNode :: R2.Leaf RenderNodeProps
renderNode = R2.leaf renderNodeCpt
renderNodeCpt :: R.Component RenderNodeProps
renderNodeCpt = here.component "renderNode" cpt where
cpt { cache, graphId, state } _ = do
cache' <- T.useLive T.unequal cache
state' <- T.useLive T.unequal state
pure $
B.cloak B.cloak
{ isDisplayed: isJust state' { isDisplayed: isJust state'
, idlingPhaseDuration: Just 150 , idlingPhaseDuration: Just 150
...@@ -167,6 +184,7 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where ...@@ -167,6 +184,7 @@ hydrateStoreCpt = here.component "hydrateStore" cpt where
-- | -- |
pure $ pure $
GraphStore.provide GraphStore.provide
state state
[ [
......
...@@ -23,8 +23,8 @@ import Gargantext.Components.Nodes.Corpus as Corpus ...@@ -23,8 +23,8 @@ import Gargantext.Components.Nodes.Corpus as Corpus
import Gargantext.Components.Nodes.Corpus.Code (corpusCodeLayout) import Gargantext.Components.Nodes.Corpus.Code (corpusCodeLayout)
import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout) import Gargantext.Components.Nodes.Corpus.Dashboard (dashboardLayout)
import Gargantext.Components.Nodes.Corpus.Document as Document import Gargantext.Components.Nodes.Corpus.Document as Document
import Gargantext.Components.Nodes.Corpus.Graph as Graph
import Gargantext.Components.Nodes.Corpus.Phylo as Phylo import Gargantext.Components.Nodes.Corpus.Phylo as Phylo
import Gargantext.Components.Nodes.Graph as Graph
import Gargantext.Components.Nodes.File (fileLayout) import Gargantext.Components.Nodes.File (fileLayout)
import Gargantext.Components.Nodes.Frame as Frame import Gargantext.Components.Nodes.Frame as Frame
import Gargantext.Components.Nodes.Home (homeLayout) import Gargantext.Components.Nodes.Home (homeLayout)
......
...@@ -78,7 +78,7 @@ useLoaderEffect { errorHandler, loader: loader', path, state } = do ...@@ -78,7 +78,7 @@ useLoaderEffect { errorHandler, loader: loader', path, state } = do
state' <- T.useLive T.unequal state state' <- T.useLive T.unequal state
oPath <- R.useRef path oPath <- R.useRef path
R.useEffect' $ do R.useEffect2' path state' $ do
path' <- R.readRefM oPath path' <- R.readRefM oPath
if (path' == path) && (isJust state') if (path' == path) && (isJust state')
then pure $ R.nothing then pure $ R.nothing
......
...@@ -44,12 +44,9 @@ newGraph = runEffectFn1 _newGraph ...@@ -44,12 +44,9 @@ newGraph = runEffectFn1 _newGraph
graphFromSigmaxGraph :: Types.Graph Types.Node Types.Edge -> Effect Graph graphFromSigmaxGraph :: Types.Graph Types.Node Types.Edge -> Effect Graph
graphFromSigmaxGraph (Types.Graph g) = do graphFromSigmaxGraph (Types.Graph g) = do
graph <- newGraph unit graph <- newGraph unit
_ <- traverse (addNode graph) nodes _ <- traverse (addNode graph) g.nodes
_ <- traverse (addEdge graph) edges _ <- traverse (addEdge graph) g.edges
pure graph pure graph
where
nodes = A.fromFoldable g.nodes
edges = A.fromFoldable g.edges
addNode :: Graph -> Record Types.Node -> Effect String addNode :: Graph -> Record Types.Node -> Effect String
addNode g node@{ id } = runEffectFn3 _addNode g id node addNode g node@{ id } = runEffectFn3 _addNode g id node
......
...@@ -2,13 +2,14 @@ module Gargantext.Utils where ...@@ -2,13 +2,14 @@ module Gargantext.Utils where
import Prelude import Prelude
import Data.Array as A
import Data.Char (fromCharCode) import Data.Char (fromCharCode)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldr) import Data.Foldable (class Foldable, foldr)
import Data.Lens (Lens', lens) import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(..), fromJust) import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype, unwrap, wrap) import Data.Newtype (class Newtype, unwrap, wrap)
import Data.Sequence.Ordered as OSeq --import Data.Sequence.Ordered as OSeq
import Data.Set (Set) import Data.Set (Set)
import Data.Set as Set import Data.Set as Set
import Data.String as S import Data.String as S
...@@ -100,7 +101,8 @@ sortWith :: forall a b f. Functor f => ...@@ -100,7 +101,8 @@ sortWith :: forall a b f. Functor f =>
Unfoldable f => Unfoldable f =>
Ord b => Ord b =>
(a -> b) -> f a -> f a (a -> b) -> f a -> f a
sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty --sortWith f = map (\(On _ y) -> y) <<< OSeq.toUnfoldable <<< foldr (\x -> OSeq.insert (On (f x) x)) OSeq.empty
sortWith f xs = A.toUnfoldable $ A.sortWith f (A.fromFoldable xs)
href :: Effect String href :: Effect String
......
module Data.Sequence where
import Prelude
import Data.Array as A
import Data.Functor as Functor
import Data.Tuple (Tuple(..))
type Seq = Array
cons = A.cons
length = A.length
concatMap = A.concatMap
drop = A.drop
filter = A.filter
map = Functor.map
take = A.take
fromFoldable = A.fromFoldable
toUnfoldable = A.toUnfoldable
empty = []
head = A.head
null = A.null
snoc = A.snoc
singleton = A.singleton
splitAt idx seq = Tuple s.before s.after
where
s = A.splitAt idx seq
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