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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
67d2f108
Commit
67d2f108
authored
Jan 20, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Tree] async progress bar endpoint
parent
ba5d64c2
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
14 deletions
+23
-14
App.purs
src/Gargantext/Components/App.purs
+1
-1
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+1
-1
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+3
-4
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+1
-1
ProgressBar.purs
src/Gargantext/Components/Forest/Tree/Node/ProgressBar.purs
+17
-7
No files found.
src/Gargantext/Components/App.purs
View file @
67d2f108
...
@@ -44,7 +44,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
...
@@ -44,7 +44,7 @@ appCpt = R.hooksComponent "G.C.App.app" cpt where
cpt _ _ = do
cpt _ _ = do
sessions <- useSessions
sessions <- useSessions
route <- useHashRouter router Home
route <- useHashRouter router Home
showLogin <- R.useState' false
showLogin <- R.useState' false
showCorpus <- R.useState' false
showCorpus <- R.useState' false
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
67d2f108
...
@@ -56,7 +56,7 @@ loadedTreeView reload p = R.createElement el p []
...
@@ -56,7 +56,7 @@ loadedTreeView reload p = R.createElement el p []
where
where
el = R.hooksComponent "LoadedTreeView" cpt
el = R.hooksComponent "LoadedTreeView" cpt
cpt {tree, mCurrentRoute, session, frontends} _ = do
cpt {tree, mCurrentRoute, session, frontends} _ = do
treeState <- R.useState' {tree, asyncTasks: [
AsyncTask {id: "1hello", status: "pending"}
]}
treeState <- R.useState' {tree, asyncTasks: []}
pure $ H.div {className: "tree"}
pure $ H.div {className: "tree"}
[ toHtml reload treeState session frontends mCurrentRoute ]
[ toHtml reload treeState session frontends mCurrentRoute ]
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
67d2f108
module Gargantext.Components.Forest.Tree.Node.Action.Upload where
module Gargantext.Components.Forest.Tree.Node.Action.Upload where
import Prelude (class Show, Unit,
const, discard, map, pure, show, ($), (<>), bind, void
)
import Prelude (class Show, Unit,
bind, const, discard, map, pure, show, void, ($)
)
import Data.Maybe (Maybe(..), fromJust)
import Data.Maybe (Maybe(..), fromJust)
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
...
@@ -12,13 +12,12 @@ import React.SyntheticEvent as E
...
@@ -12,13 +12,12 @@ import React.SyntheticEvent as E
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import URI.Extra.QueryPairs as QP
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import Web.File.FileReader.Aff (readAsText)
import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, postWwwUrlencoded
, postMultipartFormData
)
import Gargantext.Sessions (Session, postWwwUrlencoded)
import Gargantext.Types (class ToQuery,
toQuery, NodeType(..), AsyncTask
(..))
import Gargantext.Types (class ToQuery,
AsyncTask, NodeType
(..))
import Gargantext.Utils (id)
import Gargantext.Utils (id)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
67d2f108
...
@@ -67,7 +67,7 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
...
@@ -67,7 +67,7 @@ nodeMainSpan d p folderOpen session frontends = R.createElement el p []
, popOverIcon showBox popupOpen popupPosition
, popOverIcon showBox popupOpen popupPosition
, mNodePopupView props showBox popupOpen popupPosition
, mNodePopupView props showBox popupOpen popupPosition
, fileTypeView d {id, nodeType} droppedFile isDragOver
, fileTypeView d {id, nodeType} droppedFile isDragOver
, H.div {} (map (\t -> asyncProgressBar {
corpusId: id, asyncTask: t
}) asyncTasks)
, H.div {} (map (\t -> asyncProgressBar {
asyncTask: t, corpusId: id, session
}) asyncTasks)
]
]
where
where
SettingsBox {show: showBox} = settingsBox nodeType
SettingsBox {show: showBox} = settingsBox nodeType
...
...
src/Gargantext/Components/Forest/Tree/Node/ProgressBar.purs
View file @
67d2f108
module Gargantext.Components.Forest.Tree.Node.ProgressBar where
module Gargantext.Components.Forest.Tree.Node.ProgressBar where
import Gargantext.Prelude
import Data.Int (fromNumber)
import Data.Int (fromNumber)
import Data.Maybe (fromJust)
import Data.Maybe (
Maybe(..),
fromJust)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff_)
import Effect.Timer (setTimeout)
import Effect.Timer (setTimeout)
import Math (min)
import Gargantext.Components.Forest.Tree.Node.Action (ID)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (AsyncTask(..), NodeType(..))
import Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
import Prelude ((+), ($), (<>), (<<<), pure, bind, discard, unit, show)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest.Tree.Node.Action (ID)
import Gargantext.Types (AsyncTask(..))
type Props =
type Props =
(
(
asyncTask :: AsyncTask
asyncTask :: AsyncTask
, corpusId :: ID
, corpusId :: ID
, session :: Session
)
)
...
@@ -27,11 +30,13 @@ asyncProgressBar p = R.createElement asyncProgressBarCpt p []
...
@@ -27,11 +30,13 @@ asyncProgressBar p = R.createElement asyncProgressBarCpt p []
asyncProgressBarCpt :: R.Component Props
asyncProgressBarCpt :: R.Component Props
asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
where
where
cpt {asyncTask: (AsyncTask {id}), corpusId} _ = do
cpt
props@
{asyncTask: (AsyncTask {id}), corpusId} _ = do
(progress /\ setProgress) <- R.useState' 0.0
(progress /\ setProgress) <- R.useState' 0.0
R.useEffect' $ do
R.useEffect' $ do
_ <- setTimeout 1000 $ do
_ <- setTimeout 1000 $ do
launchAff_ $ do
queryProgress props
setProgress \p -> min 100.0 (p + 10.0)
setProgress \p -> min 100.0 (p + 10.0)
pure unit
pure unit
...
@@ -46,3 +51,8 @@ asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
...
@@ -46,3 +51,8 @@ asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
toInt :: Number -> Int
toInt :: Number -> Int
toInt n = unsafePartial $ fromJust $ fromNumber n
toInt n = unsafePartial $ fromJust $ fromNumber n
queryProgress :: Record Props -> Aff Unit
queryProgress {asyncTask: AsyncTask {id}, corpusId, session} = get session p
where
p = NodeAPI Corpus (Just corpusId) $ "add/form/async/" <> id <> "/poll"
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