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
0b6ad414
Commit
0b6ad414
authored
Jul 18, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FACTO] renaming states records name.
parent
e4b362e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
67 deletions
+62
-67
Actions.purs
src/Gargantext/Pages/Layout/Actions.purs
+11
-13
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+19
-16
States.purs
src/Gargantext/Pages/Layout/States.purs
+32
-38
No files found.
src/Gargantext/Pages/Layout/Actions.purs
View file @
0b6ad414
...
@@ -8,26 +8,24 @@ import Control.Monad.Eff.Console (CONSOLE, log)
...
@@ -8,26 +8,24 @@ import Control.Monad.Eff.Console (CONSOLE, log)
import DOM (DOM)
import DOM (DOM)
import Data.Array (length)
import Data.Array (length)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Lens (
Lens', Prism', lens
, prism)
import Data.Lens (
Prism'
, prism)
import Gargantext.Pages.Corpus.Doc.Annotation as D
import Gargantext.Pages.Corpus.Doc.Body as CA
import Gargantext.Pages.Corpus.Doc.Document as DV
import Gargantext.Components.Login as LN
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.Facets.Dashboard as Dsh
import Gargantext.Pages.Corpus as AC
import Gargantext.Pages.Corpus as AC
import Gargantext.Router (Routes(..))
import Gargantext.Pages.Corpus.Doc.Annotation as D
import Gargantext.Pages.Corpus.User.Users as U
import Gargantext.Pages.Corpus.Doc.Body as CA
import Gargantext.Pages.Corpus.Doc.Document as DV
import Gargantext.Pages.Corpus.Doc.Facets as TV
import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh
import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE
import Gargantext.Pages.Corpus.Doc.Facets.Graph as GE
import Gargantext.Pages.Home as L
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
import Gargantext.Pages.Search as S
import Gargantext.Pages.Corpus.User.Users as U
import Gargantext.Pages.Corpus.Doc.Facets as TV
import Gargantext.Pages.Home as L
import Gargantext.Pages.Layout.States (AppState)
import Gargantext.Pages.Layout.States (AppState)
import Gargantext.Pages.Corpus.Doc.Document as DV
import Gargantext.Pages.Search as S
import Gargantext.Router (Routes)
import Network.HTTP.Affjax (AJAX)
import Network.HTTP.Affjax (AJAX)
import Thermite (PerformAction, modifyState)
import Thermite (PerformAction, modifyState)
...
@@ -97,7 +95,7 @@ performAction Initialize _ state = void do
...
@@ -97,7 +95,7 @@ performAction Initialize _ state = void do
modifyState id
modifyState id
Right docs -> do
Right docs -> do
modifyState $ _ { initialized = true
modifyState $ _ { initialized = true
, ntree
View
= if length d > 0
, ntree
State
= if length d > 0
then Tree.exampleTree
then Tree.exampleTree
--then fnTransform $ unsafePartial $ fromJust $ head d
--then fnTransform $ unsafePartial $ fromJust $ head d
else Tree.initialState
else Tree.initialState
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
0b6ad414
...
@@ -21,7 +21,7 @@ import Gargantext.Pages.Layout.States ( _addCorpusState
...
@@ -21,7 +21,7 @@ import Gargantext.Pages.Layout.States ( _addCorpusState
, _graphExplorerState
, _graphExplorerState
, _landingState
, _landingState
, _loginState
, _loginState
,
_ng
State
,
_ngram
State
, _searchState
, _searchState
, _tabviewState
, _tabviewState
, _treeState
, _treeState
...
@@ -64,6 +64,22 @@ import React.DOM.Props (_data, _id, _type, aria, className, href, onChange, onCl
...
@@ -64,6 +64,22 @@ import React.DOM.Props (_data, _id, _type, aria, className, href, onChange, onCl
import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, focus, simpleSpec, withState)
import Thermite (Render, Spec, _render, defaultPerformAction, defaultRender, focus, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce)
import Unsafe.Coerce (unsafeCoerce)
layoutSpec :: forall eff props. Spec (E eff) AppState props Action
layoutSpec =
fold
[ routingSpec
, container $ withState pagesComponent
, withState \st ->
fold [ focus _loginState _loginAction (LN.modalSpec st.showLogin "Login" LN.renderSpec)
, focus _addCorpusState _addCorpusAction (AC.modalSpec st.showCorpus "Search Results" AC.layoutAddcorpus)
]
]
where
container :: Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action
container = over _render \render d p s c ->
(render d p s c)
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent :: forall props eff. AppState -> Spec (E eff) AppState props Action
pagesComponent s =
pagesComponent s =
case s.currentRoute of
case s.currentRoute of
...
@@ -85,7 +101,7 @@ pagesComponent s =
...
@@ -85,7 +101,7 @@ pagesComponent s =
selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1
selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1
-- To be removed
-- To be removed
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec NGramsTable = layout0 $ focus _ngState _NgramsA NG.ngramsTableSpec
selectSpec NGramsTable = layout0 $ focus _ng
ram
State _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 $ focus _dashBoardSate _dashBoardAction Dsh.layoutDashboard
...
@@ -334,17 +350,4 @@ layoutFooter = simpleSpec performAction render
...
@@ -334,17 +350,4 @@ layoutFooter = simpleSpec performAction render
]
]
]
]
layoutSpec :: forall eff props. Spec (E eff) AppState props Action
layoutSpec =
fold
[ routingSpec
, container $ withState pagesComponent
, withState \st ->
fold [ focus _loginState _loginAction (LN.modalSpec st.showLogin "Login" LN.renderSpec)
, focus _addCorpusState _addCorpusAction (AC.modalSpec st.showCorpus "Search Results" AC.layoutAddcorpus)
]
]
where
container :: Spec (E eff) AppState props Action -> Spec (E eff) AppState props Action
container = over _render \render d p s c ->
(render d p s c)
src/Gargantext/Pages/Layout/States.purs
View file @
0b6ad414
...
@@ -2,17 +2,12 @@ module Gargantext.Pages.Layout.States where
...
@@ -2,17 +2,12 @@ module Gargantext.Pages.Layout.States where
import Prelude hiding (div)
import Prelude hiding (div)
import Control.Monad.Cont.Trans (lift)
import Control.Monad.Eff.Console (CONSOLE)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE, log)
import DOM (DOM)
import DOM (DOM)
import Data.Array (length)
import Data.Lens (Lens', lens)
import Data.Either (Either(..))
import Data.Lens (Lens', Prism', lens, prism)
import Data.Maybe (Maybe(Just))
import Data.Maybe (Maybe(Just))
import Gargantext.Components.Login as LN
import Gargantext.Components.Login as LN
import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Components.Tree as Tree
import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus as AC
import Gargantext.Pages.Corpus as AC
import Gargantext.Pages.Corpus.Doc.Annotation as D
import Gargantext.Pages.Corpus.Doc.Annotation as D
...
@@ -28,29 +23,28 @@ import Gargantext.Pages.Search as S
...
@@ -28,29 +23,28 @@ import Gargantext.Pages.Search as S
import Gargantext.Router (Routes(..))
import Gargantext.Router (Routes(..))
import Network.HTTP.Affjax (AJAX)
import Network.HTTP.Affjax (AJAX)
import Thermite (PerformAction, modifyState)
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
type AppState =
type AppState =
{ currentRoute :: Maybe Routes
{ currentRoute :: Maybe Routes
, landingState :: L.State
, landingState :: L.State
,
loginState
:: LN.State
,
loginState
:: LN.State
, addCorpusState :: AC.State
, addCorpusState :: AC.State
, docViewState :: DV.State
, docViewState :: DV.State
, searchState :: S.State
, searchState :: S.State
, userPage
:: U.State
, userPage
State
:: U.State
, docAnnotation
View
:: D.State
, docAnnotation
State
:: D.State
, ntree
View
:: Tree.State
, ntree
State
:: Tree.State
, tabview
:: TV.State
, tabview
State
:: TV.State
, search
:: String
, search :: String
, corpus
Analysis
:: CA.State
, corpus
State
:: CA.State
, showLogin :: Boolean
, showLogin :: Boolean
, showCorpus :: Boolean
, showCorpus :: Boolean
, graphExplorer :: GE.State
, graphExplorer
State
:: GE.State
, initialized :: Boolean
, initialized :: Boolean
, ng
State
:: NG.State
, ng
ramState
:: NG.State
, dashboard
:: Dsh.State
, dashboard
State
:: Dsh.State
}
}
initAppState :: AppState
initAppState :: AppState
...
@@ -61,18 +55,18 @@ initAppState =
...
@@ -61,18 +55,18 @@ initAppState =
, addCorpusState : AC.initialState
, addCorpusState : AC.initialState
, docViewState : DV.tdata
, docViewState : DV.tdata
, searchState : S.initialState
, searchState : S.initialState
, userPage
: U.initialState
, userPage
State
: U.initialState
, docAnnotation
View
: D.initialState
, docAnnotation
State
: D.initialState
, ntree
View
: Tree.exampleTree
, ntree
State
: Tree.exampleTree
, tabview
: TV.initialState
, tabview
State
: TV.initialState
, search
: ""
, search : ""
, corpus
Analysis
: CA.initialState
, corpus
State
: CA.initialState
, showLogin
: false
, showLogin : false
, showCorpus
: false
, showCorpus : false
, graphExplorer : GE.initialState
, graphExplorer
State
: GE.initialState
, initialized : false
, initialized : false
, ng
State
: NG.initialState
, ng
ramState
: NG.initialState
, dashboard
: Dsh.initialState
, dashboard
State
: Dsh.initialState
}
}
---------------------------------------------------------
---------------------------------------------------------
...
@@ -92,27 +86,27 @@ _searchState :: Lens' AppState S.State
...
@@ -92,27 +86,27 @@ _searchState :: Lens' AppState S.State
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_userPageState :: Lens' AppState U.State
_userPageState :: Lens' AppState U.State
_userPageState = lens (\s -> s.userPage
) (\s ss -> s{userPag
e = ss})
_userPageState = lens (\s -> s.userPage
State) (\s ss -> s{userPageStat
e = ss})
_docAnnotationViewState :: Lens' AppState D.State
_docAnnotationViewState :: Lens' AppState D.State
_docAnnotationViewState = lens (\s -> s.docAnnotation
View) (\s ss -> s{docAnnotationView
= ss})
_docAnnotationViewState = lens (\s -> s.docAnnotation
State) (\s ss -> s{docAnnotationState
= ss})
_treeState :: Lens' AppState Tree.State
_treeState :: Lens' AppState Tree.State
_treeState = lens (\s -> s.ntree
View) (\s ss -> s {ntreeView
= ss})
_treeState = lens (\s -> s.ntree
State) (\s ss -> s {ntreeState
= ss})
_tabviewState :: Lens' AppState TV.State
_tabviewState :: Lens' AppState TV.State
_tabviewState = lens (\s -> s.tabview
) (\s ss -> s {tabview
= ss})
_tabviewState = lens (\s -> s.tabview
State) (\s ss -> s {tabviewState
= ss})
_corpusState :: Lens' AppState CA.State
_corpusState :: Lens' AppState CA.State
_corpusState = lens (\s -> s.corpus
Analysis) (\s ss -> s {corpusAnalysis
= ss})
_corpusState = lens (\s -> s.corpus
State) (\s ss -> s {corpusState
= ss})
_dashBoardSate :: Lens' AppState Dsh.State
_dashBoardSate :: Lens' AppState Dsh.State
_dashBoardSate = lens (\s -> s.dashboard
) (\s ss -> s {dashboard
= ss})
_dashBoardSate = lens (\s -> s.dashboard
State) (\s ss -> s {dashboardState
= ss})
_graphExplorerState :: Lens' AppState GE.State
_graphExplorerState :: Lens' AppState GE.State
_graphExplorerState = lens (\s -> s.graphExplorer
) (\s ss -> s{graphExplorer
= ss})
_graphExplorerState = lens (\s -> s.graphExplorer
State) (\s ss -> s{graphExplorerState
= ss})
_ngState :: Lens' AppState NG.State
_ng
ram
State :: Lens' AppState NG.State
_ng
State = lens (\s -> s.ngState) (\s ss -> s{ng
State = ss})
_ng
ramState = lens (\s -> s.ngramState) (\s ss -> s{ngram
State = ss})
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