Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
195
Issues
195
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
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
gargantext
haskell-gargantext
Commits
50fb44bf
Commit
50fb44bf
authored
Jul 21, 2020
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[metrics] remove X-Hash header
parent
0d6763e2
Pipeline
#965
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
18 deletions
+5
-18
Metrics.hs
src/Gargantext/API/Metrics.hs
+5
-18
No files found.
src/Gargantext/API/Metrics.hs
View file @
50fb44bf
...
...
@@ -23,7 +23,6 @@ import qualified Data.Map as Map
import
Data.Time
(
UTCTime
)
import
Data.Text
(
Text
)
import
Servant
import
Servant.Server.Internal.ServerError
(
ServerError
(
..
))
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
...
...
@@ -51,8 +50,7 @@ type ScatterAPI = Summary "SepGen IncExc metrics"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParam
"limit"
Int
:>
Header
"X-Hash"
Text
:>
Get
'[
J
SON
]
(
Headers
'[
H
eader
"X-Hash"
Text
]
(
HashedResponse
Metrics
))
:>
Get
'[
J
SON
]
(
HashedResponse
Metrics
)
:<|>
Summary
"Scatter update"
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
...
...
@@ -74,9 +72,8 @@ getScatter :: FlowCmdM env err m =>
->
Maybe
ListId
->
TabType
->
Maybe
Limit
->
Maybe
Text
->
m
(
Headers
'[
H
eader
"X-Hash"
Text
]
(
HashedResponse
Metrics
))
getScatter
cId
maybeListId
tabType
_maybeLimit
mhHash
=
do
->
m
(
HashedResponse
Metrics
)
getScatter
cId
maybeListId
tabType
_maybeLimit
=
do
listId
<-
case
maybeListId
of
Just
lid
->
pure
lid
Nothing
->
defaultList
cId
...
...
@@ -88,16 +85,7 @@ getScatter cId maybeListId tabType _maybeLimit mhHash = do
Nothing
->
do
updateScatter'
cId
maybeListId
tabType
Nothing
let
r
=
constructHashedResponse
chart
-- TODO send 304 if hashes equal, 200 with response otherwise
if
mhHash
==
(
Just
$
hash
r
)
then
throwError
$
ServerError
{
errHTTPCode
=
304
,
errReasonPhrase
=
"Hashes match"
,
errBody
=
""
,
errHeaders
=
[]
}
else
pure
$
addHeader
(
hash
r
)
r
pure
$
constructHashedResponse
chart
updateScatter
::
FlowCmdM
env
err
m
=>
CorpusId
...
...
@@ -139,8 +127,7 @@ getScatterHash :: FlowCmdM env err m =>
->
TabType
->
m
Text
getScatterHash
cId
maybeListId
tabType
=
do
r
<-
getScatter
cId
maybeListId
tabType
Nothing
Nothing
pure
$
hash
$
getResponse
r
hash
<$>
getScatter
cId
maybeListId
tabType
Nothing
-------------------------------------------------------------
...
...
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