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
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Grégoire Locqueville
purescript-gargantext
Commits
67d2f108
Commit
67d2f108
authored
4 years ago
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
cpt _ _ = do
sessions <- useSessions
route <- useHashRouter router Home
showLogin <- R.useState' false
showCorpus <- R.useState' false
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree.purs
View file @
67d2f108
...
...
@@ -56,7 +56,7 @@ loadedTreeView reload p = R.createElement el p []
where
el = R.hooksComponent "LoadedTreeView" cpt
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"}
[ toHtml reload treeState session frontends mCurrentRoute ]
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
67d2f108
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.Newtype (class Newtype)
import Data.Tuple (Tuple(..))
...
...
@@ -12,13 +12,12 @@ import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import Web.File.FileReader.Aff (readAsText)
import Gargantext.Components.Forest.Tree.Node.Action
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, postWwwUrlencoded
, postMultipartFormData
)
import Gargantext.Types (class ToQuery,
toQuery, NodeType(..), AsyncTask
(..))
import Gargantext.Sessions (Session, postWwwUrlencoded)
import Gargantext.Types (class ToQuery,
AsyncTask, NodeType
(..))
import Gargantext.Utils (id)
import Gargantext.Utils.Reactix as R2
...
...
This diff is collapsed.
Click to expand it.
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 []
, popOverIcon showBox popupOpen popupPosition
, mNodePopupView props showBox popupOpen popupPosition
, 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
SettingsBox {show: showBox} = settingsBox nodeType
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node/ProgressBar.purs
View file @
67d2f108
module Gargantext.Components.Forest.Tree.Node.ProgressBar where
import Gargantext.Prelude
import Data.Int (fromNumber)
import Data.Maybe (fromJust)
import Data.Maybe (
Maybe(..),
fromJust)
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff, launchAff_)
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 Prelude ((+), ($), (<>), (<<<), pure, bind, discard, unit, show)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest.Tree.Node.Action (ID)
import Gargantext.Types (AsyncTask(..))
type Props =
(
asyncTask :: AsyncTask
, corpusId :: ID
, session :: Session
)
...
...
@@ -27,11 +30,13 @@ asyncProgressBar p = R.createElement asyncProgressBarCpt p []
asyncProgressBarCpt :: R.Component Props
asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
where
cpt {asyncTask: (AsyncTask {id}), corpusId} _ = do
cpt
props@
{asyncTask: (AsyncTask {id}), corpusId} _ = do
(progress /\ setProgress) <- R.useState' 0.0
R.useEffect' $ do
_ <- setTimeout 1000 $ do
launchAff_ $ do
queryProgress props
setProgress \p -> min 100.0 (p + 10.0)
pure unit
...
...
@@ -46,3 +51,8 @@ asyncProgressBarCpt = R.hooksComponent "G.C.F.T.N.asyncProgressBar" cpt
toInt :: Number -> Int
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"
This diff is collapsed.
Click to expand it.
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