Commit d8c7b234 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'dev-merge' into dev

parents f85f6ac1 012c7a58
...@@ -50,6 +50,7 @@ import Gargantext.Utils.CacheAPI as GUC ...@@ -50,6 +50,7 @@ import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS) import Gargantext.Utils.QueryString (joinQueryStrings, mQueryParam, mQueryParamS, queryParam, queryParamS)
import Gargantext.Utils.Reactix as R2 import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as GUT import Gargantext.Utils.Toestand as GUT
import Gargantext.Utils.Toestand as T2
import Reactix as R import Reactix as R
import Reactix.DOM.HTML as H import Reactix.DOM.HTML as H
import Simple.JSON as JSON import Simple.JSON as JSON
...@@ -149,6 +150,13 @@ docViewCpt = here.component "docView" cpt where ...@@ -149,6 +150,13 @@ docViewCpt = here.component "docView" cpt where
toggleModal <- pure $ const $ toggleModal <- pure $ const $
T.modify_ not isDocumentModalVisibleBox T.modify_ not isDocumentModalVisibleBox
-- @onCreateDocumentEnd <AsyncProgress>
onCreateDocumentEnd <- pure $ \asyncProgress -> do
here.log2 "[DocsTables] NodeDocument task:" asyncProgress
T.write_ false onDocumentCreationPendingBox
toggleModal unit
T2.reload boxes.reloadMainPage
-- @createDocumentCallback -- @createDocumentCallback
createDocumentCallback <- pure $ \fdata -> launchAff_ do createDocumentCallback <- pure $ \fdata -> launchAff_ do
...@@ -158,7 +166,12 @@ docViewCpt = here.component "docView" cpt where ...@@ -158,7 +166,12 @@ docViewCpt = here.component "docView" cpt where
eTask <- DFC.create session nodeId fdata eTask <- DFC.create session nodeId fdata
handleRESTError boxes.errors eTask handleRESTError boxes.errors eTask
\t -> liftEffect $ launchDocumentCreationProgress boxes session nodeId t \t -> liftEffect $ launchDocumentCreationProgress
boxes
session
nodeId
t
onCreateDocumentEnd
-- Render -- Render
pure $ pure $
...@@ -221,18 +234,20 @@ launchDocumentCreationProgress :: ...@@ -221,18 +234,20 @@ launchDocumentCreationProgress ::
-> Session -> Session
-> GT.ID -> GT.ID
-> GT.AsyncTaskWithType -> GT.AsyncTaskWithType
-> (GT.AsyncProgress -> Effect Unit)
-> Effect Unit -> Effect Unit
launchDocumentCreationProgress boxes session nodeId currentTask launchDocumentCreationProgress boxes session nodeId currentTask cbk
= void $ setTimeout 1000 $ = void $ setTimeout 1000 $ launchAff_ $
launchAff_ $ scanDocumentCreationProgress boxes session nodeId currentTask scanDocumentCreationProgress boxes session nodeId currentTask cbk
scanDocumentCreationProgress :: scanDocumentCreationProgress ::
Boxes Boxes
-> Session -> Session
-> GT.ID -> GT.ID
-> GT.AsyncTaskWithType -> GT.AsyncTaskWithType
-> (GT.AsyncProgress -> Effect Unit)
-> Aff Unit -> Aff Unit
scanDocumentCreationProgress boxes session nodeId currentTask = do scanDocumentCreationProgress boxes session nodeId currentTask cbk = do
eTask <- DFC.createProgress session nodeId currentTask eTask <- DFC.createProgress session nodeId currentTask
...@@ -249,10 +264,9 @@ scanDocumentCreationProgress boxes session nodeId currentTask = do ...@@ -249,10 +264,9 @@ scanDocumentCreationProgress boxes session nodeId currentTask = do
if (hasEndingStatus status) if (hasEndingStatus status)
then then
here.log2 "[DocsTables] NodeDocument task:" asyncProgress cbk asyncProgress
-- @WIP: close modal, reload docs table
else else
launchDocumentCreationProgress boxes session nodeId currentTask launchDocumentCreationProgress boxes session nodeId currentTask cbk
--------------------------------------------------- ---------------------------------------------------
......
...@@ -284,4 +284,4 @@ createProgress ...@@ -284,4 +284,4 @@ createProgress
request = GR.NodeAPI GT.Node (Just nodeId) request = GR.NodeAPI GT.Node (Just nodeId)
(GT.asyncTaskTypePath GT.NodeDocument <> pollParams) (GT.asyncTaskTypePath GT.NodeDocument <> pollParams)
pollParams = id <> "/poll?limit1" pollParams = "/" <> id <> "/poll?limit1"
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