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
9a014261
Commit
9a014261
authored
4 years ago
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[docstable] refactor table/hash url function
parent
a0df81cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+8
-7
CacheAPI.purs
src/Gargantext/Utils/CacheAPI.purs
+4
-4
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
9a014261
...
@@ -368,8 +368,7 @@ type PageParams =
...
@@ -368,8 +368,7 @@ type PageParams =
getPageHash :: Session -> PageParams -> Aff String
getPageHash :: Session -> PageParams -> Aff String
getPageHash session { corpusId, listId, nodeId, query, tabType } = do
getPageHash session { corpusId, listId, nodeId, query, tabType } = do
let p = NodeAPI Node (Just nodeId) $ "table/hash" <> "?tabType=" <> (showTabType' tabType)
(get session $ tableHashRoute nodeId tabType) :: Aff String
(get session p) :: Aff String
convOrderBy (Just (T.ASC (T.ColumnName "Date"))) = Just DateAsc
convOrderBy (Just (T.ASC (T.ColumnName "Date"))) = Just DateAsc
...
@@ -417,7 +416,7 @@ pageLayoutCpt = R.hooksComponent "G.C.DocsTable.pageLayout" cpt where
...
@@ -417,7 +416,7 @@ pageLayoutCpt = R.hooksComponent "G.C.DocsTable.pageLayout" cpt where
mkRequest :: PageParams -> GUC.Request
mkRequest :: PageParams -> GUC.Request
mkRequest p@{ listId, nodeId, tabType } =
mkRequest p@{ listId, nodeId, tabType } =
GUC.makeGetRequest session $
NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId)
GUC.makeGetRequest session $
tableRoute nodeId tabType listId
handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView)
handleResponse :: HashedResponse (TableResult Response) -> Tuple Int (Array DocumentsView)
handleResponse (HashedResponse { hash, value: res }) = ret
handleResponse (HashedResponse { hash, value: res }) = ret
where
where
...
@@ -543,13 +542,15 @@ instance encodeJsonSQuery :: EncodeJson SearchQuery where
...
@@ -543,13 +542,15 @@ instance encodeJsonSQuery :: EncodeJson SearchQuery where
~> jsonEmptyObject
~> jsonEmptyObject
searchResults :: SearchQuery -> Aff Int
searchResults squery = pure 42 -- TODO post "http://localhost:8008/count" unit
documentsRoute :: Int -> SessionRoute
documentsRoute :: Int -> SessionRoute
documentsRoute nodeId = NodeAPI Node (Just nodeId) "documents"
documentsRoute nodeId = NodeAPI Node (Just nodeId) "documents"
tableRoute :: Int -> TabType -> Int -> SessionRoute
tableRoute nodeId tabType listId = NodeAPI Node (Just nodeId) $ "table" <> "?tabType=" <> (showTabType' tabType) <> "&list=" <> (show listId)
tableHashRoute :: Int -> TabType -> SessionRoute
tableHashRoute nodeId tabType = NodeAPI Node (Just nodeId) $ "table/hash" <> "?tabType=" <> (showTabType' tabType)
deleteAllDocuments :: Session -> Int -> Aff (Array Int)
deleteAllDocuments :: Session -> Int -> Aff (Array Int)
deleteAllDocuments session = delete session <<< documentsRoute
deleteAllDocuments session = delete session <<< documentsRoute
...
...
This diff is collapsed.
Click to expand it.
src/Gargantext/Utils/CacheAPI.purs
View file @
9a014261
...
@@ -78,10 +78,10 @@ cached cache req = do
...
@@ -78,10 +78,10 @@ cached cache req = do
mRes <- match cache req
mRes <- match cache req
case mRes of
case mRes of
Just res -> do
Just res -> do
liftEffect $ log2 "[cached] cache hit" req
--
liftEffect $ log2 "[cached] cache hit" req
pure res
pure res
Nothing -> do
Nothing -> do
liftEffect $ log2 "[cached] cache miss" req
--
liftEffect $ log2 "[cached] cache miss" req
_ <- add cache req
_ <- add cache req
mResFresh <- match cache req
mResFresh <- match cache req
case mResFresh of
case mResFresh of
...
@@ -91,8 +91,8 @@ cached cache req = do
...
@@ -91,8 +91,8 @@ cached cache req = do
cachedJson :: forall a. DecodeJson a => Cache -> Request -> Aff a
cachedJson :: forall a. DecodeJson a => Cache -> Request -> Aff a
cachedJson cache req = do
cachedJson cache req = do
res <- cached cache req
res <- cached cache req
liftEffect $ do
--
liftEffect $ do
log2 "[cachedJson] res" res
--
log2 "[cachedJson] res" res
j <- M.json res
j <- M.json res
case decodeJson (F.unsafeFromForeign j) of
case decodeJson (F.unsafeFromForeign j) of
...
...
This diff is collapsed.
Click to expand it.
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