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
1eae92d9
Commit
1eae92d9
authored
Feb 04, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Dashboard] chart selection works now
parent
d0a94fc1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+9
-13
No files found.
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
1eae92d9
module Gargantext.Components.Nodes.Corpus.Dashboard where
module Gargantext.Components.Nodes.Corpus.Dashboard where
import Data.Array as A
import Data.Array as A
import Data.String.Common as DSC
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (fst)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -33,12 +32,7 @@ dashboardLayoutCpt :: R.Component Props
...
@@ -33,12 +32,7 @@ dashboardLayoutCpt :: R.Component Props
dashboardLayoutCpt = R.hooksComponent "G.P.C.D.dashboardLayout" cpt
dashboardLayoutCpt = R.hooksComponent "G.P.C.D.dashboardLayout" cpt
where
where
cpt params@{nodeId, session} _ = do
cpt params@{nodeId, session} _ = do
predefinedCharts <- R.useState' [
predefinedCharts <- R.useState' []
-- P.CDocsHistogram
-- , P.CAuthorsPie
-- , P.CTermsMetrics
-- , P.CInstitutesTree
]
useLoader params loadCorpusWithChild $
useLoader params loadCorpusWithChild $
\corpusData@{corpusId, defaultListId, corpusNode: NodePoly poly} -> do
\corpusData@{corpusId, defaultListId, corpusNode: NodePoly poly} -> do
let { name, date, hyperdata : Hyperdata h} = poly
let { name, date, hyperdata : Hyperdata h} = poly
...
@@ -67,16 +61,18 @@ dashboardLayoutLoadedCpt = R.hooksComponent "G.C.N.C.D.dashboardLayoutLoaded" cp
...
@@ -67,16 +61,18 @@ dashboardLayoutLoadedCpt = R.hooksComponent "G.C.N.C.D.dashboardLayoutLoaded" cp
where
where
addNew = H.div { className: "row" } [
addNew = H.div { className: "row" } [
H.span { className: "btn btn-default"
H.span { className: "btn btn-default"
, on: { click: onClick }} [ H.span { className: "fa fa-plus" } [] ]
, on: { click: onClick
Add
}} [ H.span { className: "fa fa-plus" } [] ]
]
]
where
where
onClick _ = setPredefinedCharts $ A.cons P.CDocsHistogram
onClick
Add
_ = setPredefinedCharts $ A.cons P.CDocsHistogram
charts = A.mapWithIndex chartIdx predefinedCharts
charts = A.mapWithIndex chartIdx predefinedCharts
chartIdx idx chart =
chartIdx idx chart =
renderChart { chart, corpusId, defaultListId, onChange, onRemove, session }
renderChart { chart, corpusId, defaultListId, onChange, onRemove, session }
where
where
onChange c = setPredefinedCharts $
onChange c = do
\cs -> fromMaybe cs (A.modifyAt idx (\_ -> c) cs)
log2 "[dashboardLayout] idx" idx
log2 "[dashboardLayout] new chart" c
setPredefinedCharts $ \cs -> fromMaybe cs (A.modifyAt idx (\_ -> c) cs)
onRemove _ = setPredefinedCharts $
onRemove _ = setPredefinedCharts $
\cs -> fromMaybe cs $ A.deleteAt idx cs
\cs -> fromMaybe cs $ A.deleteAt idx cs
...
@@ -112,7 +108,7 @@ renderChartCpt = R.hooksComponent "G.C.N.C.D.renderChart" cpt
...
@@ -112,7 +108,7 @@ renderChartCpt = R.hooksComponent "G.C.N.C.D.renderChart" cpt
where
where
option pc =
option pc =
H.option { value: show pc } [ H.text $ show pc ]
H.option { value: show pc } [ H.text $ show pc ]
onSelectChange e = onChange $ P.readChart' e
onSelectChange e = onChange $ P.readChart'
valu
e
where
where
value = R2.unsafeEventValue e
value = R2.unsafeEventValue e
onRemoveClick _ = onRemove unit
onRemoveClick _ = onRemove unit
...
...
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