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
d9b969f6
Commit
d9b969f6
authored
Dec 16, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tasks] specify whether app/tree reload is needed for async tasks
parent
995eae73
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
AsyncTasks.purs
src/Gargantext/AsyncTasks.purs
+9
-3
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-1
Types.purs
src/Gargantext/Types.purs
+9
-1
No files found.
src/Gargantext/AsyncTasks.purs
View file @
d9b969f6
...
@@ -55,7 +55,6 @@ type ReductorProps = (
...
@@ -55,7 +55,6 @@ type ReductorProps = (
type Reductor = R2.Reductor (Record ReductorProps) Action
type Reductor = R2.Reductor (Record ReductorProps) Action
type ReductorAction = Action -> Effect Unit
type ReductorAction = Action -> Effect Unit
type OnFinish = Effect Unit
useTasks :: GT.ReloadS -> GT.ReloadS -> R.Hooks Reductor
useTasks :: GT.ReloadS -> GT.ReloadS -> R.Hooks Reductor
useTasks appReload treeReload = R2.useReductor act initializer unit
useTasks appReload treeReload = R2.useReductor act initializer unit
...
@@ -78,7 +77,14 @@ action p@{ treeReload, storage } (Insert nodeId t) = do
...
@@ -78,7 +77,14 @@ action p@{ treeReload, storage } (Insert nodeId t) = do
pure $ p { storage = newStorage }
pure $ p { storage = newStorage }
action p (Finish nodeId t) = do
action p (Finish nodeId t) = do
action p (Remove nodeId t)
action p (Remove nodeId t)
action p@{ appReload, storage } (Remove nodeId t) = do
action p@{ appReload, treeReload, storage } (Remove nodeId t@(GT.AsyncTaskWithType { typ })) = do
_ <- snd appReload $ (_ + 1)
_ <- if GT.asyncTaskTriggersAppReload typ then
snd appReload $ (_ + 1)
else
pure unit
_ <- if GT.asyncTaskTriggersTreeReload typ then
snd treeReload $ (_ + 1)
else
pure unit
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
let newStorage = Map.alter (maybe Nothing $ (\ts -> Just $ removeTaskFromList ts t)) nodeId storage
pure $ p { storage = newStorage }
pure $ p { storage = newStorage }
src/Gargantext/Components/Forest/Tree.purs
View file @
d9b969f6
...
@@ -126,7 +126,9 @@ treeLoadView = R.createElement elCpt
...
@@ -126,7 +126,9 @@ treeLoadView = R.createElement elCpt
-- , tasks: tasksStruct root asyncTasks reload
-- , tasks: tasksStruct root asyncTasks reload
, tree: loaded
, tree: loaded
} []
} []
useLoader { root, counter: fst reload } fetch paint
useLoader { appCounter: fst appReload
, counter: fst reload
, root } fetch paint
--------------
--------------
getNodeTree :: Session -> GT.ID -> Aff FTree
getNodeTree :: Session -> GT.ID -> Aff FTree
...
...
src/Gargantext/Types.purs
View file @
d9b969f6
...
@@ -595,7 +595,7 @@ modeFromString _ = Nothing
...
@@ -595,7 +595,7 @@ modeFromString _ = Nothing
-- corresponds to /add/form/async or /add/query/async
-- corresponds to /add/form/async or /add/query/async
data AsyncTaskType = AddNode
data AsyncTaskType = AddNode
| Form
| Form
-- this is file upload too
| GraphRecompute
| GraphRecompute
| Query
| Query
| UpdateNgramsCharts
| UpdateNgramsCharts
...
@@ -631,6 +631,14 @@ asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
...
@@ -631,6 +631,14 @@ asyncTaskTypePath UpdateNgramsCharts = "ngrams/async/charts/update/"
asyncTaskTypePath UpdateNode = "update/"
asyncTaskTypePath UpdateNode = "update/"
asyncTaskTypePath UploadFile = "async/file/add/"
asyncTaskTypePath UploadFile = "async/file/add/"
asyncTaskTriggersAppReload :: AsyncTaskType -> Boolean
asyncTaskTriggersAppReload _ = true
asyncTaskTriggersTreeReload :: AsyncTaskType -> Boolean
asyncTaskTriggersTreeReload Form = true
asyncTaskTriggersTreeReload UploadFile = true
asyncTaskTriggersTreeReload _ = false
type AsyncTaskID = String
type AsyncTaskID = String
...
...
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