Commit 9ec488cd authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-tree-reload' of...

Merge branch 'dev-tree-reload' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev-merge
parents 1f400667 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 }
...@@ -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
......
...@@ -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
......
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