Commit e088850c authored by Przemyslaw Kaminski's avatar Przemyslaw Kaminski

[list] HashResponse with md5 sum for charts (caching)

parent 594327ad
...@@ -34,6 +34,7 @@ library: ...@@ -34,6 +34,7 @@ library:
- -Wunused-binds - -Wunused-binds
- -Wunused-imports - -Wunused-imports
- -Werror - -Werror
- -freduction-depth=300
exposed-modules: exposed-modules:
- Gargantext - Gargantext
- Gargantext.API - Gargantext.API
......
This diff is collapsed.
...@@ -82,7 +82,7 @@ type NodesAPI = Delete '[JSON] Int ...@@ -82,7 +82,7 @@ type NodesAPI = Delete '[JSON] Int
-- Be careful: really delete nodes -- Be careful: really delete nodes
-- Access by admin only -- Access by admin only
nodesAPI :: [NodeId] -> GargServer NodesAPI nodesAPI :: [NodeId] -> GargServer NodesAPI
nodesAPI ids = deleteNodes ids nodesAPI = deleteNodes
------------------------------------------------------------------------ ------------------------------------------------------------------------
-- | TODO-ACCESS: access by admin only. -- | TODO-ACCESS: access by admin only.
...@@ -222,22 +222,6 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode ...@@ -222,22 +222,6 @@ nodeAPI p uId id' = withAccess (Proxy :: Proxy (NodeAPI a)) Proxy uId (PathNode
-- :<|> nodeAddAPI id' -- :<|> nodeAddAPI id'
-- :<|> postUpload id' -- :<|> postUpload id'
scatterApi :: NodeId -> GargServer ScatterAPI
scatterApi id' = getScatter id'
:<|> updateScatter id'
chartApi :: NodeId -> GargServer ChartApi
chartApi id' = getChart id'
:<|> updateChart id'
pieApi :: NodeId -> GargServer PieApi
pieApi id' = getPie id'
:<|> updatePie id'
treeApi :: NodeId -> GargServer TreeApi
treeApi id' = getTree id'
:<|> updateTree id'
------------------------------------------------------------------------ ------------------------------------------------------------------------
data RenameNode = RenameNode { r_name :: Text } data RenameNode = RenameNode { r_name :: Text }
deriving (Generic) deriving (Generic)
......
...@@ -82,15 +82,13 @@ getGraph _uId nId = do ...@@ -82,15 +82,13 @@ getGraph _uId nId = do
identity identity
$ nodeGraph ^. node_parentId $ nodeGraph ^. node_parentId
g <- case graph of case graph of
Nothing -> do Nothing -> do
graph' <- computeGraph cId NgramsTerms repo graph' <- computeGraph cId NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph') _ <- updateHyperdata nId (HyperdataGraph $ Just graph')
pure $ trace "[G.V.G.API] Graph empty, computing" $ graph' pure $ trace "[G.V.G.API] Graph empty, computing" graph'
Just graph' -> pure $ trace "[G.V.G.API] Graph exists, returning" $ graph' Just graph' -> pure $ trace "[G.V.G.API] Graph exists, returning" graph'
pure g
recomputeGraph :: UserId -> NodeId -> GargNoServer Graph recomputeGraph :: UserId -> NodeId -> GargNoServer Graph
...@@ -109,19 +107,18 @@ recomputeGraph _uId nId = do ...@@ -109,19 +107,18 @@ recomputeGraph _uId nId = do
identity identity
$ nodeGraph ^. node_parentId $ nodeGraph ^. node_parentId
g <- case graph of case graph of
Nothing -> do Nothing -> do
graph' <- computeGraph cId NgramsTerms repo graph' <- computeGraph cId NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph') _ <- updateHyperdata nId (HyperdataGraph $ Just graph')
pure $ trace "[G.V.G.API.recomputeGraph] Graph empty, computed" $ graph' pure $ trace "[G.V.G.API.recomputeGraph] Graph empty, computed" graph'
Just graph' -> if listVersion == Just v Just graph' -> if listVersion == Just v
then pure graph' then pure graph'
else do else do
graph'' <- computeGraph cId NgramsTerms repo graph'' <- computeGraph cId NgramsTerms repo
_ <- updateHyperdata nId (HyperdataGraph $ Just graph'') _ <- updateHyperdata nId (HyperdataGraph $ Just graph'')
pure $ trace "[G.V.G.API] Graph exists, recomputing" $ graph'' pure $ trace "[G.V.G.API] Graph exists, recomputing" graph''
pure g
-- TODO use Database Monad only here ? -- TODO use Database Monad only here ?
...@@ -209,7 +206,7 @@ graphVersions _uId nId = do ...@@ -209,7 +206,7 @@ graphVersions _uId nId = do
, gv_repo = v } , gv_repo = v }
recomputeVersions :: UserId -> NodeId -> GargNoServer Graph recomputeVersions :: UserId -> NodeId -> GargNoServer Graph
recomputeVersions uId nId = recomputeGraph uId nId recomputeVersions = recomputeGraph
------------------------------------------------------------ ------------------------------------------------------------
getGraphGexf :: UserId getGraphGexf :: UserId
...@@ -217,7 +214,7 @@ getGraphGexf :: UserId ...@@ -217,7 +214,7 @@ getGraphGexf :: UserId
-> GargNoServer (Headers '[Servant.Header "Content-Disposition" Text] Graph) -> GargNoServer (Headers '[Servant.Header "Content-Disposition" Text] Graph)
getGraphGexf uId nId = do getGraphGexf uId nId = do
graph <- getGraph uId nId graph <- getGraph uId nId
pure $ addHeader (concat [ "attachment; filename=graph.gexf" ]) graph pure $ addHeader "attachment; filename=graph.gexf" graph
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