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
155
Issues
155
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
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
6bdd340f
Commit
6bdd340f
authored
Jun 29, 2021
by
arturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
>>> continue
parent
4d153669
Pipeline
#1562
failed with stage
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
64 deletions
+71
-64
Chart.purs
src/Gargantext/Components/Nodes/Corpus/Chart.purs
+6
-6
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+4
-4
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+17
-20
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+2
-1
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+4
-2
Predefined.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
+14
-11
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+2
-1
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+4
-1
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+1
-0
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+15
-17
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+2
-1
No files found.
src/Gargantext/Components/Nodes/Corpus/Chart.purs
View file @
6bdd340f
...
...
@@ -9,9 +9,9 @@ import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Types (Props)
import Gargantext.Types (ChartType(..))
--
getChartFunction :: ChartType -> (Record Props -> R.Element)
--
getChartFunction Histo = histo
--
getChartFunction ChartBar = bar
--
getChartFunction ChartPie = pie
--
getChartFunction Scatter = metrics
--
getChartFunction ChartTree = tree
getChartFunction :: ChartType -> (Record Props -> R.Element)
getChartFunction Histo = histo
getChartFunction ChartBar = bar
getChartFunction ChartPie = pie
getChartFunction Scatter = metrics
getChartFunction ChartTree = tree
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
6bdd340f
...
...
@@ -34,11 +34,11 @@ metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = here.component "metricsLoadView" cpt
where
cpt { getMetrics, loaded, path, reload, session } _ = do
cpt { getMetrics, loaded, path, reload, session
, onClick
} _ = do
reload' <- T.useLive T.unequal reload
useLoader (reload' /\ path) (getMetrics session) $ \l ->
loaded { path, reload, session } l
loaded { path, reload, session
, onClick
} l
type MetricsWithCacheLoadViewProps res ret = (
getMetricsHash :: Session -> ReloadPath -> Aff Hash
...
...
@@ -58,11 +58,11 @@ metricsWithCacheLoadViewCpt :: forall res ret.
R.Component (MetricsWithCacheLoadViewProps res ret)
metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
where
cpt { getMetricsHash, handleResponse, loaded, mkRequest, path, reload, session } _ = do
cpt { getMetricsHash, handleResponse, loaded, mkRequest, path, reload, session
, onClick
} _ = do
reload' <- T.useLive T.unequal reload
useLoaderWithCacheAPI { cacheEndpoint: (getMetricsHash session)
, handleResponse
, mkRequest
, path: (reload' /\ path)
, renderer: loaded { path, reload, session } }
, renderer: loaded { path, reload, session
, onClick
} }
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
6bdd340f
...
...
@@ -7,6 +7,12 @@ import Data.Generic.Rep.Eq (genericEq)
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==))
import Gargantext.Components.Charts.Options.Color (grey)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
...
...
@@ -14,18 +20,13 @@ import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, template
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Types (CorpusFilters)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Histo"
...
...
@@ -60,8 +61,8 @@ instance encodeHistoMetrics :: EncodeJson HistoMetrics where
type Loaded = HistoMetrics
chartOptions ::
Record CorpusFilters ->
HistoMetrics -> Options
chartOptions
corpusFilters
(HistoMetrics { dates: dates', count: count'}) = Options
chartOptions :: HistoMetrics -> Options
chartOptions (HistoMetrics { dates: dates', count: count'}) = Options
{ mainTitle : "Histogram"
, subTitle : "Distribution of publications over time"
, xAxis : xAxis' dates'
...
...
@@ -70,7 +71,7 @@ chartOptions corpusFilters (HistoMetrics { dates: dates', count: count'}) = Opti
, tooltip : mkTooltip { formatter: templateFormatter "{b0}" }
, series : [seriesBarD1 {name: "Number of publication / year"} $
map (\n -> dataSerie {value: n, itemStyle : itemStyle {color:grey}}) count']
, onClick :
Just \event -> T.write_ (Just event.name) corpusFilters.year
, onClick :
Nothing
}
getMetricsHash :: Session -> ReloadPath -> Aff String
...
...
@@ -90,35 +91,31 @@ handleResponse (HashedResponse { value: ChartMetrics ms }) = ms."data"
mkRequest :: Session -> ReloadPath -> GUC.Request
mkRequest session (_ /\ path@{ corpusId, limit, listId, tabType }) = GUC.makeGetRequest session $ chartUrl path
type HistoProps =
( corpusFilters :: Record CorpusFilters
| Props
)
histo :: Record HistoProps -> R.Element
histo :: Record Props -> R.Element
histo props = R.createElement histoCpt props []
histoCpt :: R.Component
Histo
Props
histoCpt :: R.Component Props
histoCpt = here.component "histo" cpt
where
cpt { path, session,
corpusFilters
} _ = do
cpt { path, session,
onClick
} _ = do
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
getMetricsHash
, handleResponse
, loaded
: loaded corpusFilters
, loaded
, mkRequest: mkRequest session
, path
, reload
, session
, onClick
}
loaded :: Record
CorpusFilters -> Record
MetricsProps -> HistoMetrics -> R.Element
loaded
corpusFilters
{ path, reload, session } l =
loaded :: Record MetricsProps -> HistoMetrics -> R.Element
loaded { path, reload, session } l =
H.div {} [
{- U.reloadButton reload
, U.chartUpdateButton { chartType: Histo, path, reload, session }
, -} chart $ chartOptions
corpusFilters
l
, -} chart $ chartOptions l
]
-- TODO: parametrize ngramsType above
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
6bdd340f
...
...
@@ -127,7 +127,7 @@ metrics props = R.createElement metricsCpt props []
metricsCpt :: R.Component Props
metricsCpt = here.component "etrics" cpt
where
cpt {path, session} _ = do
cpt {path, session
, onClick
} _ = do
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
...
...
@@ -138,6 +138,7 @@ metricsCpt = here.component "etrics" cpt
, path
, reload
, session
, onClick
}
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
6bdd340f
...
...
@@ -116,7 +116,7 @@ pie props = R.createElement pieCpt props []
pieCpt :: R.Component Props
pieCpt = here.component "pie" cpt
where
cpt { path, session } _ = do
cpt { path, session
, onClick
} _ = do
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
...
...
@@ -127,6 +127,7 @@ pieCpt = here.component "pie" cpt
, path
, reload
, session
, onClick
}
loadedPie :: Record MetricsProps -> HistoMetrics -> R.Element
...
...
@@ -144,7 +145,7 @@ bar props = R.createElement barCpt props []
barCpt :: R.Component Props
barCpt = here.component "bar" cpt
where
cpt {path, session} _ = do
cpt {path, session
, onClick
} _ = do
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
...
...
@@ -155,6 +156,7 @@ barCpt = here.component "bar" cpt
, path
, reload
, session
, onClick
}
loadedBar :: Record MetricsProps -> Loaded -> R.Element
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
View file @
6bdd340f
module Gargantext.Components.Nodes.Corpus.Chart.Predefined where
import Gargantext.Prelude
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, encodeJson)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Ord (genericCompare)
import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), fromMaybe)
import Reactix as R
import Gargantext.Prelude
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Effect (Effect)
import Gargantext.Components.Charts.Options.Type (MouseEvent)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie
(pie)
import Gargantext.Components.Nodes.Corpus.Chart.Tree
(tree)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Sessions (Session)
import Gargantext.Types (NodeID, Mode(..), TabSubType(..), TabType(..), modeTabType)
import Reactix as R
data PredefinedChart =
...
...
@@ -66,38 +68,39 @@ type Params =
-- optinal params
, limit :: Maybe Int
, listId :: Maybe Int
, onClick :: Maybe (MouseEvent -> Effect Unit)
)
render :: PredefinedChart -> Record Params -> R.Element
render CDocsHistogram { corpusId, listId, session
} = histo { path, session
}
render CDocsHistogram { corpusId, listId, session
, onClick } = histo { path, session, onClick
}
where
path = { corpusId
, listId: fromMaybe 0 listId
, limit: Nothing
, tabType: TabCorpus TabDocs
}
render CAuthorsPie { corpusId, listId, session
} = pie { path, session
}
render CAuthorsPie { corpusId, listId, session
, onClick } = pie { path, session, onClick
}
where
path = { corpusId
, listId: fromMaybe 0 listId
, limit: Nothing
, tabType: TabCorpus (TabNgramType $ modeTabType Authors)
}
render CInstitutesTree { corpusId, limit, listId, session
} = tree { path, session
}
render CInstitutesTree { corpusId, limit, listId, session
, onClick } = tree { path, session, onClick
}
where
path = { corpusId
, limit
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Institutes)
}
render CTermsMetrics { corpusId, limit, listId, session
} = metrics { path, session
}
render CTermsMetrics { corpusId, limit, listId, session
, onClick } = metrics { path, session, onClick
}
where
path = { corpusId
, limit
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Terms)
}
render CSourcesBar { corpusId, limit, listId, session
} = metrics { path, session
}
render CSourcesBar { corpusId, limit, listId, session
, onClick } = metrics { path, session, onClick
}
where
path = { corpusId
, limit
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
6bdd340f
...
...
@@ -80,7 +80,7 @@ tree props = R.createElement treeCpt props []
treeCpt :: R.Component Props
treeCpt = here.component "tree" cpt
where
cpt {path, session} _ = do
cpt {path, session
, onClick
} _ = do
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
...
...
@@ -91,6 +91,7 @@ treeCpt = here.component "tree" cpt
, path
, reload
, session
, onClick
}
loaded :: Record MetricsProps -> Loaded -> R.Element
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
6bdd340f
...
...
@@ -2,7 +2,9 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Effect (Effect)
import Gargantext.Components.Charts.Options.Type (MouseEvent)
import Gargantext.Prelude (Unit)
import Gargantext.Sessions (Session)
import Gargantext.Types (TabType)
import Gargantext.Utils.Toestand as T2
...
...
@@ -17,6 +19,7 @@ type Path = (
type Props = (
path :: Record Path
, session :: Session
, onClick :: Maybe (MouseEvent -> Effect Unit)
)
type MetricsProps = (
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
6bdd340f
...
...
@@ -240,6 +240,7 @@ renderChartCpt = here.component "renderChart" cpt
, limit: Just 1000
, listId: Just defaultListId
, session
, onClick: Nothing
}
-- aSchool school = H.div {className: "col-md-4 content"} [ chart $ focus school ]
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
6bdd340f
module Gargantext.Components.Nodes.Lists.Tabs where
import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Gargantext.Components.Nodes.Lists.Types
import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Record.Extra as RX
import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie
(pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.
Lists.Types
import Gargantext.Components.Nodes.
Corpus.Types (CorpusData)
import Gargantext.Components.Search as S
import Gargantext.Components.Tab as Tab
import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Gargantext.Sessions (Session)
import Gargantext.Types
( ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), modeTabType )
import Gargantext.Types (ChartType(..), CTabNgramType(..), Mode(..), TabSubType(..), TabType(..), modeTabType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Record.Extra as RX
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists.Tabs"
...
...
@@ -163,7 +161,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
]
charts params _ = [ chart params mode ]
chart path Authors = pie { path, session }
chart path Institutes = tree { path, session }
chart path Sources = bar { path, session }
chart path Terms = metrics { path, session }
chart path Authors = pie { path, session
, onClick: Nothing
}
chart path Institutes = tree { path, session
, onClick: Nothing
}
chart path Sources = bar { path, session
, onClick: Nothing
}
chart path Terms = metrics { path, session
, onClick: Nothing
}
src/Gargantext/Components/Nodes/Texts.purs
View file @
6bdd340f
...
...
@@ -153,6 +153,7 @@ tabsCpt = here.component "tabs" cpt
where
cpt { cacheState, corpusId, corpusData, frontends, session, sidePanel, sidePanelState, corpusFilters } _ = do
let path = initialPath
let onClick = Just \{ name } -> T.write_ (Just name) (corpusFilters.year)
activeTab <- T.useBox 0
...
...
@@ -160,7 +161,7 @@ tabsCpt = here.component "tabs" cpt
activeTab
, tabs: [
"Documents" /\ R.fragment [
histo { path, session,
corpusFilters
}
histo { path, session,
onClick
}
, docView' path TabDocs
]
, "Trash" /\ docView' path TabTrash
...
...
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