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
, session } []
, 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
Popover.popover { arrow: false
......@@ -148,6 +137,20 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
]
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
, nodeType
, refresh: const $ dispatch RefreshTree
......
......@@ -2,7 +2,7 @@ module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where
import Gargantext.Prelude
import Data.Int (fromNumber)
import Data.Int (floor)
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Aff (launchAff_)
......@@ -79,13 +79,12 @@ type ProgressIndicatorProps =
progressIndicator :: Record ProgressIndicatorProps -> R.Element
progressIndicator p = R.createElement progressIndicatorCpt p []
progressIndicatorCpt :: R.Component ProgressIndicatorProps
progressIndicatorCpt = here.component "progressIndicator" cpt
where
cpt { barType, label, progress } _ = do
progress' <- T.useLive T.unequal progress
let progressInt = toInt progress'
let progressInt = floor progress'
case barType of
Bar -> pure $
......@@ -93,7 +92,7 @@ progressIndicatorCpt = here.component "progressIndicator" cpt
[ H.div { className: "progress-bar"
, role: "progressbar"
, style: { width: (show $ progressInt) <> "%" }
} [ H.text label ]
} [ ]
]
Pie -> pure $
H.div { className: "progress-pie" }
......@@ -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 { asyncTask: GT.AsyncTaskWithType { task: GT.AsyncTask {id}
, 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