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
Show 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
...
@@ -23,7 +23,6 @@ import qualified Data.Map as Map
import
Data.Time
(
UTCTime
)
import
Data.Time
(
UTCTime
)
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Servant
import
Servant
import
Servant.Server.Internal.ServerError
(
ServerError
(
..
))
import
Gargantext.API.HashedResponse
import
Gargantext.API.HashedResponse
import
Gargantext.API.Ngrams
import
Gargantext.API.Ngrams
...
@@ -51,8 +50,7 @@ type ScatterAPI = Summary "SepGen IncExc metrics"
...
@@ -51,8 +50,7 @@ type ScatterAPI = Summary "SepGen IncExc metrics"
:>
QueryParam
"list"
ListId
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParam
"limit"
Int
:>
QueryParam
"limit"
Int
:>
Header
"X-Hash"
Text
:>
Get
'[
J
SON
]
(
HashedResponse
Metrics
)
:>
Get
'[
J
SON
]
(
Headers
'[
H
eader
"X-Hash"
Text
]
(
HashedResponse
Metrics
))
:<|>
Summary
"Scatter update"
:<|>
Summary
"Scatter update"
:>
QueryParam
"list"
ListId
:>
QueryParam
"list"
ListId
:>
QueryParamR
"ngramsType"
TabType
:>
QueryParamR
"ngramsType"
TabType
...
@@ -74,9 +72,8 @@ getScatter :: FlowCmdM env err m =>
...
@@ -74,9 +72,8 @@ getScatter :: FlowCmdM env err m =>
->
Maybe
ListId
->
Maybe
ListId
->
TabType
->
TabType
->
Maybe
Limit
->
Maybe
Limit
->
Maybe
Text
->
m
(
HashedResponse
Metrics
)
->
m
(
Headers
'[
H
eader
"X-Hash"
Text
]
(
HashedResponse
Metrics
))
getScatter
cId
maybeListId
tabType
_maybeLimit
=
do
getScatter
cId
maybeListId
tabType
_maybeLimit
mhHash
=
do
listId
<-
case
maybeListId
of
listId
<-
case
maybeListId
of
Just
lid
->
pure
lid
Just
lid
->
pure
lid
Nothing
->
defaultList
cId
Nothing
->
defaultList
cId
...
@@ -88,16 +85,7 @@ getScatter cId maybeListId tabType _maybeLimit mhHash = do
...
@@ -88,16 +85,7 @@ getScatter cId maybeListId tabType _maybeLimit mhHash = do
Nothing
->
do
Nothing
->
do
updateScatter'
cId
maybeListId
tabType
Nothing
updateScatter'
cId
maybeListId
tabType
Nothing
let
r
=
constructHashedResponse
chart
pure
$
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
updateScatter
::
FlowCmdM
env
err
m
=>
updateScatter
::
FlowCmdM
env
err
m
=>
CorpusId
CorpusId
...
@@ -139,8 +127,7 @@ getScatterHash :: FlowCmdM env err m =>
...
@@ -139,8 +127,7 @@ getScatterHash :: FlowCmdM env err m =>
->
TabType
->
TabType
->
m
Text
->
m
Text
getScatterHash
cId
maybeListId
tabType
=
do
getScatterHash
cId
maybeListId
tabType
=
do
r
<-
getScatter
cId
maybeListId
tabType
Nothing
Nothing
hash
<$>
getScatter
cId
maybeListId
tabType
Nothing
pure
$
hash
$
getResponse
r
-------------------------------------------------------------
-------------------------------------------------------------
...
...
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