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)
import DOM (DOM)
import Data.Array (length)
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.Modals.Modal (modalShow)
import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh
import Gargantext.Pages.Corpus as AC
import Gargantext.Router (Routes(..))
import Gargantext.Pages.Corpus.User.Users as U
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.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.Home as L
import Gargantext.Pages.Corpus.Doc.Facets.Terms.NgramsTable as NG
import Gargantext.Pages.Search as S
import Gargantext.Pages.Corpus.Doc.Facets as TV
import Gargantext.Pages.Corpus.User.Users as U
import Gargantext.Pages.Home as L
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 Thermite (PerformAction, modifyState)
...
...
@@ -97,7 +95,7 @@ performAction Initialize _ state = void do
modifyState id
Right docs -> do
modifyState $ _ { initialized = true
, ntree
View
= if length d > 0
, ntree
State
= if length d > 0
then Tree.exampleTree
--then fnTransform $ unsafePartial $ fromJust $ head d
else Tree.initialState
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
0b6ad414
...
...
@@ -21,7 +21,7 @@ import Gargantext.Pages.Layout.States ( _addCorpusState
, _graphExplorerState
, _landingState
, _loginState
,
_ng
State
,
_ngram
State
, _searchState
, _tabviewState
, _treeState
...
...
@@ -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 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 s =
case s.currentRoute of
...
...
@@ -85,7 +101,7 @@ pagesComponent s =
selectSpec Tabview = layout0 $ focus _tabviewState _tabviewAction TV.tab1
-- To be removed
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 Dashboard = layout0 $ focus _dashBoardSate _dashBoardAction Dsh.layoutDashboard
...
...
@@ -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
import Prelude hiding (div)
import Control.Monad.Cont.Trans (lift)
import Control.Monad.Eff.Class (liftEff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Control.Monad.Eff.Console (CONSOLE)
import DOM (DOM)
import Data.Array (length)
import Data.Either (Either(..))
import Data.Lens (Lens', Prism', lens, prism)
import Data.Lens (Lens', lens)
import Data.Maybe (Maybe(Just))
import Gargantext.Components.Login as LN
import Gargantext.Components.Modals.Modal (modalShow)
import Gargantext.Components.Tree as Tree
import Gargantext.Pages.Corpus as AC
import Gargantext.Pages.Corpus.Doc.Annotation as D
...
...
@@ -28,29 +23,28 @@ import Gargantext.Pages.Search as S
import Gargantext.Router (Routes(..))
import Network.HTTP.Affjax (AJAX)
import Thermite (PerformAction, modifyState)
type E e = (dom :: DOM, ajax :: AJAX, console :: CONSOLE | e)
type AppState =
{ currentRoute :: Maybe Routes
, landingState :: L.State
,
loginState
:: LN.State
,
loginState
:: LN.State
, addCorpusState :: AC.State
, docViewState :: DV.State
, searchState :: S.State
, userPage
:: U.State
, docAnnotation
View
:: D.State
, ntree
View
:: Tree.State
, tabview
:: TV.State
, search
:: String
, corpus
Analysis
:: CA.State
, userPage
State
:: U.State
, docAnnotation
State
:: D.State
, ntree
State
:: Tree.State
, tabview
State
:: TV.State
, search :: String
, corpus
State
:: CA.State
, showLogin :: Boolean
, showCorpus :: Boolean
, graphExplorer :: GE.State
, graphExplorer
State
:: GE.State
, initialized :: Boolean
, ng
State
:: NG.State
, dashboard
:: Dsh.State
, ng
ramState
:: NG.State
, dashboard
State
:: Dsh.State
}
initAppState :: AppState
...
...
@@ -61,18 +55,18 @@ initAppState =
, addCorpusState : AC.initialState
, docViewState : DV.tdata
, searchState : S.initialState
, userPage
: U.initialState
, docAnnotation
View
: D.initialState
, ntree
View
: Tree.exampleTree
, tabview
: TV.initialState
, search
: ""
, corpus
Analysis
: CA.initialState
, showLogin
: false
, showCorpus
: false
, graphExplorer : GE.initialState
, userPage
State
: U.initialState
, docAnnotation
State
: D.initialState
, ntree
State
: Tree.exampleTree
, tabview
State
: TV.initialState
, search : ""
, corpus
State
: CA.initialState
, showLogin : false
, showCorpus : false
, graphExplorer
State
: GE.initialState
, initialized : false
, ng
State
: NG.initialState
, dashboard
: Dsh.initialState
, ng
ramState
: NG.initialState
, dashboard
State
: Dsh.initialState
}
---------------------------------------------------------
...
...
@@ -92,27 +86,27 @@ _searchState :: Lens' AppState S.State
_searchState = lens (\s -> s.searchState) (\s ss -> s{searchState = ss})
_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 (\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 (\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 (\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 (\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 (\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 (\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
State = lens (\s -> s.ngState) (\s ss -> s{ng
State = ss})
_ng
ram
State :: Lens' AppState NG.State
_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