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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
d8f3c5da
Commit
d8f3c5da
authored
Apr 02, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph] trigger recomputation
parent
6d3b1fc8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
18 deletions
+52
-18
API.purs
src/Gargantext/Components/GraphExplorer/API.purs
+26
-1
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+26
-17
No files found.
src/Gargantext/Components/GraphExplorer/API.purs
View file @
d8f3c5da
...
...
@@ -9,7 +9,7 @@ import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session,
get,
post)
import Gargantext.Types as GT
type GraphAsyncUpdateParams =
...
...
@@ -33,3 +33,28 @@ graphAsyncUpdate {graphId, listId, nodes, session, termList, version} = do
, termList
, version
}
type GraphAsyncRecomputeParams =
(
graphId :: Int
, session :: Session
)
graphAsyncRecompute :: Record GraphAsyncRecomputeParams -> Aff GT.AsyncTaskWithType
graphAsyncRecompute { graphId, session } = do
task <- post session p q
pure $ GT.AsyncTaskWithType { task, typ: GT.GraphT }
where
p = GR.GraphAPI graphId $ GT.asyncTaskTypePath GT.GraphT
q = {}
type QueryProgressParams =
(
graphId :: Int
, session :: Session
, taskId :: String
)
queryProgress :: Record QueryProgressParams -> Aff GT.AsyncProgress
queryProgress { graphId, session, taskId } = do
get session $ GR.GraphAPI graphId $ "async/" <> taskId <> "/poll"
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
d8f3c5da
...
...
@@ -17,6 +17,7 @@ import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Timer (setInterval)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as RH
...
...
@@ -32,7 +33,7 @@ import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Types
(NodeType(..))
as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
type Props =
...
...
@@ -130,7 +131,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
onClickRemove rType props nodesMap e = do
let nodes = mapMaybe (\id -> Map.lookup id nodesMap) $ Set.toUnfoldable $ fst props.selectedNodeIds
deleteNodes rType props.session props.metaData props.graphId
props.graphVersion
nodes
deleteNodes rType props.session props.metaData props.graphId nodes
snd props.removedNodeIds $ const $ fst props.selectedNodeIds
snd props.selectedNodeIds $ const SigmaxT.emptyNodeIds
...
...
@@ -155,22 +156,30 @@ neighbourBadges graph (selectedNodeIds /\ _) = SigmaxT.neighbours graph selected
where
selectedNodes = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
deleteNodes :: TermList -> Session -> GET.MetaData -> Int -> R.State Int -> Array (Record SigmaxT.Node) -> Effect Unit
deleteNodes termList session (GET.MetaData metaData) graphId _ nodes = do
launchAff_ do
task <- GAPI.graphAsyncUpdate { graphId, listId, nodes, termList, session, version }
liftEffect $ log2 "task" task
where
listId = metaData.list.listId
version = metaData.list.version
deleteNodes :: TermList -> Session -> GET.MetaData -> Int -> Array (Record SigmaxT.Node) -> Effect Unit
deleteNodes termList session metaData graphId nodes = do
-- launchAff_ do
-- 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
-- task <- GAPI.graphAsyncUpdate { graphId, listId, nodes, termList, session, version }
-- liftEffect $ log2 "task" task
-- where
-- listId = metaData.list.listId
-- version = metaData.list.version
launchAff_ do
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) -> do
task <- GAPI.graphAsyncRecompute { graphId, session }
_ <- liftEffect $ setInterval 1000 $ launchAff_ $ do
let (GT.AsyncTaskWithType { task: GT.AsyncTask { id } }) = task
asyncProgress@(GT.AsyncProgress {status}) <- GAPI.queryProgress { graphId, session, taskId: id }
liftEffect $ log2 "progress" asyncProgress
pure unit
--pure unit
--liftEffect do
--setGraphVersion $ const $ patch.version
deleteNode :: TermList -> Session -> GET.MetaData -> Record SigmaxT.Node -> Aff NTC.VersionedNgramsPatches
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