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
16364b1e
Commit
16364b1e
authored
Jun 19, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[list] list charts refresh properly
parent
e00d9477
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
36 additions
and
33 deletions
+36
-33
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+6
-4
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+8
-5
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+5
-4
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+6
-5
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+6
-4
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+2
-0
Utils.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
+0
-3
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+0
-5
Ends.purs
src/Gargantext/Ends.purs
+1
-1
Types.purs
src/Gargantext/Types.purs
+2
-2
No files found.
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
16364b1e
module Gargantext.Components.Nodes.Corpus.Chart.Common where
module Gargantext.Components.Nodes.Corpus.Chart.Common where
import Data.Tuple (fst, Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Components.Nodes.Corpus.Chart.Types
(Path, Props, MetricsProps)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
type MetricsLoadViewProps a = (
type MetricsLoadViewProps a = (
getMetrics :: Session ->
Record Path
-> Aff a
getMetrics :: Session ->
Tuple Reload (Record Path)
-> Aff a
, loaded :: Session -> Record Path -> R.State
Int
-> a -> R.Element
, loaded :: Session -> Record Path -> R.State
Reload
-> a -> R.Element
| MetricsProps
| MetricsProps
)
)
...
@@ -22,5 +24,5 @@ metricsLoadViewCpt :: forall a. R.Component (MetricsLoadViewProps a)
...
@@ -22,5 +24,5 @@ metricsLoadViewCpt :: forall a. R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = R.hooksComponent "G.C.N.C.C.metricsLoadView" cpt
metricsLoadViewCpt = R.hooksComponent "G.C.N.C.C.metricsLoadView" cpt
where
where
cpt {getMetrics, loaded, path, reload, session} _ = do
cpt {getMetrics, loaded, path, reload, session} _ = do
useLoader
path
(getMetrics session) $ \l ->
useLoader
(fst reload /\ path)
(getMetrics session) $ \l ->
loaded session path reload l
loaded session path reload l
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
16364b1e
module Gargantext.Components.Nodes.Corpus.Chart.Histo where
module Gargantext.Components.Nodes.Corpus.Chart.Histo where
import Prelude (bind, map, pure, ($))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Prelude
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Charts.Options.Color (grey)
import Gargantext.Components.Charts.Options.Color (grey)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
(Path, Props)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -49,8 +52,8 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
...
@@ -49,8 +52,8 @@ chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
, series : [seriesBarD1 {name: "Number of publication / year"} $
, series : [seriesBarD1 {name: "Number of publication / year"} $
map (\n -> dataSerie {value: n, itemStyle : itemStyle {color:grey}}) count'] }
map (\n -> dataSerie {value: n, itemStyle : itemStyle {color:grey}}) count'] }
getMetrics :: Session ->
Record Path
-> Aff HistoMetrics
getMetrics :: Session ->
Tuple Reload (Record Path)
-> Aff HistoMetrics
getMetrics session
{corpusId, limit, listId, tabType}
= do
getMetrics session
(_ /\ { corpusId, limit, listId, tabType })
= do
ChartMetrics ms <- get session chart
ChartMetrics ms <- get session chart
pure ms."data"
pure ms."data"
where
where
...
@@ -66,7 +69,7 @@ histoCpt = R.hooksComponent "G.C.N.C.C.H.histo" cpt
...
@@ -66,7 +69,7 @@ histoCpt = R.hooksComponent "G.C.N.C.C.H.histo" cpt
reload <- R.useState' 0
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: Session -> Record Path -> R.State
Int
-> HistoMetrics -> R.Element
loaded :: Session -> Record Path -> R.State
Reload
-> HistoMetrics -> R.Element
loaded session path reload loaded =
loaded session path reload loaded =
H.div {} [
H.div {} [
U.reloadButton reload
U.reloadButton reload
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
16364b1e
...
@@ -6,6 +6,7 @@ import Data.Map as Map
...
@@ -6,6 +6,7 @@ import Data.Map as Map
import Data.Map (Map)
import Data.Map (Map)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -17,7 +18,7 @@ import Gargantext.Components.Charts.Options.Color (green, grey, red)
...
@@ -17,7 +18,7 @@ import Gargantext.Components.Charts.Options.Color (green, grey, red)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
(Path, Props)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -85,8 +86,8 @@ scatterOptions metrics' = Options
...
@@ -85,8 +86,8 @@ scatterOptions metrics' = Options
}
}
--}
--}
getMetrics :: Session ->
Record Path
-> Aff Loaded
getMetrics :: Session ->
Tuple Reload (Record Path)
-> Aff Loaded
getMetrics session
{corpusId, limit, listId, tabType}
= do
getMetrics session
(_ /\ { corpusId, limit, listId, tabType })
= do
Metrics ms <- get session metrics'
Metrics ms <- get session metrics'
pure ms."data"
pure ms."data"
where
where
...
@@ -102,7 +103,7 @@ metricsCpt = R.hooksComponent "G.C.N.C.C.M.metrics" cpt
...
@@ -102,7 +103,7 @@ metricsCpt = R.hooksComponent "G.C.N.C.C.M.metrics" cpt
reload <- R.useState' 0
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: Session -> Record Path -> R.State
Int
-> Loaded -> R.Element
loaded :: Session -> Record Path -> R.State
Reload
-> Loaded -> R.Element
loaded session path reload loaded =
loaded session path reload loaded =
H.div {} [
H.div {} [
U.reloadButton reload
U.reloadButton reload
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
16364b1e
...
@@ -7,6 +7,7 @@ import Data.Array as A
...
@@ -7,6 +7,7 @@ import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -17,7 +18,7 @@ import Gargantext.Components.Charts.Options.Color (blue)
...
@@ -17,7 +18,7 @@ import Gargantext.Components.Charts.Options.Color (blue)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
(Path, Props)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -71,8 +72,8 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
...
@@ -71,8 +72,8 @@ chartOptionsPie (HistoMetrics { dates: dates', count: count'}) = Options
}
}
getMetrics :: Session ->
Record Path
-> Aff HistoMetrics
getMetrics :: Session ->
Tuple Reload (Record Path)
-> Aff HistoMetrics
getMetrics session
{corpusId, limit, listId, tabType}
= do
getMetrics session
(_ /\ { corpusId, limit, listId, tabType })
= do
ChartMetrics ms <- get session chart
ChartMetrics ms <- get session chart
pure ms."data"
pure ms."data"
where chart = Chart {chartType: ChartPie, limit, listId, tabType} (Just corpusId)
where chart = Chart {chartType: ChartPie, limit, listId, tabType} (Just corpusId)
...
@@ -87,7 +88,7 @@ pieCpt = R.hooksComponent "G.C.N.C.C.P.pie" cpt
...
@@ -87,7 +88,7 @@ pieCpt = R.hooksComponent "G.C.N.C.C.P.pie" cpt
reload <- R.useState' 0
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded: loadedPie, path, reload, session}
pure $ metricsLoadView {getMetrics, loaded: loadedPie, path, reload, session}
loadedPie :: Session -> Record Path -> R.State
Int
-> HistoMetrics -> R.Element
loadedPie :: Session -> Record Path -> R.State
Reload
-> HistoMetrics -> R.Element
loadedPie session path reload loaded =
loadedPie session path reload loaded =
H.div {} [
H.div {} [
U.reloadButton reload
U.reloadButton reload
...
@@ -106,7 +107,7 @@ barCpt = R.hooksComponent "LoadedMetricsBar" cpt
...
@@ -106,7 +107,7 @@ barCpt = R.hooksComponent "LoadedMetricsBar" cpt
reload <- R.useState' 0
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded: loadedBar, path, reload, session}
pure $ metricsLoadView {getMetrics, loaded: loadedBar, path, reload, session}
loadedBar :: Session -> Record Path -> R.State
Int
-> Loaded -> R.Element
loadedBar :: Session -> Record Path -> R.State
Reload
-> Loaded -> R.Element
loadedBar session path reload loaded =
loadedBar session path reload loaded =
H.div {} [
H.div {} [
U.reloadButton reload
U.reloadButton reload
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
16364b1e
...
@@ -2,6 +2,8 @@ module Gargantext.Components.Nodes.Corpus.Chart.Tree where
...
@@ -2,6 +2,8 @@ module Gargantext.Components.Nodes.Corpus.Chart.Tree where
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Argonaut (class DecodeJson, decodeJson, (.:))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -13,7 +15,7 @@ import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
...
@@ -13,7 +15,7 @@ import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Utils as U
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
(Path, Props)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..), TabType)
import Gargantext.Types (ChartType(..), TabType)
...
@@ -44,8 +46,8 @@ scatterOptions nodes = Options
...
@@ -44,8 +46,8 @@ scatterOptions nodes = Options
}
}
getMetrics :: Session ->
Record Path
-> Aff Loaded
getMetrics :: Session ->
Tuple Reload (Record Path)
-> Aff Loaded
getMetrics session
{corpusId, limit, listId, tabType}
= do
getMetrics session
(_ /\ { corpusId, limit, listId, tabType })
= do
Metrics ms <- get session chart
Metrics ms <- get session chart
pure ms."data"
pure ms."data"
where
where
...
@@ -61,7 +63,7 @@ treeCpt = R.hooksComponent "G.C.N.C.C.T.tree" cpt
...
@@ -61,7 +63,7 @@ treeCpt = R.hooksComponent "G.C.N.C.C.T.tree" cpt
reload <- R.useState' 0
reload <- R.useState' 0
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
pure $ metricsLoadView {getMetrics, loaded, path, reload, session}
loaded :: Session -> Record Path -> R.State
Int
-> Loaded -> R.Element
loaded :: Session -> Record Path -> R.State
Reload
-> Loaded -> R.Element
loaded session path reload loaded =
loaded session path reload loaded =
H.div {} [
H.div {} [
U.reloadButton reload
U.reloadButton reload
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
16364b1e
...
@@ -6,6 +6,8 @@ import Reactix as R
...
@@ -6,6 +6,8 @@ import Reactix as R
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (TabType)
import Gargantext.Types (TabType)
type Reload = Int
type Path = (
type Path = (
corpusId :: Int
corpusId :: Int
, limit :: Maybe Int
, limit :: Maybe Int
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Utils.purs
View file @
16364b1e
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.Utils where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Corpus.Chart.Utils where
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -47,8 +46,6 @@ chartUpdateButtonCpt = R.hooksComponent "G.C.N.C.C.U.chartUpdateButton" cpt
...
@@ -47,8 +46,6 @@ chartUpdateButtonCpt = R.hooksComponent "G.C.N.C.C.U.chartUpdateButton" cpt
cpt { chartType
cpt { chartType
, path: { corpusId, listId, tabType }
, path: { corpusId, listId, tabType }
, reload: (_ /\ setReload), session } _ = do
, reload: (_ /\ setReload), session } _ = do
R.useEffect' $ do
log2 "[chartUpdateButton] tabType" tabType
pure $ H.a { className: "chart-update-button fa fa-database"
pure $ H.a { className: "chart-update-button fa fa-database"
, on: { click: onClick }
, on: { click: onClick }
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
16364b1e
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Lists.Tabs where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Nodes.Lists.Tabs where
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -52,10 +51,6 @@ ngramsViewCpt = R.hooksComponent "G.C.N.L.T.ngramsView" cpt
...
@@ -52,10 +51,6 @@ ngramsViewCpt = R.hooksComponent "G.C.N.L.T.ngramsView" cpt
, corpusId
, corpusId
, mode
, mode
, session } _ = do
, session } _ = do
R.useEffect' $ do
log2 "[ngramsViewCpt] corpusId" corpusId
log2 "[ngramsViewCpt] defaultListId" defaultListId
chartType <- R.useState' Histo
chartType <- R.useState' Histo
pure $ R.fragment
pure $ R.fragment
...
...
src/Gargantext/Ends.purs
View file @
16364b1e
...
@@ -179,7 +179,7 @@ sessionPath (R.Search {listId, limit, offset, orderBy} (Just corpusId)) =
...
@@ -179,7 +179,7 @@ sessionPath (R.Search {listId, limit, offset, orderBy} (Just corpusId)) =
-- <> offsetUrl offset
-- <> offsetUrl offset
-- <> limitUrl limit
-- <> limitUrl limit
-- <> orderUrl orderBy
-- <> orderUrl orderBy
sessionPath (R.CorpusMetrics {
tabType, listId, limit
} i) =
sessionPath (R.CorpusMetrics {
listId, limit, tabType
} i) =
sessionPath $ R.NodeAPI Corpus i
sessionPath $ R.NodeAPI Corpus i
$ "metrics"
$ "metrics"
<> "?ngrams=" <> show listId
<> "?ngrams=" <> show listId
...
...
src/Gargantext/Types.purs
View file @
16364b1e
...
@@ -329,8 +329,8 @@ type CorpusMetricOpts =
...
@@ -329,8 +329,8 @@ type CorpusMetricOpts =
type ChartOpts =
type ChartOpts =
{ chartType :: ChartType
{ chartType :: ChartType
, listId :: ListId
, listId
:: ListId
, limit :: Maybe Limit
, limit
:: Maybe Limit
, tabType :: TabType
, tabType :: TabType
}
}
...
...
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