Commit 2a668be5 authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

Merge branch '300-dev-purescript-simple-json' into 311-tree-node-list-upload-file-as-json

parents 5f98197e b7f2c801
Pipeline #1631 canceled with stage
with (import <nixpkgs> {});
let
nodejs-with-packages = with nodePackages; [
bower
yarn
]; in
stdenv.mkDerivation rec {
name = "env";
env = buildEnv {
name = name;
paths = buildInputs;
};
buildInputs = [
nodejs-with-packages
yarn
yarn2nix
];
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
touch $out
'';
}
......@@ -14,6 +14,5 @@
<div id="app" class ="container-fluid"></div>
<div id="portal"></div>
<script src="bundle.js"></script>
<script src='https://visio.gargantext.org/external_api.js'></script> <!-- FIXME to be removed -->
</body>
</html>
let upstream =
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210716/packages.dhall sha256:64d7b5a1921e8458589add8a1499a1c82168e726a87fc4f958b3f8760cca2efe
https://github.com/purescript/package-sets/releases/download/psc-0.14.3-20210716/packages.dhall sha256:1f9af624ddfd5352455b7ac6df714f950d499e7e3c6504f62ff467eebd11042c
let overrides =
{ globals =
......@@ -8,8 +8,8 @@ let overrides =
, version = "v4.1.0"
}
, smolder =
{ dependencies = [
"bifunctors"
{ dependencies =
[ "bifunctors"
, "catenable-lists"
, "free"
, "ordered-collections"
......@@ -17,7 +17,8 @@ let overrides =
, "strings"
, "test-unit"
, "transformers"
, "tuples"]
, "tuples"
]
, repo = "https://github.com/bodil/purescript-smolder"
, version = "v12.3.0"
}
......@@ -81,8 +82,17 @@ let additions =
, repo = "https://github.com/nwolverson/purescript-dom-filereader"
, version = "v5.0.0"
}
, formula =
{ dependencies = [ "effect", "prelude", "reactix", "record", "toestand", "tuples", "typelevel-prelude", "typisch" ]
, formula =
{ dependencies =
[ "effect"
, "prelude"
, "reactix"
, "record"
, "toestand"
, "tuples"
, "typelevel-prelude"
, "typisch"
]
, repo = "https://github.com/poorscript/purescript-formula"
, version = "v0.2.1"
}
......@@ -103,47 +113,53 @@ let additions =
}
, reactix =
{ dependencies =
[ "aff"
, "arrays"
, "dom-simple"
, "effect"
, "ffi-simple"
, "foldable-traversable"
, "functions"
, "maybe"
, "nullable"
, "prelude"
, "psci-support"
, "refs"
, "spec"
, "spec-mocha"
, "strings"
, "tuples"
, "unfoldable"
, "unsafe-coerce"
[ "aff"
, "arrays"
, "dom-simple"
, "effect"
, "ffi-simple"
, "foldable-traversable"
, "functions"
, "maybe"
, "nullable"
, "prelude"
, "psci-support"
, "refs"
, "spec"
, "spec-mocha"
, "strings"
, "tuples"
, "unfoldable"
, "unsafe-coerce"
]
, repo = "https://github.com/poorscript/purescript-reactix"
, version = "v0.4.13"
}
, simple-json-generics =
{ dependencies =
[ "simple-json" ]
{ dependencies = [ "simple-json" ]
, repo = "https://github.com/justinwoo/purescript-simple-json-generics"
, version = "v0.1.0"
}
, toestand =
{ dependencies = [ "effect", "reactix", "prelude", "record", "tuples", "typelevel-prelude", "typisch" ]
, toestand =
{ dependencies =
[ "effect"
, "reactix"
, "prelude"
, "record"
, "tuples"
, "typelevel-prelude"
, "typisch"
]
, repo = "https://github.com/poorscript/purescript-toestand"
, version = "v0.6.2"
}
, typisch =
, typisch =
{ dependencies = [ "prelude" ]
, repo = "https://github.com/poorscript/purescript-typisch"
, version = "v0.2.1"
}
, tuples-native =
{ dependencies =
[ "prelude", "typelevel", "unsafe-coerce" ]
{ dependencies = [ "prelude", "typelevel", "unsafe-coerce" ]
, repo = "https://github.com/poorscript/purescript-tuples-native"
, version = "v2.2.0"
}
......@@ -180,10 +196,11 @@ let additions =
, repo = "https://github.com/alpacaaa/purescript-simplecrypto"
, version = "v1.0.1"
}
, web-url =
{ dependencies = [ "prelude" ]
, repo = "https://github.com/mjepronk/purescript-web-url"
, version = "v1.0.2"
}
}
--let localPackages = {
-- reactix = ../../purescript-reactix/spago.dhall as Location
-- }
in upstream // overrides // additions -- // localPackages
in upstream // overrides // additions
......@@ -15,6 +15,9 @@ let
#!/usr/bin/env bash
set -e
echo "Installing JS Dependencies"
yarn
echo "Compiling"
#build-purs
echo "Bundling"
......
......@@ -91,6 +91,7 @@ to generate this file without the comments in this block.
, "web-file"
, "web-html"
, "web-storage"
, "web-url"
, "web-xhr"
]
, packages = ./packages.dhall
......
module Gargantext.Components.Charts.Options.Data where
import Gargantext.Components.Charts.Options.Font (TextStyle, Icon, ItemStyle)
import Gargantext.Components.Charts.Options.Legend (SelectedMode)
import Gargantext.Types (class Optional)
import Record.Unsafe (unsafeSet)
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Types (class Optional)
import Gargantext.Components.Charts.Options.Font (TextStyle, Icon, ItemStyle)
type DataLegend =
{ name :: String
......@@ -22,11 +23,15 @@ type RequiredData v o =
}
type OptionalData =
( name :: String
, symbolSize :: Number
, itemStyle :: ItemStyle
-- ^ the style setting about single data point(bubble).
, label :: { show :: Boolean }
( name :: String
, symbolSize :: Number
, itemStyle :: ItemStyle
-- ^ the style setting about single data point(bubble).
, label :: { show :: Boolean }
, emphasis :: { itemStyle :: ItemStyle }
, selectedMode :: SelectedMode
, select :: { itemStyle :: ItemStyle }
-- ^ need "selectedMode" to be defined
)
type DataSerie v = RequiredData v OptionalData
......
......@@ -3,3 +3,31 @@
var ReactEcharts = require("echarts-for-react");
exports.eChartsClass = ReactEcharts.default;
/**
* @XXX "echarts-for-react" unsuitable to proper PureScript implementation
* regarding event listeners
* @name listenerFn1
* @param {function} fn
* @returns
*/
exports.listenerFn1 = function(fn) {
return function() {
var args = Array.prototype.slice.call(arguments);
fn(args[0])()
}
};
/**
* @link https://echarts.apache.org/en/api.html#echartsInstance.dispatchAction
* @name dispatchAction
* @param {object} eChartsInstance instanceof ECharts
* @param {object} opts
* @returns
*/
exports.dispatchAction = function(eChartsInstance) {
return function(opts) {
return function() {
eChartsInstance.dispatchAction(opts);
}
}
}
module Gargantext.Components.Charts.Options.ECharts where
import Prelude
import CSS.Common (normal)
import CSS.FontStyle (FontStyle(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (toMaybe)
import Effect (Effect)
import Gargantext.Components.Charts.Options.Color (transparent, violet, black)
import Gargantext.Components.Charts.Options.Data (DataLegend, dataSerie)
import Gargantext.Components.Charts.Options.Font (IconOptions(..), Shape(..), TextStyle, chartFontStyle, chartFontWeight, icon, mkTooltip, Tooltip, mkToolBox)
import Gargantext.Components.Charts.Options.Legend (legendType, LegendMode(..), PlainOrScroll(..), selectedMode, Orientation(..), orient)
import Gargantext.Components.Charts.Options.Position (Align(..), LeftRelativePosition(..), TopRelativePosition(..), numberPosition, percentPosition, relativePosition)
import Gargantext.Components.Charts.Options.Series (Series, seriesPieD1)
import Gargantext.Components.Charts.Options.Type (DataZoom, Echarts, Legend, Option, Title, XAxis, YAxis, xAxis, yAxis)
import Gargantext.Components.Charts.Options.Type (DataZoom, EChartsInstance, Echarts, Legend, MouseEvent, Option, Title, XAxis, YAxis, EChartRef, xAxis, yAxis)
import Gargantext.Utils.Reactix as R2
import Prelude
import React (ReactClass, unsafeCreateElementDynamic)
import Reactix as R
import Gargantext.Utils.Reactix as R2
import Record.Extra as RX
import Unsafe.Coerce (unsafeCoerce)
foreign import eChartsClass :: ReactClass Echarts
foreign import listenerFn1 :: forall evt. (evt -> Effect Unit) -> Effect Unit
-- | @XXX some eCharts "actions" not working ("select", ...)
-- | https://echarts.apache.org/en/api.html#echartsInstance.dispatchAction
foreign import dispatchAction :: forall payload. EChartsInstance -> payload -> Effect Unit
chart :: Options -> R.Element
chart = echarts <<< chartWith <<< opts
chart = echarts <<< chartWith
chartWith :: Option -> Echarts
chartWith option =
{ option
chartWith :: Options -> Echarts
chartWith options =
{ option : opts options
--, className : Nothing
--, style : Nothing
--, theme : Nothing
......@@ -35,8 +42,24 @@ chartWith option =
--, optsLoading: Nothing
--, onReady : Nothing
--, resizable : Nothing
--, onEvents : Nothing
, onEvents : getEvents options
, ref : refListener options
}
where
getEvents (Options { onClick }) =
{ click: listenerFn1 \e -> case onClick of
-- sanitize parsing (see MouseEvent comment)
Just fn -> RX.pick (e :: MouseEvent) # fn
Nothing -> pure unit
}
refListener (Options { onInit }) = case onInit of
Nothing -> pure unit
Just fn -> listenerFn1 (_ # fn # execOnInit)
execOnInit fn = toMaybe >>> case _ of
Nothing -> pure unit
Just (ref :: Record EChartRef) -> pure unit -- fn =<< ref.getEchartsInstance
echarts :: Echarts -> R.Element
echarts c = R2.buff $ unsafeCreateElementDynamic (unsafeCoerce eChartsClass) c []
......@@ -155,6 +178,20 @@ data Options = Options
, series :: Array Series
, addZoom :: Boolean
, tooltip :: Tooltip
, onClick :: Maybe (MouseEvent -> Effect Unit)
-- (?) `onInit` custom listener
--
-- * in addition of the already existing `onReady` native listener
-- which is executed on chart mount, but does not provide any arg
-- * the React library also contained another native listener as
-- `ref`, which adds the React Ref of the mounted chart
-- * this additional `onInit` is executed after the "Apache Echarts"
-- has been "initialised" (see more details [1]),
-- it intends to return the `eChartsInstance` used for every
-- library actions
--
-- [1] https://echarts.apache.org/en/api.html#echarts.init
, onInit :: Maybe (EChartsInstance -> Effect Unit)
}
tooltipTriggerAxis :: Tooltip
......
module Gargantext.Components.Charts.Options.Series where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson, (.:), (~>), (:=))
import Data.Argonaut.Core (jsonEmptyObject)
import Data.Array (foldl)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe)
import Data.Newtype (class Newtype)
import Data.Symbol (SProxy(..))
import Record as Record
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Legend (SelectedMode)
import Gargantext.Prelude
import Gargantext.Types (class Optional)
import Prelude (class Eq, class Show, bind, map, pure, show, ($), (+), (<<<), (<>), eq)
import Record as Record
import Record.Unsafe (unsafeSet)
import Simple.JSON as JSON
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.Prelude
import Gargantext.Types (class Optional)
import Gargantext.Components.Charts.Options.Font (ItemStyle, Tooltip)
import Gargantext.Components.Charts.Options.Data (DataD1, DataD2)
newtype SeriesType = SeriesType String
......@@ -59,13 +64,16 @@ seriesType = SeriesType <<< show
-- | Scatter Dimension 2 data
type OptionalSeries =
( name :: String
, symbolSize :: Number
, itemStyle :: ItemStyle
( name :: String
, symbolSize :: Number
, itemStyle :: ItemStyle
-- ^ Graphic style of, *emphasis* is the style when it is highlighted, like being hovered by mouse, or highlighted via legend connect.
-- https://ecomfe.github.io/echarts-doc/public/en/option.html#series-scatter.itemStyle
, tooltip :: Tooltip
, tooltip :: Tooltip
, emphasis :: { itemStyle :: ItemStyle }
, selectedMode :: SelectedMode
, select :: { itemStyle :: ItemStyle }
-- ^ need "selectedMode" to be defined
-- many more...
)
......@@ -217,5 +225,3 @@ labelP = SProxy :: SProxy "label"
-- | TODO
-- https://ecomfe.github.io/echarts-examples/public/data/asset/data/life-expectancy-table.json
-- https://ecomfe.github.io/echarts-examples/public/editor.html?c=scatter3D-dataset&gl=1
......@@ -2,6 +2,8 @@ module Gargantext.Components.Charts.Options.Type where
import Prelude
import Data.Nullable (Nullable)
import Effect (Effect)
import Gargantext.Components.Charts.Options.Color (Color)
import Gargantext.Components.Charts.Options.Data (DataLegend)
import Gargantext.Components.Charts.Options.Font (TextStyle, Tooltip, ToolBox)
......@@ -12,6 +14,9 @@ import Gargantext.Types (class Optional)
import React as R
import Unsafe.Coerce (unsafeCoerce)
-- | https://echarts.apache.org/en/api.html#echartsInstance
foreign import data EChartsInstance :: Type
newtype ChartAlign = ChartAlign String
-- TODO: Maybe is not working here => use Optional
......@@ -29,7 +34,8 @@ type Echarts =
--, optsLoading :: Maybe OptsLoading -- PropTypes.object,
--, onReady :: Maybe String -- PropTypes.func,
--, resizable :: Maybe Boolean -- PropTypes.bool,
--, onEvents :: Maybe String -- PropTypes.object
, onEvents :: OnEvents -- PropTypes.object
, ref :: Effect Unit
}
type Option =
......@@ -160,3 +166,53 @@ type AxisLabel =
}
type Rich = {}
---
-- | @XXX "echarts-for-react" third party library does not have an event
-- | dictionary
-- | these values had been picked from what we gather in the dist file
-- | "echarts/dist/echarts.common.js" and
-- | https://echarts.apache.org/en/api.html#events
type OnEvents =
{ click :: Effect Unit
-- ...
}
-- | @XXX "echarts-for-react" third party library bases on "apache-echarts"
-- | does not have strongly typed signature, nor determined arity
-- | (actual runtime event contains more key than what their docs describe)
-- |
-- | https://echarts.apache.org/en/api.html#events.Mouse%20events
type MouseEvent =
{ borderColor :: Nullable String
, color :: String
, componentIndex :: Int
, componentSubType :: String
, componentTyp :: String
-- , data :: -- Object
, dataIndex :: Int
, dataType :: Nullable String
-- , dimensionNames :: -- Array
-- , encore :: -- Object
-- , event :: -- instanceof Event
-- , marker :: -- String
, name :: String
, seriesId :: Nullable String
, seriesIndex :: Int
, seriesName :: String
, seriesType :: String
, type :: String
, value :: String -- or Array ??
}
----
-- | @XXX partial definition given by the third library author
-- | POJO containing a mix of ReactElement field and custom method attached
-- |
-- | https://github.com/hustcc/echarts-for-react#component-api--echarts-api
type EChartRef =
( getEchartsInstance :: Effect EChartsInstance
-- ...
)
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.DocsTable where
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import Data.Argonaut (class EncodeJson, jsonEmptyObject, (:=), (~>))
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Lens ((^.))
import Data.Lens.At (at)
import Data.Lens.Record (prop)
import Data.Map as Map
import Data.Maybe (Maybe(..), fromMaybe, isJust, maybe)
import Data.Map as Map
import Data.Newtype (class Newtype)
import Data.Ord.Down (Down(..))
import Data.Set (Set)
import Data.Set as Set
import Data.Set as Set
import Data.String as Str
import Data.Symbol (SProxy(..))
import Data.Tuple (Tuple(..))
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category.Types (Star(..))
import Gargantext.Components.DocsTable.Types
( DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), sampleData )
import Gargantext.Components.Table.Types as TT
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), Year, sampleData)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Routes as Routes
import Gargantext.Prelude
import Gargantext.Prelude (class Ord, Unit, bind, const, discard, identity, mempty, otherwise, pure, show, unit, ($), (/=), (<$>), (<<<), (<>), (==))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Types (ListId, NodeID, NodeType(..), OrderBy(..), SidePanelState(..), TableResult, TabSubType, TabType, showTabType')
import Gargantext.Utils (sortWith)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Prelude
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.DocsTable"
......@@ -72,7 +72,8 @@ type CommonProps =
, tabType :: TabType
-- ^ tabType is not ideal here since it is too much entangled with tabs and
-- ngramtable. Let's see how this evolves. )
, totalRecords :: Int
, totalRecords :: Int
, yearFilter :: T.Box (Maybe Year)
)
type LayoutProps =
......@@ -128,6 +129,7 @@ docViewCpt = here.component "docView" cpt where
, sidePanelState
, tabType
, totalRecords
, yearFilter
}
, params
, query
......@@ -153,6 +155,7 @@ docViewCpt = here.component "docView" cpt where
, sidePanelState
, tabType
, totalRecords
, yearFilter
} [] ] ] ]
type SearchBarProps =
......@@ -209,12 +212,13 @@ mock :: Boolean
mock = false
type PageParams = {
listId :: Int
, mCorpusId :: Maybe Int
, nodeId :: Int
, tabType :: TabType
, query :: Query
, params :: TT.Params
listId :: Int
, mCorpusId :: Maybe Int
, nodeId :: Int
, tabType :: TabType
, query :: Query
, params :: TT.Params
, yearFilter :: Maybe Year
}
getPageHash :: Session -> PageParams -> Aff String
......@@ -249,6 +253,12 @@ filterDocs query docs = A.filter filterFunc docs
filterFunc (Response { hyperdata: Hyperdata { title } }) =
isJust $ Str.indexOf (Str.Pattern $ Str.toLower query) $ Str.toLower title
filterDocsByYear :: Year -> Array Response -> Array Response
filterDocsByYear year docs = A.filter filterFunc docs
where
filterFunc :: Response -> Boolean
filterFunc (Response { hyperdata: Hyperdata { pub_year } }) = eq year $ show pub_year
pageLayout :: R2.Component PageLayoutProps
pageLayout = R.createElement pageLayoutCpt
......@@ -263,19 +273,30 @@ pageLayoutCpt = here.component "pageLayout" cpt where
, query
, session
, sidePanel
, tabType } _ = do
, tabType
, yearFilter
} _ = do
cacheState' <- T.useLive T.unequal cacheState
yearFilter' <- T.useLive T.unequal yearFilter
let path = { listId, mCorpusId, nodeId, params, query, tabType }
let path = { listId, mCorpusId, nodeId, params, query, tabType, yearFilter: yearFilter' }
handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView)
handleResponse (HashedResponse { hash, value: res }) = ret
where
docs = res2corpus <$> filterDocs query res.docs
filters = filterDocs query
>>> \res' -> case yearFilter' of
Nothing -> res'
Just year -> filterDocsByYear year res'
docs = res2corpus <$> filters res.docs
ret = if mock then
--Tuple 0 (take limit $ drop offset sampleData)
Tuple 0 sampleData
else
Tuple res.count docs
case cacheState' of
NT.CacheOn -> do
let paint (Tuple count docs) = page { documents: docs
......@@ -527,9 +548,10 @@ tableRouteWithPage :: forall row.
, params :: TT.Params
, query :: Query
, tabType :: TabType
, yearFilter :: Maybe Year
| row } -> SessionRoute
tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchType }, query, tabType } =
NodeAPI Node (Just nodeId) $ "table" <> joinQueryStrings [tt, lst, lmt, odb, ofs, st, q]
tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchType }, query, tabType, yearFilter } =
NodeAPI Node (Just nodeId) $ "table" <> joinQueryStrings [tt, lst, lmt, odb, ofs, st, q, y]
where
lmt = queryParam "limit" limit
lst = queryParam "list" listId
......@@ -538,6 +560,7 @@ tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchTyp
st = queryParam "searchType" searchType
tt = queryParamS "tabType" (showTabType' tabType)
q = queryParamS "query" query
y = mQueryParam "year" yearFilter
deleteAllDocuments :: Session -> Int -> Aff (Array Int)
deleteAllDocuments session = delete session <<< documentsRoute
......
......@@ -97,6 +97,7 @@ instance JSON.ReadForeign Hyperdata where
type LocalCategories = Map Int Category
type LocalUserScore = Map Int Star
type Query = String
type Year = String
---------------------------------------------------------
sampleData' :: DocumentsView
......
......@@ -54,14 +54,9 @@ graph = R.createElement graphCpt
graphCpt :: forall s fa2. R.Component (Props s fa2)
graphCpt = here.component "graph" cpt where
cpt props@{ elRef
, mCamera
, multiSelectEnabledRef
, selectedNodeIds
, showEdges
, sigmaRef
, stage
, startForceAtlas
, transformedGraph } _ = do
, stage } _ = do
showEdges' <- T.useLive T.unequal showEdges
stage' <- T.useLive T.unequal stage
......@@ -83,8 +78,16 @@ graphCpt = here.component "graph" cpt where
Nothing -> RH.div {} []
Just el -> R.createPortal [] el
stageHooks props@{ elRef, mCamera, multiSelectEnabledRef, selectedNodeIds, forceAtlas2Settings: fa2, graph: graph'
, sigmaRef, stage, stage': Init, startForceAtlas } = do
stageHooks { elRef
, mCamera
, multiSelectEnabledRef
, selectedNodeIds
, forceAtlas2Settings: fa2
, graph: graph'
, sigmaRef
, stage
, stage': Init
, startForceAtlas } = do
R.useEffectOnce' $ do
let rSigma = R.readRef sigmaRef
......@@ -126,7 +129,7 @@ graphCpt = here.component "graph" cpt where
Sigma.updateCamera sig { ratio, x, y }
pure unit
Just sig -> do
Just _sig -> do
pure unit
T.write Ready stage
......@@ -145,7 +148,9 @@ graphCpt = here.component "graph" cpt where
Sigmax.performDiff sigma transformedGraph
Sigmax.updateEdges sigma tEdgesMap
Sigmax.updateNodes sigma tNodesMap
Sigmax.setEdges sigma (not $ SigmaxTypes.edgeStateHidden showEdges')
let edgesState = not $ SigmaxTypes.edgeStateHidden showEdges'
here.log2 "[graphCpt] edgesState" edgesState
Sigmax.setEdges sigma edgesState
stageHooks _ = pure unit
......@@ -300,13 +305,15 @@ sigmaSettings =
, zoomMin : 0.0
, zoomingRatio : 1.4
}
type ForceAtlas2Settings =
( adjustSizes :: Boolean
, barnesHutOptimize :: Boolean
-- , barnesHutTheta :: Number
, batchEdgesDrawing :: Boolean
, edgeWeightInfluence :: Number
-- , fixedY :: Boolean
, hideEdgesOnMove :: Boolean