Commit 49f4a99a authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[progress] fix async progress bar

Previously the calculation was wrong and returned 0 mostly. Now it
should be fixed.
parent 37a4d4d1
...@@ -125,17 +125,6 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -125,17 +125,6 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, session } [] , session } []
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } [] , fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType } []
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, errors
, nodeId: id
, onFinish: onTaskFinish id t
, session } []
) currentTasks'
)
, if nodeType == GT.NodeUser
then GV.versionView { session } []
else H.div {} []
, if showBox then , if showBox then
Popover.popover { arrow: false Popover.popover { arrow: false
...@@ -148,6 +137,20 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt ...@@ -148,6 +137,20 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
] ]
else H.div {} [] else H.div {} []
, H.div { style: { width: "8em" } }
(map (\t -> asyncProgressBar { asyncTask: t
--, barType: Pie
, barType: Bar
, errors
, nodeId: id
, onFinish: onTaskFinish id t
, session } []
) currentTasks'
)
, if nodeType == GT.NodeUser
then GV.versionView { session } []
else H.div {} []
, nodeActions { id , nodeActions { id
, nodeType , nodeType
, refresh: const $ dispatch RefreshTree , refresh: const $ dispatch RefreshTree
......
...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where ...@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where
import Gargantext.Prelude import Gargantext.Prelude
import Data.Int (fromNumber) import Data.Int (floor)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import Effect (Effect) import Effect (Effect)
import Effect.Aff (launchAff_) import Effect.Aff (launchAff_)
...@@ -79,13 +79,12 @@ type ProgressIndicatorProps = ...@@ -79,13 +79,12 @@ type ProgressIndicatorProps =
progressIndicator :: Record ProgressIndicatorProps -> R.Element progressIndicator :: Record ProgressIndicatorProps -> R.Element
progressIndicator p = R.createElement progressIndicatorCpt p [] progressIndicator p = R.createElement progressIndicatorCpt p []
progressIndicatorCpt :: R.Component ProgressIndicatorProps progressIndicatorCpt :: R.Component ProgressIndicatorProps
progressIndicatorCpt = here.component "progressIndicator" cpt progressIndicatorCpt = here.component "progressIndicator" cpt
where where
cpt { barType, label, progress } _ = do cpt { barType, label, progress } _ = do
progress' <- T.useLive T.unequal progress progress' <- T.useLive T.unequal progress
let progressInt = toInt progress' let progressInt = floor progress'
case barType of case barType of
Bar -> pure $ Bar -> pure $
...@@ -93,7 +92,7 @@ progressIndicatorCpt = here.component "progressIndicator" cpt ...@@ -93,7 +92,7 @@ progressIndicatorCpt = here.component "progressIndicator" cpt
[ H.div { className: "progress-bar" [ H.div { className: "progress-bar"
, role: "progressbar" , role: "progressbar"
, style: { width: (show $ progressInt) <> "%" } , style: { width: (show $ progressInt) <> "%" }
} [ H.text label ] } [ ]
] ]
Pie -> pure $ Pie -> pure $
H.div { className: "progress-pie" } H.div { className: "progress-pie" }
...@@ -103,11 +102,6 @@ progressIndicatorCpt = here.component "progressIndicator" cpt ...@@ -103,11 +102,6 @@ progressIndicatorCpt = here.component "progressIndicator" cpt
] ]
] ]
toInt :: Number -> Int
toInt n = case fromNumber n of
Nothing -> 0
Just x -> x
queryProgress :: Record Props -> AffRESTError GT.AsyncProgress queryProgress :: Record Props -> AffRESTError GT.AsyncProgress
queryProgress { asyncTask: GT.AsyncTaskWithType { task: GT.AsyncTask {id} queryProgress { asyncTask: GT.AsyncTaskWithType { task: GT.AsyncTask {id}
, typ , typ
......
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