Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
148
Issues
148
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
13320baf
Commit
13320baf
authored
Jan 22, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Sidebar] node group ngrams work -- doesn't compile yet
parent
33bb55e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+31
-8
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
13320baf
...
@@ -5,7 +5,7 @@ module Gargantext.Components.GraphExplorer.Sidebar
...
@@ -5,7 +5,7 @@ module Gargantext.Components.GraphExplorer.Sidebar
import Prelude
import Prelude
import Control.Parallel (parTraverse)
import Control.Parallel (parTraverse)
import Data.Array (
head, last
)
import Data.Array (
last, uncons
)
import Data.Int (fromString)
import Data.Int (fromString)
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe(..), fromJust)
...
@@ -143,14 +143,37 @@ neighbourBadges graph (selectedNodeIds /\ _) = SigmaxT.neighbours graph selected
...
@@ -143,14 +143,37 @@ neighbourBadges graph (selectedNodeIds /\ _) = SigmaxT.neighbours graph selected
selectedNodes = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
selectedNodes = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
deleteNodes :: TermList -> Session -> GET.MetaData -> R.State Int -> Array (Record SigmaxT.Node) -> Effect Unit
deleteNodes :: TermList -> Session -> GET.MetaData -> R.State Int -> Array (Record SigmaxT.Node) -> Effect Unit
deleteNodes termList session
metaData
(_ /\ setGraphVersion) nodes = do
deleteNodes termList session
(GET.MetaData metaData)
(_ /\ setGraphVersion) nodes = do
launchAff_ do
launchAff_ do
patches <- (parTraverse (deleteNode termList session metaData) nodes) :: Aff (Array NTC.VersionedNgramsPatches)
patch <- NTC.putNgramsPatches coreParams versioned
let mPatch = last patches
where
case mPatch of
patches :: NTC.NgramsPatches
Nothing -> pure unit
patches = ngramsPatches termList nodes
Just (NTC.Versioned patch) -> pure unit --liftEffect do
versioned :: NTC.VersionedNgramsPatches
--setGraphVersion $ const $ patch.version
versioned = NTC.Versioned {version: metaData.list.version, data: patches}
-- patches <- (parTraverse (deleteNode termList session metaData) nodes) :: Aff (Array NTC.VersionedNgramsPatches)
-- let mPatch = last patches
-- case mPatch of
-- Nothing -> pure unit
-- Just (NTC.Versioned patch) -> pure unit --liftEffect do
-- --setGraphVersion $ const $ patch.version
ngramsPatches :: TermList -> Array (Record SigmaxT.Node) -> NTC.NgramsPatches
ngramsPatches termList nodes =
case uncons nodes of
Nothing -> mempty
Just {head: node, tail} -> np <> (ngramsPatches termList tail)
where
np :: NTC.NgramsPatches
np = NTC.singletonPatchMap term $ NTC.NgramsPatch { patch_children: mempty, patch_list }
term :: NTC.NgramsTerm
term = NTC.normNgram tabNgramType node.label
tabNgramType :: CTabNgramType
tabNgramType = modeTabType node.gargType
patch_list :: NTC.Replace TermList
patch_list = NTC.Replace { new: termList, old: GraphTerm }
deleteNode :: TermList -> Session -> GET.MetaData -> Record SigmaxT.Node -> Aff NTC.VersionedNgramsPatches
deleteNode :: TermList -> Session -> GET.MetaData -> Record SigmaxT.Node -> Aff NTC.VersionedNgramsPatches
deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches coreParams versioned
deleteNode termList session (GET.MetaData metaData) node = NTC.putNgramsPatches coreParams versioned
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment