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
0ddf7f88
Commit
0ddf7f88
authored
Oct 09, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Prelude] custom for Garg.
parent
4bb618e2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
Documents.purs
src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs
+17
-15
No files found.
src/Gargantext/Pages/Corpus/Doc/Facets/Documents.purs
View file @
0ddf7f88
module Gargantext.Pages.Corpus.Doc.Facets.Documents where
import Prelude hiding (div)
import Affjax (defaultRequest, printResponseFormatError, request)
import Affjax.ResponseFormat as ResponseFormat
...
...
@@ -14,9 +13,8 @@ import Data.HTTP.Method (Method(..))
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Gargantext.Prelude hiding (div)
import Gargantext.Config (NodeType(..), toUrl, End(..))
import Gargantext.Config.REST (get)
import Gargantext.Utils.DecodeMaybe ((.|))
...
...
@@ -183,18 +181,21 @@ layoutDocview = simpleSpec performAction render
performAction :: PerformAction State {} Action
performAction (ChangePageSize ps) _ _ = void $ modifyState $ changePageSize ps
performAction (ChangePageSize ps) _ _ =
void $ modifyState $ changePageSize ps
performAction (ChangePage p) _ _ = void $ modifyState \(TableData td) -> TableData $ td { currentPage = p }
performAction (ChangePage p) _ _ =
void $ modifyState \(TableData td) -> TableData
$ td { currentPage = p }
performAction (LoadData n) _ _ = do
res <- lift $ loadPage n
case res of
Left err -> do
_ <- l
iftEffect $ log $ show
$ "Error: loading page documents:" <> show err
_ <- l
ogs
$ "Error: loading page documents:" <> show err
pure unit
Right resData -> do
_ <- l
iftEffect $ log $ show
"OK: loading page documents."
_ <- l
ogs
"OK: loading page documents."
_ <- modifyState $ const resData
pure unit
...
...
@@ -206,13 +207,14 @@ loadPage n = do
-- res <- get "http://localhost:8008/corpus/472764/facet/documents/table?offset=0&limit=10"
case res of
Left err -> do
_ <- l
iftEffect $ log $ show
"Err: loading page documents"
_ <- l
iftEffect $ log
$ show err
_ <- l
ogs
"Err: loading page documents"
_ <- l
ogs
$ show err
pure $ Left $ show err
Right resData -> do
let docs = toTableData (res2corpus $ resData)
_ <- liftEffect $ log $ show "Ok: loading page documents"
_ <- liftEffect $ log $ show $ map (\({ row: r, delete :_}) -> show r) ((\(TableData docs') -> docs'.rows) docs)
_ <- logs "Ok: loading page documents"
_ <- logs $ map (\({ row: r, delete :_}) -> show r)
((\(TableData docs') -> docs'.rows) docs)
pure $ Right docs
where
res2corpus :: Array Response -> Array DocumentsView
...
...
@@ -451,11 +453,11 @@ searchResults squery = do
}
case res.body of
Left err -> do
_ <- l
iftEffect $ log
$ printResponseFormatError err
_ <- l
ogs
$ printResponseFormatError err
pure $ Left $ printResponseFormatError err
Right json -> do
--_ <- l
iftEffect $ log $ show
a.status
--_ <- l
iftEffect $ log $ show
a.headers
--_ <- l
iftEffect $ log $ show
a.body
--_ <- l
ogs
a.status
--_ <- l
ogs
a.headers
--_ <- l
ogs
a.body
let obj = decodeJson json
pure obj
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