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
bc3b4ada
Commit
bc3b4ada
authored
Jun 12, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[list] chart update button
parent
ddd234e0
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
66 additions
and
20 deletions
+66
-20
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+2
-2
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+8
-2
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+3
-2
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+6
-4
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+6
-5
Utils.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
+36
-3
Ends.purs
src/Gargantext/Ends.purs
+2
-0
Routes.purs
src/Gargantext/Routes.purs
+2
-1
Types.purs
src/Gargantext/Types.purs
+1
-1
No files found.
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
bc3b4ada
...
...
@@ -11,7 +11,7 @@ import Gargantext.Sessions (Session)
type MetricsLoadViewProps a = (
getMetrics :: Session -> Record Path -> Aff a
, loaded :: R.State Int -> a -> R.Element
, loaded ::
Session -> Record Path ->
R.State Int -> a -> R.Element
| MetricsProps
)
...
...
@@ -23,4 +23,4 @@ metricsLoadViewCpt = R.hooksComponent "G.C.N.C.C.metricsLoadView" cpt
where
cpt {getMetrics, loaded, path, reload, session} _ = do
useLoader path (getMetrics session) $ \l ->
loaded reload l
loaded
session path
reload l
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
bc3b4ada
...
...
@@ -5,6 +5,7 @@ import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
...
...
@@ -65,5 +66,10 @@ histoCpt = R.hooksComponent "G.C.N.C.C.H.histo" cpt
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: R.State Int -> HistoMetrics -> R.Element
loaded setReload loaded = U.reloadButtonWrap setReload $ chart $ chartOptions loaded
loaded :: Session -> Record Path -> R.State Int -> HistoMetrics -> R.Element
loaded session path reload loaded =
H.div {} [
U.reloadButton reload
, U.chartUpdateButton { chartType: Histo, path, reload, session }
, chart $ chartOptions loaded
]
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
bc3b4ada
...
...
@@ -101,5 +101,6 @@ metricsCpt = R.hooksComponent "G.C.N.C.C.M.metrics" cpt
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: R.State Int -> Loaded -> R.Element
loaded setReload loaded = U.reloadButtonWrap setReload $ chart $ scatterOptions loaded
loaded :: Session -> Record Path -> R.State Int -> Loaded -> R.Element
loaded _session _path setReload loaded =
U.reloadButtonWrap setReload $ chart $ scatterOptions loaded
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
bc3b4ada
...
...
@@ -86,8 +86,9 @@ pieCpt = R.hooksComponent "G.C.N.C.C.P.pie" cpt
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded: loadedPie, path, reload, session}
loadedPie :: R.State Int -> HistoMetrics -> R.Element
loadedPie setReload loaded = U.reloadButtonWrap setReload $ chart $ chartOptionsPie loaded
loadedPie :: Session -> Record Path -> R.State Int -> HistoMetrics -> R.Element
loadedPie _session _path setReload loaded =
U.reloadButtonWrap setReload $ chart $ chartOptionsPie loaded
bar :: Record Props -> R.Element
...
...
@@ -100,5 +101,6 @@ barCpt = R.hooksComponent "LoadedMetricsBar" cpt
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded: loadedBar, path, reload, session}
loadedBar :: R.State Int -> Loaded -> R.Element
loadedBar setReload loaded = U.reloadButtonWrap setReload $ chart $ chartOptionsBar loaded
loadedBar :: Session -> Record Path -> R.State Int -> Loaded -> R.Element
loadedBar _session _path setReload loaded =
U.reloadButtonWrap setReload $ chart $ chartOptionsBar loaded
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
bc3b4ada
...
...
@@ -61,8 +61,9 @@ treeCpt = R.hooksComponent "G.C.N.C.C.T.tree" cpt
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: R.State Int -> Loaded -> R.Element
loaded setReload loaded =
H.div {}
[ U.reloadButton setReload
, chart (scatterOptions loaded) ]
loaded :: Session -> Record Path -> R.State Int -> Loaded -> R.Element
loaded _session _path reload loaded =
H.div {} [
U.reloadButton reload
, chart (scatterOptions loaded)
]
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
View file @
bc3b4ada
module Gargantext.Components.Nodes.Corpus.Chart.Utils where
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect.Uncurried (mkEffectFn1)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Nodes.Corpus.Chart.Types (Path)
import Gargantext.Sessions (Session)
import Gargantext.Types as T
reloadButtonWrap :: R.State Int -> R.Element -> R.Element
reloadButtonWrap setReload el = H.div {} [
...
...
@@ -14,7 +19,35 @@ reloadButtonWrap setReload el = H.div {} [
]
reloadButton :: R.State Int -> R.Element
reloadButton (_ /\ setReload) = H.a {className, onClick, title: "Reload"} []
reloadButton (_ /\ setReload) = H.a { className
, on: { click: onClick }
, title: "Reload" } []
where
className = "reload-btn glyphicon glyphicon-refresh"
onClick = mkEffectFn1 $ \_ -> setReload $ \r -> r + 1
className = "reload-btn fa fa-refresh"
onClick _ = setReload $ (_ + 1)
type ChartUpdateButtonProps = (
chartType :: T.ChartType
, path :: Record Path
, reload :: R.State Int
, session :: Session
)
chartUpdateButton :: Record ChartUpdateButtonProps -> R.Element
chartUpdateButton p = R.createElement chartUpdateButtonCpt p []
chartUpdateButtonCpt :: R.Component ChartUpdateButtonProps
chartUpdateButtonCpt = R.hooksComponent "G.C.N.C.C.U.chartUpdateButton" cpt
where
cpt { path: { chartType, corpusId, listId, tabType }, reload: (_ /\ setReload), session } _ = do
R.useEffect' $ do
log2 "[chartUpdateButton] tabType" tabType
pure $ H.a { className: "chart-update-button fa fa-database"
, on: { click: onClick }
, title: "Update chart data" } []
where
onClick :: forall a. a -> Effect Unit
onClick _ = do
setReload $ (_ + 1)
src/Gargantext/Ends.purs
View file @
bc3b4ada
...
...
@@ -118,6 +118,8 @@ sessionPath (R.Tab t i) = sessionPath (R.NodeAPI Node i (showTabType
sessionPath (R.Children n o l s i) = sessionPath (R.NodeAPI Node i ("children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s))
sessionPath (R.NodeAPI Phylo pId p) = "phyloscape?nodeId=" <> (show $ fromMaybe 0 pId) <> p
sessionPath (R.RecomputeNgrams nt nId lId) = "node/" <> (show nId) <> "/ngrams/recompute?list=" <> (show lId) <> "&ngramsType=" <> (show nt)
sessionPath (R.RecomputeListChart Histo nId lId) = "node/" <> (show nId) <> "/chart?list=" <> (show lId)
sessionPath (R.RecomputeListChart _ nId lId) = "node/" <> (show nId) <> "/recompute-chart?list=" <> (show lId)
sessionPath (R.GraphAPI gId p) = "graph/" <> (show gId) <> "/" <> p
sessionPath (R.GetNgrams opts i) =
base opts.tabType
...
...
src/Gargantext/Routes.purs
View file @
bc3b4ada
...
...
@@ -3,7 +3,7 @@ module Gargantext.Routes where
import Prelude
import Data.Maybe (Maybe)
import Gargantext.Types (ChartOpts, CorpusMetricOpts, CTabNgramType, Id, Limit, ListId, NgramsGetOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList, NgramsGetTableAllOpts)
import Gargantext.Types (ChartOpts, C
hartType, C
orpusMetricOpts, CTabNgramType, Id, Limit, ListId, NgramsGetOpts, NodeType, Offset, OrderBy, SearchOpts, SessionId, TabSubType, TabType, TermList, NgramsGetTableAllOpts)
data AppRoute
= Home
...
...
@@ -37,6 +37,7 @@ data SessionRoute
| PutNgrams TabType (Maybe ListId) (Maybe TermList) (Maybe Id)
-- ^ This name is not good. In particular this URL is used both in PUT and POST.
| RecomputeNgrams (TabSubType CTabNgramType) Id ListId
| RecomputeListChart ChartType Id ListId
| NodeAPI NodeType (Maybe Id) String
| GraphAPI Id String
| ListsRoute ListId
...
...
src/Gargantext/Types.purs
View file @
bc3b4ada
module Gargantext.Types where
m
session path reload = H.div {} []
odule Gargantext.Types where
import Prelude
...
...
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