Dashboard had a trivial state now it is more explicit

parent acdeccb6
module Gargantext.Pages.Corpus.Doc.Facets.Dashboard where module Gargantext.Pages.Corpus.Doc.Facets.Dashboard where
import Prelude import Prelude hiding (div)
import Data.Array (zip) import Data.Array (zip)
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Gargantext.Components.Charts.Options.ECharts import Gargantext.Components.Charts.Options.ECharts
import Gargantext.Components.Charts.Options.Series (Options(..), xAxis, series, YAxisFormat(..), chart)
import Data.Unit (Unit) import Gargantext.Components.Charts.Options.Series (SeriesShape(..))
import Data.Int (toNumber) import Data.Int (toNumber)
import React.DOM (div, h1, text, title) import React.DOM (div, h1, text)
import React.DOM.Props (className) import React.DOM.Props (className)
import Thermite (PerformAction, Render, Spec, simpleSpec) import Thermite (Render, Spec, simpleSpec, defaultPerformAction)
type State = Unit render :: Render {} {} Void
data Action = None
initialState :: State
initialState = unit
performAction :: PerformAction State {} Action
performAction _ _ _ = pure unit
render :: Render State {} Action
render dispatch _ state _ = [ render dispatch _ state _ = [
h1 [] [text "IMT DashBoard"] h1 [] [text "IMT DashBoard"]
, div [className "row"] [ div [className "col-md-9 content"] [chart globalPublis] , div [className "row"] [ div [className "col-md-9 content"] [chart globalPublis]
...@@ -54,9 +44,12 @@ render dispatch _ state _ = [ ...@@ -54,9 +44,12 @@ render dispatch _ state _ = [
----------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------
naturePublis_x :: Array String
naturePublis_x = ["Com","Articles","Thèses","Reports"] naturePublis_x = ["Com","Articles","Thèses","Reports"]
naturePublis_y' :: Array Int
naturePublis_y' = [23901,17417,1188,1176] naturePublis_y' = [23901,17417,1188,1176]
naturePublis_y :: Array {name :: String, value :: Number}
naturePublis_y = map (\(Tuple n v) -> {name: n, value: toNumber v }) (zip naturePublis_x naturePublis_y') naturePublis_y = map (\(Tuple n v) -> {name: n, value: toNumber v }) (zip naturePublis_x naturePublis_y')
naturePublis :: Options naturePublis :: Options
...@@ -72,7 +65,9 @@ naturePublis = Options { mainTitle : "Nature of publications" ...@@ -72,7 +65,9 @@ naturePublis = Options { mainTitle : "Nature of publications"
----------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------
globalPublis_x :: Array Int
globalPublis_x = [1982,1986,1987,1988,1990,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017] globalPublis_x = [1982,1986,1987,1988,1990,1993,1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017]
globalPublis_y :: Array Int
globalPublis_y = [1,4,2,1,1,2,1,1,8,38,234,76,40,82,75,202,1475,1092,1827,2630,4978,3668,4764,5915,4602,5269,6814,4018] globalPublis_y = [1,4,2,1,1,2,1,1,8,38,234,76,40,82,75,202,1475,1092,1827,2630,4978,3668,4764,5915,4602,5269,6814,4018]
...@@ -89,6 +84,7 @@ globalPublis = (Options { mainTitle : "Global Scientific Publications" ...@@ -89,6 +84,7 @@ globalPublis = (Options { mainTitle : "Global Scientific Publications"
distriBySchool_y :: Array (Tuple String Int)
distriBySchool_y = [Tuple "Télécom Bretagne" 1150,Tuple "Télécom SudParis" 946,Tuple "Mines Nantes" 547,Tuple "Télécom ParisTech" 429,Tuple "IMT Atlantique" 205,Tuple "Mines Alès" 56 distriBySchool_y = [Tuple "Télécom Bretagne" 1150,Tuple "Télécom SudParis" 946,Tuple "Mines Nantes" 547,Tuple "Télécom ParisTech" 429,Tuple "IMT Atlantique" 205,Tuple "Mines Alès" 56
,Tuple "Télécom Ecole de Management" 52,Tuple "Mines Albi-Carmaux" 6] ,Tuple "Télécom Ecole de Management" 52,Tuple "Mines Albi-Carmaux" 6]
...@@ -104,5 +100,5 @@ distriBySchool = Options { mainTitle : "School production in 2017" ...@@ -104,5 +100,5 @@ distriBySchool = Options { mainTitle : "School production in 2017"
} }
layoutDashboard :: Spec State {} Action layoutDashboard :: Spec {} {} Void
layoutDashboard = simpleSpec performAction render layoutDashboard = simpleSpec defaultPerformAction render
...@@ -11,7 +11,6 @@ import Gargantext.Components.Login as LN ...@@ -11,7 +11,6 @@ import Gargantext.Components.Login as LN
import Gargantext.Components.Modals.Modal (modalShow) import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus.Doc.Annotation as D import Gargantext.Pages.Corpus.Doc.Annotation as D
import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh
import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV
import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
...@@ -34,7 +33,6 @@ data Action ...@@ -34,7 +33,6 @@ data Action
| DocAnnotationViewA D.Action | DocAnnotationViewA D.Action
| TreeViewA Tree.Action | TreeViewA Tree.Action
| GraphExplorerA GE.Action | GraphExplorerA GE.Action
| DashboardA Dsh.Action
| Search String | Search String
| Go | Go
| ShowLogin | ShowLogin
...@@ -99,7 +97,6 @@ performAction (UserPageA _) _ _ = pure unit ...@@ -99,7 +97,6 @@ performAction (UserPageA _) _ _ = pure unit
performAction (DocAnnotationViewA _) _ _ = pure unit performAction (DocAnnotationViewA _) _ _ = pure unit
performAction (TreeViewA _) _ _ = pure unit performAction (TreeViewA _) _ _ = pure unit
performAction (GraphExplorerA _) _ _ = pure unit performAction (GraphExplorerA _) _ _ = pure unit
performAction (DashboardA _) _ _ = pure unit
performAction (NgramsA _) _ _ = pure unit performAction (NgramsA _) _ _ = pure unit
---------------------------------------------------------- ----------------------------------------------------------
...@@ -134,12 +131,6 @@ _userPageAction = prism UserPageA \action -> ...@@ -134,12 +131,6 @@ _userPageAction = prism UserPageA \action ->
UserPageA caction -> Right caction UserPageA caction -> Right caction
_-> Left action _-> Left action
_dashBoardAction :: Prism' Action Dsh.Action
_dashBoardAction = prism DashboardA \action ->
case action of
DashboardA caction -> Right caction
_ -> Left action
_docAnnotationViewAction :: Prism' Action D.Action _docAnnotationViewAction :: Prism' Action D.Action
_docAnnotationViewAction = prism DocAnnotationViewA \action -> _docAnnotationViewAction = prism DocAnnotationViewA \action ->
case action of case action of
......
...@@ -18,10 +18,10 @@ import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE ...@@ -18,10 +18,10 @@ import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
import Gargantext.Pages.Corpus.User.Users as U import Gargantext.Pages.Corpus.User.Users as U
import Gargantext.Pages.Home as L import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.Actions (Action(..), _NgramsA, _addCorpusAction, _dashBoardAction, _docAnnotationViewAction, _docViewAction, _graphExplorerAction, _loginAction, _searchAction, _treeAction, _userPageAction, performAction) import Gargantext.Pages.Layout.Actions (Action(..), _NgramsA, _addCorpusAction, _docAnnotationViewAction, _docViewAction, _graphExplorerAction, _loginAction, _searchAction, _treeAction, _userPageAction, performAction)
import Gargantext.Pages.Layout.Specs.AddCorpus as AC import Gargantext.Pages.Layout.Specs.AddCorpus as AC
import Gargantext.Pages.Layout.Specs.Search as S import Gargantext.Pages.Layout.Specs.Search as S
import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _dashBoardSate, _docAnnotationViewState, _docViewState, _graphExplorerState, _loginState, _ngramState, _searchState, _treeState, _userPageState) import Gargantext.Pages.Layout.States (AppState, _addCorpusState, _docAnnotationViewState, _docViewState, _graphExplorerState, _loginState, _ngramState, _searchState, _treeState, _userPageState)
import Gargantext.Router (Routes(..)) import Gargantext.Router (Routes(..))
import React (ReactElement) import React (ReactElement)
import React.DOM (a, button, div, footer, hr', img, input, li, p, span, text, ul) import React.DOM (a, button, div, footer, hr', img, input, li, p, span, text, ul)
...@@ -64,7 +64,7 @@ pagesComponent s = ...@@ -64,7 +64,7 @@ pagesComponent s =
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec NGramsTable = layout0 $ focus _ngramState _NgramsA NG.ngramsTableSpec selectSpec NGramsTable = layout0 $ focus _ngramState _NgramsA NG.ngramsTableSpec
selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec Dashboard = layout0 $ focus _dashBoardSate _dashBoardAction Dsh.layoutDashboard selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
-- selectSpec _ = simpleSpec defaultPerformAction defaultRender -- selectSpec _ = simpleSpec defaultPerformAction defaultRender
......
...@@ -7,7 +7,6 @@ import Data.Maybe (Maybe(Just)) ...@@ -7,7 +7,6 @@ import Data.Maybe (Maybe(Just))
import Gargantext.Components.Login as LN import Gargantext.Components.Login as LN
import Gargantext.Components.Tree as Tree import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus.Doc.Annotation as D import Gargantext.Pages.Corpus.Doc.Annotation as D
import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh
import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV
import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
...@@ -31,7 +30,6 @@ type AppState = ...@@ -31,7 +30,6 @@ type AppState =
, graphExplorerState :: GE.State , graphExplorerState :: GE.State
, initialized :: Boolean , initialized :: Boolean
, ngramState :: NG.State , ngramState :: NG.State
, dashboardState :: Dsh.State
} }
initAppState :: AppState initAppState :: AppState
...@@ -50,7 +48,6 @@ initAppState = ...@@ -50,7 +48,6 @@ initAppState =
, graphExplorerState : GE.initialState , graphExplorerState : GE.initialState
, initialized : false , initialized : false
, ngramState : NG.initialState , ngramState : NG.initialState
, dashboardState : Dsh.initialState
} }
--------------------------------------------------------- ---------------------------------------------------------
...@@ -75,9 +72,6 @@ _docAnnotationViewState = lens (\s -> s.docAnnotationState) (\s ss -> s{docAnnot ...@@ -75,9 +72,6 @@ _docAnnotationViewState = lens (\s -> s.docAnnotationState) (\s ss -> s{docAnnot
_treeState :: Lens' AppState Tree.State _treeState :: Lens' AppState Tree.State
_treeState = lens (\s -> s.ntreeState) (\s ss -> s {ntreeState = ss}) _treeState = lens (\s -> s.ntreeState) (\s ss -> s {ntreeState = ss})
_dashBoardSate :: Lens' AppState Dsh.State
_dashBoardSate = lens (\s -> s.dashboardState) (\s ss -> s {dashboardState = ss})
_graphExplorerState :: Lens' AppState GE.State _graphExplorerState :: Lens' AppState GE.State
_graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss}) _graphExplorerState = lens (\s -> s.graphExplorerState) (\s ss -> s{graphExplorerState = ss})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment