Commit b7e624dc authored by James Laver's avatar James Laver

reenable texts page

parent 04fe91cf
...@@ -2,7 +2,7 @@ module Gargantext.Components.Login.Types where ...@@ -2,7 +2,7 @@ module Gargantext.Components.Login.Types where
import Prelude import Prelude
import Data.Argonaut ( class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject import Data.Argonaut ( class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject
, (.:), (.:!), (:=), (~>) , (.:), (.??), (:=), (~>)
) )
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Eq (genericEq) import Data.Generic.Rep.Eq (genericEq)
...@@ -52,8 +52,8 @@ instance decodeAuthInvalid :: DecodeJson AuthInvalid where ...@@ -52,8 +52,8 @@ instance decodeAuthInvalid :: DecodeJson AuthInvalid where
instance decodeAuthResponse :: DecodeJson AuthResponse where instance decodeAuthResponse :: DecodeJson AuthResponse where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
valid <- obj .:! "valid" valid <- obj .?? "valid"
inval <- obj .:! "inval" inval <- obj .?? "inval"
pure $ AuthResponse {valid, inval} pure $ AuthResponse {valid, inval}
instance decodeAuthData :: DecodeJson AuthData where instance decodeAuthData :: DecodeJson AuthData where
......
...@@ -50,7 +50,7 @@ import Control.Monad.Cont.Trans (lift) ...@@ -50,7 +50,7 @@ import Control.Monad.Cont.Trans (lift)
import Data.Array (head) import Data.Array (head)
import Data.Array as A import Data.Array as A
import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson import Data.Argonaut ( class DecodeJson, decodeJson, class EncodeJson, encodeJson
, jsonEmptyObject, (:=), (~>), (.:), (.:!) ) , jsonEmptyObject, (:=), (~>), (.:), (.??) )
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Foldable (class Foldable, foldMap, foldl, foldr) import Data.Foldable (class Foldable, foldMap, foldl, foldr)
import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex) import Data.FoldableWithIndex (class FoldableWithIndex, foldMapWithIndex, foldlWithIndex, foldrWithIndex)
...@@ -163,8 +163,8 @@ instance decodeJsonNgramsElement :: DecodeJson NgramsElement where ...@@ -163,8 +163,8 @@ instance decodeJsonNgramsElement :: DecodeJson NgramsElement where
ngrams <- obj .: "ngrams" ngrams <- obj .: "ngrams"
list <- obj .: "list" list <- obj .: "list"
occurrences <- obj .: "occurrences" occurrences <- obj .: "occurrences"
parent <- obj .:! "parent" parent <- obj .?? "parent"
root <- obj .:! "root" root <- obj .?? "root"
children' <- obj .: "children" children' <- obj .: "children"
let children = Set.fromFoldable (children' :: Array NgramsTerm) let children = Set.fromFoldable (children' :: Array NgramsTerm)
pure $ NgramsElement {ngrams, list, occurrences, parent, root, children} pure $ NgramsElement {ngrams, list, occurrences, parent, root, children}
...@@ -333,8 +333,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where ...@@ -333,8 +333,8 @@ instance encodeJsonReplace :: EncodeJson a => EncodeJson (Replace a) where
instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where instance decodeJsonReplace :: (DecodeJson a, Eq a) => DecodeJson (Replace a) where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
mold <- obj .:! "old" mold <- obj .?? "old"
mnew <- obj .:! "new" mnew <- obj .?? "new"
case Tuple mold mnew of case Tuple mold mnew of
Tuple (Just old) (Just new) -> pure $ replace old new Tuple (Just old) (Just new) -> pure $ replace old new
Tuple Nothing Nothing -> pure Keep Tuple Nothing Nothing -> pure Keep
......
...@@ -7,9 +7,9 @@ import Gargantext.Types (ApiVersion(..)) ...@@ -7,9 +7,9 @@ import Gargantext.Types (ApiVersion(..))
defaultBackends :: NonEmpty Array Backend defaultBackends :: NonEmpty Array Backend
defaultBackends = prod :| [dev, demo, local] defaultBackends = prod :| [dev, demo, local]
where where
prod = backend V10 "/api/" "http://gargantext.org" "gargantext.org" prod = backend V10 "/api/" "https://gargantext.org" "gargantext.org"
dev = backend V10 "/api/" "http://dev.gargantext.org" "dev.gargantext.org" dev = backend V10 "/api/" "https://dev.gargantext.org" "dev.gargantext.org"
demo = backend V10 "/api/" "http://demo.gargantext.org" "demo.gargantext.org" demo = backend V10 "/api/" "https://demo.gargantext.org" "demo.gargantext.org"
local = backend V10 "/api/" "http://localhost:8008" "localhost" local = backend V10 "/api/" "http://localhost:8008" "localhost"
defaultApps :: NonEmpty Array Frontend defaultApps :: NonEmpty Array Frontend
......
module Gargantext.Pages.Annuaire where module Gargantext.Pages.Annuaire where
import Prelude (bind, const, identity, pure, ($), (<$>), (<>)) import Prelude (bind, const, identity, pure, ($), (<$>), (<>))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:!)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.??))
import Data.Array (head) import Data.Array (head)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
import Data.Tuple (fst, snd) import Data.Tuple (fst, snd)
...@@ -138,8 +138,8 @@ data HyperdataAnnuaire = HyperdataAnnuaire ...@@ -138,8 +138,8 @@ data HyperdataAnnuaire = HyperdataAnnuaire
instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where instance decodeHyperdataAnnuaire :: DecodeJson HyperdataAnnuaire where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
title <- obj .:! "title" title <- obj .?? "title"
desc <- obj .:! "desc" desc <- obj .?? "desc"
pure $ HyperdataAnnuaire { title, desc } pure $ HyperdataAnnuaire { title, desc }
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
......
...@@ -2,7 +2,7 @@ module Gargantext.Pages.Annuaire.User.Contacts.Types where ...@@ -2,7 +2,7 @@ module Gargantext.Pages.Annuaire.User.Contacts.Types where
import Prelude import Prelude
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:!)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.??))
import Data.Maybe (Maybe, fromMaybe) import Data.Maybe (Maybe, fromMaybe)
import Data.Map (Map) import Data.Map (Map)
import Gargantext.Utils.DecodeMaybe ((.?|)) import Gargantext.Utils.DecodeMaybe ((.?|))
...@@ -35,11 +35,11 @@ instance decodeContactWho :: DecodeJson ContactWho ...@@ -35,11 +35,11 @@ instance decodeContactWho :: DecodeJson ContactWho
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
idWho <- obj .:! "id" idWho <- obj .?? "id"
firstName <- obj .:! "firstName" firstName <- obj .?? "firstName"
lastName <- obj .:! "lastName" lastName <- obj .?? "lastName"
keywords <- obj .:! "keywords" keywords <- obj .?? "keywords"
freetags <- obj .:! "freetags" freetags <- obj .?? "freetags"
let k = fromMaybe [] keywords let k = fromMaybe [] keywords
let f = fromMaybe [] freetags let f = fromMaybe [] freetags
...@@ -68,15 +68,15 @@ instance decodeContactWhere :: DecodeJson ContactWhere ...@@ -68,15 +68,15 @@ instance decodeContactWhere :: DecodeJson ContactWhere
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
organization <- obj .:! "organization" organization <- obj .?? "organization"
labTeamDepts <- obj .:! "labTeamDepts" labTeamDepts <- obj .?? "labTeamDepts"
role <- obj .:! "role" role <- obj .?? "role"
office <- obj .:! "office" office <- obj .?? "office"
country <- obj .:! "country" country <- obj .?? "country"
city <- obj .:! "city" city <- obj .?? "city"
touch <- obj .:! "touch" touch <- obj .?? "touch"
entry <- obj .:! "entry" entry <- obj .?? "entry"
exit <- obj .:! "exit" exit <- obj .?? "exit"
let o = fromMaybe [] organization let o = fromMaybe [] organization
let l = fromMaybe [] labTeamDepts let l = fromMaybe [] labTeamDepts
...@@ -95,9 +95,9 @@ instance decodeContactTouch :: DecodeJson ContactTouch ...@@ -95,9 +95,9 @@ instance decodeContactTouch :: DecodeJson ContactTouch
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
mail <- obj .:! "mail" mail <- obj .?? "mail"
phone <- obj .:! "phone" phone <- obj .?? "phone"
url <- obj .:! "url" url <- obj .?? "url"
pure $ ContactTouch {mail, phone, url} pure $ ContactTouch {mail, phone, url}
...@@ -117,14 +117,14 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact ...@@ -117,14 +117,14 @@ instance decodeHyperdataContact :: DecodeJson HyperdataContact
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
bdd <- obj .:! "bdd" bdd <- obj .?? "bdd"
who <- obj .:! "who" who <- obj .?? "who"
ou <- obj .:! "where" ou <- obj .?? "where"
title <- obj .:! "title" title <- obj .?? "title"
source <- obj .:! "source" source <- obj .?? "source"
lastValidation <- obj .:! "lastValidation" lastValidation <- obj .?? "lastValidation"
uniqId <- obj .:! "uniqId" uniqId <- obj .?? "uniqId"
uniqIdBdd <- obj .:! "uniqIdBdd" uniqIdBdd <- obj .?? "uniqIdBdd"
let ou' = fromMaybe [] ou let ou' = fromMaybe [] ou
...@@ -151,9 +151,9 @@ instance decodeUser :: DecodeJson Contact where ...@@ -151,9 +151,9 @@ instance decodeUser :: DecodeJson Contact where
obj <- decodeJson json obj <- decodeJson json
id <- obj .: "id" id <- obj .: "id"
typename <- obj .?| "typename" typename <- obj .?| "typename"
userId <- obj .:! "userId" userId <- obj .?? "userId"
parentId <- obj .?| "parentId" parentId <- obj .?| "parentId"
name <- obj .:! "name" name <- obj .?? "name"
date <- obj .?| "date" date <- obj .?| "date"
hyperdata <- obj .: "hyperdata" hyperdata <- obj .: "hyperdata"
pure $ Contact { id, typename, userId pure $ Contact { id, typename, userId
......
module Gargantext.Pages.Corpus.Document where module Gargantext.Pages.Corpus.Document where
import Prelude (class Show, bind, identity, mempty, pure, ($), (<<<)) import Prelude (class Show, bind, identity, mempty, pure, ($), (<<<))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:!)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.??))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..), maybe) import Data.Maybe (Maybe(..), maybe)
...@@ -203,7 +203,7 @@ instance decodeDocumentV3 :: DecodeJson DocumentV3 ...@@ -203,7 +203,7 @@ instance decodeDocumentV3 :: DecodeJson DocumentV3
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
abstract <- obj .:! "abstract" abstract <- obj .?? "abstract"
authors <- obj .: "authors" authors <- obj .: "authors"
--error <- obj .: "error" --error <- obj .: "error"
language_iso2 <- obj .: "language_iso2" language_iso2 <- obj .: "language_iso2"
...@@ -243,23 +243,23 @@ instance decodeDocument :: DecodeJson Document ...@@ -243,23 +243,23 @@ instance decodeDocument :: DecodeJson Document
where where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
abstract <- obj .:! "abstract" abstract <- obj .?? "abstract"
authors <- obj .:! "authors" authors <- obj .?? "authors"
bdd <- obj .:! "bdd" bdd <- obj .?? "bdd"
doi <- obj .:! "doi" doi <- obj .?? "doi"
language_iso2 <- obj .:! "language_iso2" language_iso2 <- obj .?? "language_iso2"
-- page <- obj .:! "page" -- page <- obj .?? "page"
publication_date <- obj .:! "publication_date" publication_date <- obj .?? "publication_date"
--publication_second <- obj .:! "publication_second" --publication_second <- obj .?? "publication_second"
--publication_minute <- obj .:! "publication_minute" --publication_minute <- obj .?? "publication_minute"
--publication_hour <- obj .:! "publication_hour" --publication_hour <- obj .?? "publication_hour"
publication_day <- obj .:! "publication_day" publication_day <- obj .?? "publication_day"
publication_month <- obj .:! "publication_month" publication_month <- obj .?? "publication_month"
publication_year <- obj .:! "publication_year" publication_year <- obj .?? "publication_year"
source <- obj .:! "sources" source <- obj .?? "sources"
institutes <- obj .:! "institutes" institutes <- obj .?? "institutes"
title <- obj .:! "title" title <- obj .?? "title"
uniqId <- obj .:! "uniqId" uniqId <- obj .?? "uniqId"
--url <- obj .: "url" --url <- obj .: "url"
--text <- obj .: "text" --text <- obj .: "text"
pure $ Document { abstract pure $ Document { abstract
......
module Gargantext.Pages.Lists.Tabs where module Gargantext.Pages.Lists.Tabs where
import Prelude import Prelude
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:!)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.??))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
...@@ -111,7 +111,7 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where ...@@ -111,7 +111,7 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where
desc <- obj .: "desc" desc <- obj .: "desc"
query <- obj .: "query" query <- obj .: "query"
authors <- obj .: "authors" authors <- obj .: "authors"
chart <- obj .:! "chart" chart <- obj .?? "chart"
let totalRecords = 47361 -- TODO let totalRecords = 47361 -- TODO
pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords} pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords}
......
...@@ -3,6 +3,8 @@ module Gargantext.Pages.Texts where ...@@ -3,6 +3,8 @@ module Gargantext.Pages.Texts where
import Prelude ((<<<)) import Prelude ((<<<))
import Data.Array (head) import Data.Array (head)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
import DOM.Simple.Console (log2)
import Effect.Class (liftEffect)
import Effect.Aff (Aff, throwError) import Effect.Aff (Aff, throwError)
import Effect.Exception (error) import Effect.Exception (error)
import Reactix as R import Reactix as R
...@@ -45,9 +47,12 @@ textsLayoutCpt = R.hooksComponent "TextsLoader" cpt ...@@ -45,9 +47,12 @@ textsLayoutCpt = R.hooksComponent "TextsLoader" cpt
getCorpus :: Session -> Int -> Aff CorpusData getCorpus :: Session -> Int -> Aff CorpusData
getCorpus session textsId = do getCorpus session textsId = do
liftEffect $ log2 "nodepolyurl: " nodePolyUrl
-- fetch corpus via texts parentId -- fetch corpus via texts parentId
(NodePoly {parentId: corpusId} :: NodePoly {}) <- get nodePolyUrl (NodePoly {parentId: corpusId} :: NodePoly {}) <- get nodePolyUrl
liftEffect $ log2 "corpusnodeurl: " $ corpusNodeUrl corpusId
corpusNode <- get $ corpusNodeUrl corpusId corpusNode <- get $ corpusNodeUrl corpusId
liftEffect $ log2 "defaultlistidsurl: " $ defaultListIdsUrl corpusId
defaultListIds <- get $ defaultListIdsUrl corpusId defaultListIds <- get $ defaultListIdsUrl corpusId
case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of case (head defaultListIds :: Maybe (NodePoly HyperdataList)) of
Just (NodePoly { id: defaultListId }) -> Just (NodePoly { id: defaultListId }) ->
...@@ -55,6 +60,6 @@ getCorpus session textsId = do ...@@ -55,6 +60,6 @@ getCorpus session textsId = do
Nothing -> Nothing ->
throwError $ error "Missing default list" throwError $ error "Missing default list"
where where
nodePolyUrl = url session $ NodeAPI NodeList (Just textsId) nodePolyUrl = url session $ NodeAPI Corpus (Just textsId)
corpusNodeUrl = url session <<< NodeAPI Corpus <<< Just corpusNodeUrl = url session <<< NodeAPI Corpus <<< Just
defaultListIdsUrl = url session <<< Children NodeList 0 1 Nothing <<< Just defaultListIdsUrl = url session <<< Children NodeList 0 1 Nothing <<< Just
...@@ -2,7 +2,7 @@ module Gargantext.Pages.Texts.Tabs where ...@@ -2,7 +2,7 @@ module Gargantext.Pages.Texts.Tabs where
-------------------------------------------------------- --------------------------------------------------------
import Prelude (class Eq, class Show, bind, pure, ($)) import Prelude (class Eq, class Show, bind, pure, ($))
import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.:!)) import Data.Argonaut (class DecodeJson, decodeJson, (.:), (.??))
import Data.Generic.Rep (class Generic) import Data.Generic.Rep (class Generic)
import Data.Generic.Rep.Show (genericShow) import Data.Generic.Rep.Show (genericShow)
import Data.Maybe (Maybe(..)) import Data.Maybe (Maybe(..))
...@@ -149,7 +149,7 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where ...@@ -149,7 +149,7 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where
desc <- obj .: "desc" desc <- obj .: "desc"
query <- obj .: "query" query <- obj .: "query"
authors <- obj .: "authors" authors <- obj .: "authors"
chart <- obj .:! "chart" chart <- obj .?? "chart"
let totalRecords = 47361 -- TODO let totalRecords = 47361 -- TODO
pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords} pure $ CorpusInfo {title, desc, query, authors, chart, totalRecords}
......
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