diff --git a/src/Gargantext/Pages/Corpus/Annuaire.purs b/src/Gargantext/Pages/Corpus/Annuaire.purs index eaff59d28c056d8756d5f72b4d9b3b725196642d..6c1d7e1baed400933400f71793bd0915a7521082 100644 --- a/src/Gargantext/Pages/Corpus/Annuaire.purs +++ b/src/Gargantext/Pages/Corpus/Annuaire.purs @@ -179,20 +179,21 @@ instance decodeAnnuaireTable :: DecodeJson AnnuaireTable where ------------------------------------------------------------------------ performAction :: PerformAction State {} Action performAction (Load aId) _ _ = do + + eitherInfo <- lift $ getInfo aId + _ <- case eitherInfo of + (Right info') -> void $ modifyState $ _info ?~ info' + (Left err) -> do + liftEffect $ log err + eitherTable <- lift $ getTable aId liftEffect $ log "Feching Table" _ <- case eitherTable of (Right table') -> void $ modifyState $ _table ?~ table' (Left err) -> do liftEffect $ log err + liftEffect <<< log $ "Annuaire page fetched." - eitherInfo <- lift $ getInfo aId - _ <- case eitherInfo of - (Right info') -> void $ modifyState $ _info ?~ info' - (Left err) -> do - liftEffect $ log err - - liftEffect <<< log $ "Fetching annuaire page..." performAction _ _ _ = pure unit ------------------------------------------------------------------------ getTable :: Int -> Aff (Either String AnnuaireTable) diff --git a/src/Gargantext/Pages/Layout.purs b/src/Gargantext/Pages/Layout.purs index 5d9605e2f829db1c1d79c2e2265aef60a0bd095f..67bc3792a1183400e25ff7d026f1354dd933b2aa 100644 --- a/src/Gargantext/Pages/Layout.purs +++ b/src/Gargantext/Pages/Layout.purs @@ -63,9 +63,9 @@ dispatchAction dispatcher _ Tabview = do dispatcher $ SetRoute Tabview -- dispatcher $ TabViewA TODO -dispatchAction dispatcher _ CorpusAnalysis = do - dispatcher $ SetRoute CorpusAnalysis - -- dispatcher $ CorpusAnalysisA TODO +dispatchAction dispatcher _ (Corpus n) = do + dispatcher $ SetRoute $ Corpus n + dispatcher $ DocViewA $ DV.LoadData n dispatchAction dispatcher _ PGraphExplorer = do dispatcher $ SetRoute PGraphExplorer diff --git a/src/Gargantext/Pages/Layout/Specs.purs b/src/Gargantext/Pages/Layout/Specs.purs index 43062d60962aa24f422f4284f673ecf65afbc9dd..d2069d39ae24eca4b814095820550cf979f3a08a 100644 --- a/src/Gargantext/Pages/Layout/Specs.purs +++ b/src/Gargantext/Pages/Layout/Specs.purs @@ -12,7 +12,7 @@ import Gargantext.Components.Tree as Tree import Gargantext.Pages.Corpus.Annuaire as A import Gargantext.Folder as F import Gargantext.Pages.Corpus as CA -import Gargantext.Pages.Corpus.Doc.Annotation as D +import Gargantext.Pages.Corpus.Doc.Annotation as Annotation import Gargantext.Pages.Corpus.Doc.Facets as TV import Gargantext.Pages.Corpus.Doc.Facets.Dashboard as Dsh import Gargantext.Pages.Corpus.Doc.Facets.Documents as DV @@ -54,13 +54,14 @@ pagesComponent s = Nothing -> selectSpec Home where selectSpec :: Routes -> Spec AppState {} Action - selectSpec CorpusAnalysis = layout0 $ noState CA.spec' + selectSpec (Corpus i) = layout0 $ focus _docViewState _docViewAction DV.layoutDocview selectSpec Login = focus _loginState _loginAction LN.renderSpec selectSpec Home = layout0 $ noState (L.layoutLanding EN) selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec (DocView i) = layout0 $ focus _docViewState _docViewAction DV.layoutDocview selectSpec (UserPage i) = layout0 $ focus _userPageState _userPageAction U.layoutUser - selectSpec (DocAnnotation i) = layout0 $ focus _docAnnotationViewState _docAnnotationViewAction D.docview + selectSpec (DocAnnotation i) = layout0 $ focus _docAnnotationViewState + _docAnnotationViewAction Annotation.docview selectSpec Tabview = layout0 $ noState TV.pureTab1 -- To be removed selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec diff --git a/src/Gargantext/Router.purs b/src/Gargantext/Router.purs index 73723031bd34d4acd351e5ec14c0858f0d42efa5..2a31081f7fe09acf55eeb6f4c1047b9dba230513 100644 --- a/src/Gargantext/Router.purs +++ b/src/Gargantext/Router.purs @@ -22,7 +22,7 @@ data Routes | UserPage Int | DocAnnotation Int | Tabview - | CorpusAnalysis + | Corpus Int | PGraphExplorer | NGramsTable | Dashboard @@ -35,15 +35,15 @@ instance showRoutes :: Show Routes where show AddCorpus = "AddCorpus" show (DocView i) = "DocView" show SearchView = "Search" - show (UserPage i) = "User" + show (UserPage i) = "User" <> show i show (DocAnnotation i)= "Document" show Tabview = "Tabview" - show CorpusAnalysis = "Corpus" show PGraphExplorer = "graphExplorer" show NGramsTable = "NGramsTable" show Dashboard = "Dashboard" - show (Annuaire i) = "Annuaire" - show (Folder i) = "Folder" + show (Corpus i) = "Corpus" <> show i + show (Annuaire i) = "Annuaire" <> show i + show (Folder i) = "Folder" <> show i show Home = "Home" int :: Match Int @@ -51,20 +51,20 @@ int = floor <$> num routing :: Match Routes routing = - Login <$ route "login" - <|> Tabview <$ route "tabview" + Login <$ route "login" + <|> Tabview <$ route "tabview" <|> DocAnnotation <$> (route "document" *> int) <|> UserPage <$> (route "user" *> int) - <|> SearchView <$ route "search" - <|> DocView <$> (route "docView" *> int) - <|> AddCorpus <$ route "addCorpus" - <|> CorpusAnalysis <$ route "corpus" - <|> PGraphExplorer <$ route "graph" - <|> NGramsTable <$ route "ngrams" - <|> Dashboard <$ route "dashboard" + <|> SearchView <$ route "search" + <|> DocView <$> (route "docView" *> int) + <|> AddCorpus <$ route "addCorpus" + <|> Corpus <$> (route "corpus" *> int) + <|> PGraphExplorer <$ route "graph" + <|> NGramsTable <$ route "ngrams" + <|> Dashboard <$ route "dashboard" <|> Annuaire <$> (route "annuaire" *> int) <|> Folder <$> (route "folder" *> int) - <|> Home <$ lit "" + <|> Home <$ lit "" where route str = lit "" *> lit str