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
24d97953
Commit
24d97953
authored
Nov 24, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[REST] refactor to use AffRESTError type alias
parent
79560526
Changes
49
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
248 additions
and
316 deletions
+248
-316
Category.purs
src/Gargantext/Components/Category.purs
+7
-9
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+4
-4
DocumentFormCreation.purs
...Gargantext/Components/DocsTable/DocumentFormCreation.purs
+3
-4
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+4
-4
FolderView.purs
src/Gargantext/Components/FolderView.purs
+2
-3
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-4
Add.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
+3
-3
Contact.purs
...argantext/Components/Forest/Tree/Node/Action/Contact.purs
+2
-3
Delete.purs
...Gargantext/Components/Forest/Tree/Node/Action/Delete.purs
+5
-7
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+2
-3
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+5
-8
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+8
-9
Rename.purs
...Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
+5
-8
Types.purs
...text/Components/Forest/Tree/Node/Action/Search/Types.purs
+7
-10
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+10
-12
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+8
-9
Upload.purs
...Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
+5
-5
WriteNodesDocuments.purs
...mponents/Forest/Tree/Node/Action/WriteNodesDocuments.purs
+2
-2
ProgressBar.purs
...antext/Components/Forest/Tree/Node/Tools/ProgressBar.purs
+3
-4
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+3
-5
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+2
-4
API.purs
src/Gargantext/Components/GraphExplorer/API.purs
+7
-9
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+3
-3
Endpoints.purs
src/Gargantext/Components/GraphQL/Endpoints.purs
+3
-3
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+2
-3
API.purs
src/Gargantext/Components/NgramsTable/API.purs
+2
-5
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+11
-10
Loader.purs
src/Gargantext/Components/NgramsTable/Loader.purs
+3
-3
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+3
-4
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+6
-7
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+11
-12
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+8
-8
API.purs
src/Gargantext/Components/Nodes/Corpus/Chart/API.purs
+2
-5
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+3
-5
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+6
-9
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+14
-19
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+9
-14
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+9
-12
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+3
-4
Types.purs
src/Gargantext/Components/Nodes/Dashboard/Types.purs
+4
-6
File.purs
src/Gargantext/Components/Nodes/File.purs
+2
-4
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+5
-5
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+2
-4
Score.purs
src/Gargantext/Components/Score.purs
+10
-14
REST.purs
src/Gargantext/Config/REST.purs
+9
-9
Loader.purs
src/Gargantext/Hooks/Loader.purs
+7
-7
Sessions.purs
src/Gargantext/Sessions.purs
+7
-7
Types.purs
src/Gargantext/Types.purs
+2
-3
Version.purs
src/Gargantext/Version.purs
+2
-2
No files found.
src/Gargantext/Components/Category.purs
View file @
24d97953
...
@@ -4,22 +4,20 @@ module Gargantext.Components.Category where
...
@@ -4,22 +4,20 @@ module Gargantext.Components.Category where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Map as Map
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff, launchAff)
import Effect.Aff (launchAff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Components.Category.Types (Category(..), Star(..), cat2score, categories, clickAgain, star2score, stars)
import Gargantext.Components.Category.Types (Category(..), Star(..), cat2score, categories, clickAgain, star2score, stars)
import Gargantext.Components.DocsTable.Types (DocumentsView(..), LocalCategories, LocalUserScore)
import Gargantext.Components.DocsTable.Types (DocumentsView(..), LocalCategories, LocalUserScore)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, put)
import Gargantext.Sessions (Session, put)
import Gargantext.Types (NodeID, NodeType(..))
import Gargantext.Types (NodeID, NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Category"
here = R2.here "Gargantext.Components.Category"
...
@@ -63,7 +61,7 @@ instance JSON.WriteForeign RatingQuery where
...
@@ -63,7 +61,7 @@ instance JSON.WriteForeign RatingQuery where
writeImpl (RatingQuery post) = JSON.writeImpl { ntc_nodesId: post.nodeIds
writeImpl (RatingQuery post) = JSON.writeImpl { ntc_nodesId: post.nodeIds
, ntc_category: post.rating }
, ntc_category: post.rating }
putRating :: Session -> Int -> RatingQuery -> Aff
(Either RESTError (Array Int)
)
putRating :: Session -> Int -> RatingQuery -> Aff
RESTError (Array Int
)
putRating session nodeId = put session $ ratingRoute where
putRating session nodeId = put session $ ratingRoute where
ratingRoute = NodeAPI Node (Just nodeId) "category"
ratingRoute = NodeAPI Node (Just nodeId) "category"
...
@@ -147,5 +145,5 @@ instance JSON.WriteForeign CategoryQuery where
...
@@ -147,5 +145,5 @@ instance JSON.WriteForeign CategoryQuery where
categoryRoute :: Int -> SessionRoute
categoryRoute :: Int -> SessionRoute
categoryRoute nodeId = NodeAPI Node (Just nodeId) "category"
categoryRoute nodeId = NodeAPI Node (Just nodeId) "category"
putCategories :: Session -> Int -> CategoryQuery -> Aff
(Either RESTError (Array Int)
)
putCategories :: Session -> Int -> CategoryQuery -> Aff
RESTError (Array Int
)
putCategories session nodeId = put session $ categoryRoute nodeId
putCategories session nodeId = put session $ categoryRoute nodeId
src/Gargantext/Components/DocsTable.purs
View file @
24d97953
...
@@ -34,10 +34,10 @@ import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
...
@@ -34,10 +34,10 @@ import Gargantext.Components.DocsTable.DocumentFormCreation as DFC
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), Year, sampleData, showSource)
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), Year, sampleData, showSource)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Reload (
reloadContext,
textsReloadContext)
import Gargantext.Components.Reload (textsReloadContext)
import Gargantext.Components.Table as TT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
...
@@ -339,7 +339,7 @@ type PageParams = {
...
@@ -339,7 +339,7 @@ type PageParams = {
, yearFilter :: Maybe Year
, yearFilter :: Maybe Year
}
}
getPageHash :: Session -> PageParams -> Aff
(Either RESTError String)
getPageHash :: Session -> PageParams -> Aff
RESTError String
getPageHash session { nodeId, tabType } =
getPageHash session { nodeId, tabType } =
get session $ tableHashRoute nodeId tabType
get session $ tableHashRoute nodeId tabType
...
@@ -677,7 +677,7 @@ tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchTyp
...
@@ -677,7 +677,7 @@ tableRouteWithPage { listId, nodeId, params: { limit, offset, orderBy, searchTyp
q = queryParamS "query" query
q = queryParamS "query" query
y = mQueryParam "year" yearFilter
y = mQueryParam "year" yearFilter
deleteAllDocuments :: Session -> Int -> Aff
(Either RESTError (Array Int)
)
deleteAllDocuments :: Session -> Int -> Aff
RESTError (Array Int
)
deleteAllDocuments session = delete session <<< documentsRoute
deleteAllDocuments session = delete session <<< documentsRoute
-- TODO: not optimal but Data.Set lacks some function (Set.alter)
-- TODO: not optimal but Data.Set lacks some function (Set.alter)
...
...
src/Gargantext/Components/DocsTable/DocumentFormCreation.purs
View file @
24d97953
...
@@ -11,10 +11,9 @@ import Data.Either (Either(..))
...
@@ -11,10 +11,9 @@ import Data.Either (Either(..))
import Data.Foldable (foldl, intercalate)
import Data.Foldable (foldl, intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord (useStateRecord)
...
@@ -247,7 +246,7 @@ create ::
...
@@ -247,7 +246,7 @@ create ::
Session
Session
-> GT.ID
-> GT.ID
-> Record FormData
-> Record FormData
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
create session nodeId =
create session nodeId =
rename
rename
>>> post session request
>>> post session request
...
@@ -271,7 +270,7 @@ createProgress ::
...
@@ -271,7 +270,7 @@ createProgress ::
Session
Session
-> GT.ID
-> GT.ID
-> GT.AsyncTaskWithType
-> GT.AsyncTaskWithType
-> Aff
(Either RESTError GT.AsyncProgress)
-> Aff
RESTError GT.AsyncProgress
createProgress
createProgress
session
session
nodeId
nodeId
...
...
src/Gargantext/Components/FacetsTable.purs
View file @
24d97953
...
@@ -17,7 +17,7 @@ import Data.Set as Set
...
@@ -17,7 +17,7 @@ import Data.Set as Set
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.Category (CategoryQuery(..), putCategories)
import Gargantext.Components.Category (CategoryQuery(..), putCategories)
import Gargantext.Components.Category.Types (Category(..), decodeCategory, favCategory)
import Gargantext.Components.Category.Types (Category(..), decodeCategory, favCategory)
...
@@ -25,7 +25,7 @@ import Gargantext.Components.DocsTable.Types (showSource)
...
@@ -25,7 +25,7 @@ import Gargantext.Components.DocsTable.Types (showSource)
import Gargantext.Components.Search (Contact(..), Document(..), HyperdataRowContact(..), HyperdataRowDocument(..), SearchQuery, SearchResult(..), SearchResultTypes(..))
import Gargantext.Components.Search (Contact(..), Document(..), HyperdataRowContact(..), HyperdataRowDocument(..), SearchQuery, SearchResult(..), SearchResultTypes(..))
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T
import Gargantext.Components.Table.Types as T
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Config.REST (RESTError(..)
, AffRESTError
)
import Gargantext.Ends (url, Frontends)
import Gargantext.Ends (url, Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(Search, NodeAPI))
import Gargantext.Routes (SessionRoute(Search, NodeAPI))
...
@@ -205,7 +205,7 @@ type PagePath = { nodeId :: Int
...
@@ -205,7 +205,7 @@ type PagePath = { nodeId :: Int
initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: SearchQuery} -> PagePath
initialPagePath :: {session :: Session, nodeId :: Int, listId :: Int, query :: SearchQuery} -> PagePath
initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams}
initialPagePath {session, nodeId, listId, query} = {session, nodeId, listId, query, params: T.initialParams}
loadPage :: PagePath -> Aff
(Either RESTError Rows)
loadPage :: PagePath -> Aff
RESTError Rows
loadPage { session, nodeId, listId, query, params: {limit, offset, orderBy } } = do
loadPage { session, nodeId, listId, query, params: {limit, offset, orderBy } } = do
let
let
convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc
convOrderBy (T.ASC (T.ColumnName "Date")) = DateAsc
...
@@ -404,7 +404,7 @@ derive instance Generic DeleteDocumentQuery _
...
@@ -404,7 +404,7 @@ derive instance Generic DeleteDocumentQuery _
derive instance Newtype DeleteDocumentQuery _
derive instance Newtype DeleteDocumentQuery _
derive newtype instance JSON.WriteForeign DeleteDocumentQuery
derive newtype instance JSON.WriteForeign DeleteDocumentQuery
deleteDocuments :: Session -> Int -> DeleteDocumentQuery -> Aff
(Either RESTError (Array Int)
)
deleteDocuments :: Session -> Int -> DeleteDocumentQuery -> Aff
RESTError (Array Int
)
deleteDocuments session nodeId =
deleteDocuments session nodeId =
deleteWithBody session $ NodeAPI Node (Just nodeId) "documents"
deleteWithBody session $ NodeAPI Node (Just nodeId) "documents"
src/Gargantext/Components/FolderView.purs
View file @
24d97953
module Gargantext.Components.FolderView where
module Gargantext.Components.FolderView where
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Nullable (null)
import Data.Nullable (null)
import Data.Traversable (traverse_)
import Data.Traversable (traverse_)
...
@@ -24,7 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryFile
...
@@ -24,7 +23,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadArbitraryFile
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.LinkHandler (Methods, useLinkHandler)
import Gargantext.Hooks.LinkHandler (Methods, useLinkHandler)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -262,7 +261,7 @@ type LoadProps =
...
@@ -262,7 +261,7 @@ type LoadProps =
reload :: T2.Reload
reload :: T2.Reload
)
)
loadFolders :: Record LoadProps -> Aff
(Either RESTError FTree)
loadFolders :: Record LoadProps -> Aff
RESTError FTree
loadFolders {nodeId, session} = get session $ TreeFirstLevel (Just nodeId) ""
loadFolders {nodeId, session} = get session $ TreeFirstLevel (Just nodeId) ""
type PerformActionProps =
type PerformActionProps =
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
24d97953
...
@@ -3,7 +3,6 @@ module Gargantext.Components.Forest.Tree where
...
@@ -3,7 +3,6 @@ module Gargantext.Components.Forest.Tree where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Traversable (traverse_, traverse)
import Data.Traversable (traverse_, traverse)
import Effect (Effect)
import Effect (Effect)
...
@@ -26,7 +25,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile, uploadA
...
@@ -26,7 +25,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Upload (uploadFile, uploadA
import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (documentsFromWriteNodesReq)
import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (documentsFromWriteNodesReq)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
...
@@ -124,10 +123,10 @@ treeLoaderCpt = here.component "treeLoader" cpt where
...
@@ -124,10 +123,10 @@ treeLoaderCpt = here.component "treeLoader" cpt where
extra = { reloadTree: p.reload, root, session, tree: tree' }
extra = { reloadTree: p.reload, root, session, tree: tree' }
errorHandler = logRESTError here "[treeLoader]"
errorHandler = logRESTError here "[treeLoader]"
getNodeTree :: Session -> ID -> Aff
(Either RESTError FTree)
getNodeTree :: Session -> ID -> Aff
RESTError FTree
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
getNodeTreeFirstLevel :: Session -> ID -> Aff
(Either RESTError FTree)
getNodeTreeFirstLevel :: Session -> ID -> Aff
RESTError FTree
getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nodeId) ""
getNodeTreeFirstLevel session nodeId = get session $ GR.TreeFirstLevel (Just nodeId) ""
tree :: R2.Leaf TreeProps
tree :: R2.Leaf TreeProps
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Add.purs
View file @
24d97953
...
@@ -16,7 +16,7 @@ import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), setting
...
@@ -16,7 +16,7 @@ import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), setting
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, panel, submitButton)
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, panel, submitButton)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Lang (Lang(..), translate)
import Gargantext.Components.Lang (Lang(..), translate)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, AffRESTError
)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types (NodeType(..), charCodeIcon)
import Gargantext.Types (NodeType(..), charCodeIcon)
...
@@ -34,13 +34,13 @@ import Web.HTML.Window (navigator)
...
@@ -34,13 +34,13 @@ import Web.HTML.Window (navigator)
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Add"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Add"
addNode :: Session -> GT.ID -> AddNodeValue -> Aff
(Either RESTError (Array GT.ID)
)
addNode :: Session -> GT.ID -> AddNodeValue -> Aff
RESTError (Array GT.ID
)
addNode session parentId = post session $ GR.NodeAPI GT.Node (Just parentId) ""
addNode session parentId = post session $ GR.NodeAPI GT.Node (Just parentId) ""
addNodeAsync :: Session
addNodeAsync :: Session
-> GT.ID
-> GT.ID
-> AddNodeValue
-> AddNodeValue
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
addNodeAsync session parentId q = do
addNodeAsync session parentId q = do
eTask :: Either RESTError GT.AsyncTask <- post session p q
eTask :: Either RESTError GT.AsyncTask <- post session p q
case eTask of
case eTask of
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Contact.purs
View file @
24d97953
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node.Action.Contact where
...
@@ -2,7 +2,6 @@ module Gargantext.Components.Forest.Tree.Node.Action.Contact where
import Prelude
import Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Formula as F
import Formula as F
...
@@ -12,7 +11,7 @@ import Toestand as T
...
@@ -12,7 +11,7 @@ import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams(..))
import Gargantext.Components.Forest.Tree.Node.Action.Contact.Types (AddContactParams(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types (ID)
...
@@ -22,7 +21,7 @@ import Gargantext.Utils.Reactix as R2
...
@@ -22,7 +21,7 @@ import Gargantext.Utils.Reactix as R2
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Contact"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Contact"
contactReq :: Session -> ID -> AddContactParams -> Aff
(Either RESTError ID)
contactReq :: Session -> ID -> AddContactParams -> Aff
RESTError ID
contactReq session nodeId =
contactReq session nodeId =
post session $ GR.NodeAPI GT.Annuaire (Just nodeId) "contact"
post session $ GR.NodeAPI GT.Annuaire (Just nodeId) "contact"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Delete.purs
View file @
24d97953
...
@@ -3,27 +3,25 @@ module Gargantext.Components.Forest.Tree.Node.Action.Delete
...
@@ -3,27 +3,25 @@ module Gargantext.Components.Forest.Tree.Node.Action.Delete
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, delete, put_)
import Gargantext.Sessions (Session, delete, put_)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Delete"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Delete"
-- TODO Delete with asyncTaskWithType
-- TODO Delete with asyncTaskWithType
deleteNode :: Session -> GT.ID -> Aff
(Either RESTError GT.ID)
deleteNode :: Session -> GT.ID -> Aff
RESTError GT.ID
deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
{-
{-
...
@@ -34,7 +32,7 @@ deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
...
@@ -34,7 +32,7 @@ deleteNode session nodeId = delete session $ NodeAPI GT.Node (Just nodeId) ""
-}
-}
type ParentID = GT.ID
type ParentID = GT.ID
unpublishNode :: Session -> Maybe ParentID -> GT.ID -> Aff
(Either RESTError GT.ID)
unpublishNode :: Session -> Maybe ParentID -> GT.ID -> Aff
RESTError GT.ID
unpublishNode s p n = put_ s $ NodeAPI GT.Node p ("unpublish/" <> show n)
unpublishNode s p n = put_ s $ NodeAPI GT.Node p ("unpublish/" <> show n)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
24d97953
...
@@ -6,11 +6,10 @@ import Data.Either (Either)
...
@@ -6,11 +6,10 @@ import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
AffRESTError,
RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -31,7 +30,7 @@ derive newtype instance JSON.ReadForeign LinkNodeReq
...
@@ -31,7 +30,7 @@ derive newtype instance JSON.ReadForeign LinkNodeReq
derive newtype instance JSON.WriteForeign LinkNodeReq
derive newtype instance JSON.WriteForeign LinkNodeReq
linkNodeReq :: Session -> Maybe GT.NodeType -> GT.ID -> GT.ID -> Aff
(Either RESTError GT.AsyncTaskWithType)
linkNodeReq :: Session -> Maybe GT.NodeType -> GT.ID -> GT.ID -> Aff
RESTError GT.AsyncTaskWithType
linkNodeReq session nt fromId toId = do
linkNodeReq session nt fromId toId = do
eTask :: Either RESTError GT.AsyncTask <- post session (NodeAPI GT.Node (Just fromId) "update")
eTask :: Either RESTError GT.AsyncTask <- post session (NodeAPI GT.Node (Just fromId) "update")
(LinkNodeReq { nodeType: linkNodeType nt, id: toId })
(LinkNodeReq { nodeType: linkNodeType nt, id: toId })
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
24d97953
...
@@ -2,27 +2,24 @@ module Gargantext.Components.Forest.Tree.Node.Action.Merge where
...
@@ -2,27 +2,24 @@ module Gargantext.Components.Forest.Tree.Node.Action.Merge where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Set as Set
import Data.Set as Set
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxesListGroup)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel, checkbox, checkboxesListGroup)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Sessions (Session, put_)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Merge"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Merge"
mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff
(Either RESTError (Array GT.ID)
)
mergeNodeReq :: Session -> GT.ID -> GT.ID -> Aff
RESTError (Array GT.ID
)
mergeNodeReq session fromId toId =
mergeNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("merge/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("merge/" <> show toId)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
24d97953
...
@@ -3,26 +3,25 @@ module Gargantext.Components.Forest.Tree.Node.Action.Move
...
@@ -3,26 +3,25 @@ module Gargantext.Components.Forest.Tree.Node.Action.Move
, moveNode
, moveNode
) where
) where
import Data.Either (Either)
import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (SubTreeParamsIn, subTreeView)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (SubTreeParamsIn, subTreeView)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, put_)
import Gargantext.Sessions (Session, put_)
import Gargantext.Types
as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix
as R
import Reactix as R
import Reactix.DOM.HTML
as H
import Reactix.DOM.HTML as H
import Toestand
as T
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Move"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Move"
moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff
(Either RESTError (Array GT.ID)
)
moveNodeReq :: Session -> GT.ID -> GT.ID -> Aff
RESTError (Array GT.ID
)
moveNodeReq session fromId toId =
moveNodeReq session fromId toId =
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
put_ session $ NodeAPI GT.Node (Just fromId) ("move/" <> show toId)
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Rename.purs
View file @
24d97953
module Gargantext.Components.Forest.Tree.Node.Action.Rename where
module Gargantext.Components.Forest.Tree.Node.Action.Rename where
import Data.Either (Either)
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Simple.JSON as JSON
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, put)
import Gargantext.Sessions (Session, put)
import Gargantext.Types (ID)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Simple.JSON as JSON
------------------------------------------------------------------------
------------------------------------------------------------------------
rename :: Session -> ID -> RenameValue -> Aff
(Either RESTError (Array ID)
)
rename :: Session -> ID -> RenameValue -> Aff
RESTError (Array ID
)
rename session renameNodeId =
rename session renameNodeId =
put session $ GR.NodeAPI GT.Node (Just renameNodeId) "rename"
put session $ GR.NodeAPI GT.Node (Just renameNodeId) "rename"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Search/Types.purs
View file @
24d97953
module Gargantext.Components.Forest.Tree.Node.Action.Search.Types where
module Gargantext.Components.Forest.Tree.Node.Action.Search.Types where
import Gargantext.Prelude
import Data.Array (concat)
import Data.Array (concat)
import Data.Either (Either)
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
...
@@ -10,21 +12,16 @@ import Data.Set as Set
...
@@ -10,21 +12,16 @@ import Data.Set as Set
import Data.String as String
import Data.String as String
import Data.Tuple (Tuple)
import Data.Tuple (Tuple)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Simple.JSON as JSON
import URI.Extra.QueryPairs as QP
import URI.Query as Q
import Gargantext.Prelude
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.Lang (Lang)
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
AffRESTError,
RESTError)
import Gargantext.Ends (class ToUrl, backendUrl)
import Gargantext.Ends (class ToUrl, backendUrl)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), post)
import Gargantext.Sessions (Session(..), post)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Simple.JSON as JSON
import URI.Extra.QueryPairs as QP
import URI.Query as Q
type Search = { databases :: Database
type Search = { databases :: Database
, datafield :: Maybe DataField
, datafield :: Maybe DataField
...
@@ -371,7 +368,7 @@ defaultSearchQuery = SearchQuery
...
@@ -371,7 +368,7 @@ defaultSearchQuery = SearchQuery
, selection : ListSelection.MyListsFirst
, selection : ListSelection.MyListsFirst
}
}
performSearch :: Session -> Int -> SearchQuery -> Aff
(Either RESTError GT.AsyncTaskWithType)
performSearch :: Session -> Int -> SearchQuery -> Aff
RESTError GT.AsyncTaskWithType
performSearch session nodeId q = do
performSearch session nodeId q = do
eTask :: Either RESTError GT.AsyncTask <- post session p q
eTask :: Either RESTError GT.AsyncTask <- post session p q
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.Query }) <$> eTask
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.Query }) <$> eTask
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
24d97953
module Gargantext.Components.Forest.Tree.Node.Action.Share where
module Gargantext.Components.Forest.Tree.Node.Action.Share where
import Data.Either (Either)
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Types as Action
import Gargantext.Components.Forest.Tree.Node.Action.Types as Action
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.Forest.Tree.Node.Tools as Tools
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree (subTreeView, SubTreeParamsIn)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types (ID)
import Gargantext.Types (ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.SimpleJSON as GUSJ
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.SimpleJSON as GUSJ
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Share"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Share"
------------------------------------------------------------------------
------------------------------------------------------------------------
shareReq :: Session -> ID -> ShareNodeParams -> Aff
(Either RESTError ID)
shareReq :: Session -> ID -> ShareNodeParams -> Aff
RESTError ID
shareReq session nodeId =
shareReq session nodeId =
post session $ GR.NodeAPI GT.Node (Just nodeId) "share"
post session $ GR.NodeAPI GT.Node (Just nodeId) "share"
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
24d97953
module Gargantext.Components.Forest.Tree.Node.Action.Update where
module Gargantext.Components.Forest.Tree.Node.Action.Update where
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types
import Gargantext.Prelude
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Update.Types
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, submitButton, panel)
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, submitButton, panel)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, AffRESTError
)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types (NodeType(..), ID)
import Gargantext.Types (NodeType(..), ID)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Update"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Update"
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff
(Either RESTError GT.AsyncTaskWithType)
updateRequest :: UpdateNodeParams -> Session -> ID -> Aff
RESTError GT.AsyncTaskWithType
updateRequest updateNodeParams session nodeId = do
updateRequest updateNodeParams session nodeId = do
eTask :: Either RESTError GT.AsyncTask <- post session p updateNodeParams
eTask :: Either RESTError GT.AsyncTask <- post session p updateNodeParams
case eTask of
case eTask of
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Upload.purs
View file @
24d97953
...
@@ -23,7 +23,7 @@ import Gargantext.Components.Lang (Lang(..))
...
@@ -23,7 +23,7 @@ import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection as ListSelection
import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types (Selection(..))
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Components.ListSelection.Types as ListSelection
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
AffRESTError,
RESTError)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Sessions (Session, postWwwUrlencoded, post)
import Gargantext.Types (ID, NodeType(..))
import Gargantext.Types (ID, NodeType(..))
...
@@ -355,7 +355,7 @@ uploadFile :: { contents :: String
...
@@ -355,7 +355,7 @@ uploadFile :: { contents :: String
, mName :: Maybe String
, mName :: Maybe String
, selection :: ListSelection.Selection
, selection :: ListSelection.Selection
, session :: Session }
, session :: Session }
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
{-
{-
uploadFile session NodeList id JSON { mName, contents } = do
uploadFile session NodeList id JSON { mName, contents } = do
let url = GR.NodeAPI NodeList (Just id) $ GT.asyncTaskTypePath GT.ListUpload
let url = GR.NodeAPI NodeList (Just id) $ GT.asyncTaskTypePath GT.ListUpload
...
@@ -394,7 +394,7 @@ uploadArbitraryFile :: Session
...
@@ -394,7 +394,7 @@ uploadArbitraryFile :: Session
-> ID
-> ID
-> {blob :: UploadFileBlob, mName :: Maybe String}
-> {blob :: UploadFileBlob, mName :: Maybe String}
-> ListSelection.Selection
-> ListSelection.Selection
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
uploadArbitraryFile session id {mName, blob: UploadFileBlob blob} selection = do
uploadArbitraryFile session id {mName, blob: UploadFileBlob blob} selection = do
contents <- readAsDataURL blob
contents <- readAsDataURL blob
uploadArbitraryData session id mName contents
uploadArbitraryData session id mName contents
...
@@ -403,7 +403,7 @@ uploadArbitraryData :: Session
...
@@ -403,7 +403,7 @@ uploadArbitraryData :: Session
-> ID
-> ID
-> Maybe String
-> Maybe String
-> String
-> String
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
uploadArbitraryData session id mName contents' = do
uploadArbitraryData session id mName contents' = do
let re = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ DSR.regex "data:.*;base64," DSRF.noFlags
let re = fromRight' (\_ -> unsafeCrashWith "Unexpected Left") $ DSR.regex "data:.*;base64," DSRF.noFlags
contents = DSR.replace re "" contents'
contents = DSR.replace re "" contents'
...
@@ -544,7 +544,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
...
@@ -544,7 +544,7 @@ uploadFrameCalcViewCpt = here.component "uploadFrameCalcView" cpt
uploadFrameCalc :: Session
uploadFrameCalc :: Session
-> ID
-> ID
-> Aff
(Either RESTError GT.AsyncTaskWithType)
-> Aff
RESTError GT.AsyncTaskWithType
uploadFrameCalc session id = do
uploadFrameCalc session id = do
let p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFrameCalc
let p = GR.NodeAPI GT.Node (Just id) $ GT.asyncTaskTypePath GT.UploadFrameCalc
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/WriteNodesDocuments.purs
View file @
24d97953
...
@@ -8,7 +8,7 @@ import Effect.Aff (Aff)
...
@@ -8,7 +8,7 @@ import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (panel, submitButton)
import Gargantext.Components.Forest.Tree.Node.Tools (panel, submitButton)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
AffRESTError,
RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -43,7 +43,7 @@ actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt wh
...
@@ -43,7 +43,7 @@ actionWriteNodesDocumentsCpt = here.component "actionWriteNodesDocuments" cpt wh
pure $ panel bodies (submitButton (DocumentsFromWriteNodes { id }) dispatch)
pure $ panel bodies (submitButton (DocumentsFromWriteNodes { id }) dispatch)
documentsFromWriteNodesReq :: Session -> GT.ID -> Aff
(Either RESTError GT.AsyncTaskWithType)
documentsFromWriteNodesReq :: Session -> GT.ID -> Aff
RESTError GT.AsyncTaskWithType
documentsFromWriteNodesReq session id = do
documentsFromWriteNodesReq session id = do
eTask :: Either RESTError GT.AsyncTask <-
eTask :: Either RESTError GT.AsyncTask <-
post session (NodeAPI GT.Node (Just id) "documents-from-write-nodes") { id }
post session (NodeAPI GT.Node (Just id) "documents-from-write-nodes") { id }
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/ProgressBar.purs
View file @
24d97953
...
@@ -2,14 +2,13 @@ module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where
...
@@ -2,14 +2,13 @@ module Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Int (fromNumber)
import Data.Int (fromNumber)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Timer (clearInterval, setInterval)
import Effect.Timer (clearInterval, setInterval)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Config.Utils (handleErrorInAsyncProgress, handleRESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -109,7 +108,7 @@ progressIndicatorCpt = here.component "progressIndicator" cpt
...
@@ -109,7 +108,7 @@ progressIndicatorCpt = here.component "progressIndicator" cpt
Nothing -> 0
Nothing -> 0
Just x -> x
Just x -> x
queryProgress :: Record Props -> Aff
(Either RESTError GT.AsyncProgress)
queryProgress :: Record Props -> Aff
RESTError GT.AsyncProgress
queryProgress { asyncTask: GT.AsyncTaskWithType { task: GT.AsyncTask {id}
queryProgress { asyncTask: GT.AsyncTaskWithType { task: GT.AsyncTask {id}
, typ
, typ
}
}
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
24d97953
...
@@ -4,18 +4,16 @@ import Gargantext.Prelude
...
@@ -4,18 +4,16 @@ import Gargantext.Prelude
import Data.Array (length)
import Data.Array (length)
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Props, subTreeOut, setTreeOut)
import Gargantext.Components.Forest.Tree.Node.Action (Props, subTreeOut, setTreeOut)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
import Gargantext.Components.Forest.Tree.Node.Tools (nodeText)
import Gargantext.Components.Forest.Tree.Node.Tools (nodeText)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
import Gargantext.Sessions (Session(..), get)
...
@@ -76,12 +74,12 @@ subTreeViewCpt = here.component "subTreeView" cpt
...
@@ -76,12 +74,12 @@ subTreeViewCpt = here.component "subTreeView" cpt
where
where
errorHandler = logRESTError here "[subTreeView]"
errorHandler = logRESTError here "[subTreeView]"
loadSubTree :: Array GT.NodeType -> Session -> Aff
(Either RESTError FTree)
loadSubTree :: Array GT.NodeType -> Session -> Aff
RESTError FTree
loadSubTree nodetypes session = getSubTree session treeId nodetypes
loadSubTree nodetypes session = getSubTree session treeId nodetypes
where
where
Session { treeId } = session
Session { treeId } = session
getSubTree :: Session -> Int -> Array GT.NodeType -> Aff
(Either RESTError FTree)
getSubTree :: Session -> Int -> Array GT.NodeType -> Aff
RESTError FTree
getSubTree session treeId showtypes = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
getSubTree session treeId showtypes = get session $ GR.NodeAPI GT.Tree (Just treeId) nodeTypes
where
where
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
nodeTypes = A.foldl (\a b -> a <> "type=" <> show b <> "&") "?" showtypes
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
24d97953
...
@@ -4,7 +4,6 @@ import Gargantext.Prelude hiding (max, min)
...
@@ -4,7 +4,6 @@ import Gargantext.Prelude hiding (max, min)
import DOM.Simple.Types (Element)
import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.FoldableWithIndex (foldMapWithIndex)
import Data.FoldableWithIndex (foldMapWithIndex)
import Data.Int (toNumber)
import Data.Int (toNumber)
import Data.Map as Map
import Data.Map as Map
...
@@ -13,13 +12,12 @@ import Data.Nullable (null, Nullable)
...
@@ -13,13 +12,12 @@ import Data.Nullable (null, Nullable)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Graph as Graph
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Controls as Controls
import Gargantext.Components.GraphExplorer.Controls as Controls
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Data.Louvain as Louvain
import Gargantext.Data.Louvain as Louvain
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
...
@@ -294,7 +292,7 @@ modeGraphType Types.Sources = "star"
...
@@ -294,7 +292,7 @@ modeGraphType Types.Sources = "star"
modeGraphType Types.Terms = "def"
modeGraphType Types.Terms = "def"
getNodes :: Session -> T2.Reload -> GET.GraphId -> Aff
(Either RESTError GET.HyperdataGraph)
getNodes :: Session -> T2.Reload -> GET.GraphId -> Aff
RESTError GET.HyperdataGraph
getNodes session graphVersion graphId =
getNodes session graphVersion graphId =
get session $ NodeAPI Types.Graph
get session $ NodeAPI Types.Graph
(Just graphId)
(Just graphId)
...
...
src/Gargantext/Components/GraphExplorer/API.purs
View file @
24d97953
...
@@ -2,12 +2,10 @@ module Gargantext.Components.GraphExplorer.API where
...
@@ -2,12 +2,10 @@ module Gargantext.Components.GraphExplorer.API where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Effect.Aff (Aff)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, get, post)
import Gargantext.Sessions (Session, get, post)
...
@@ -22,7 +20,7 @@ type GraphAsyncUpdateParams =
...
@@ -22,7 +20,7 @@ type GraphAsyncUpdateParams =
, version :: NTC.Version
, version :: NTC.Version
)
)
graphAsyncUpdate :: Record GraphAsyncUpdateParams -> Aff
(Either RESTError GT.AsyncTaskWithType)
graphAsyncUpdate :: Record GraphAsyncUpdateParams -> Aff
RESTError GT.AsyncTaskWithType
graphAsyncUpdate { graphId, listId, nodes, session, termList, version } = do
graphAsyncUpdate { graphId, listId, nodes, session, termList, version } = do
eTask <- post session p q
eTask <- post session p q
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.GraphRecompute }) <$> eTask
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.GraphRecompute }) <$> eTask
...
@@ -39,7 +37,7 @@ type GraphAsyncRecomputeParams =
...
@@ -39,7 +37,7 @@ type GraphAsyncRecomputeParams =
, session :: Session
, session :: Session
)
)
graphAsyncRecompute :: Record GraphAsyncRecomputeParams -> Aff
(Either RESTError GT.AsyncTaskWithType)
graphAsyncRecompute :: Record GraphAsyncRecomputeParams -> Aff
RESTError GT.AsyncTaskWithType
graphAsyncRecompute { graphId, session } = do
graphAsyncRecompute { graphId, session } = do
eTask <- post session p q
eTask <- post session p q
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.GraphRecompute }) <$> eTask
pure $ (\task -> GT.AsyncTaskWithType { task, typ: GT.GraphRecompute }) <$> eTask
...
@@ -53,7 +51,7 @@ type QueryProgressParams =
...
@@ -53,7 +51,7 @@ type QueryProgressParams =
, taskId :: String
, taskId :: String
)
)
queryProgress :: Record QueryProgressParams -> Aff
(Either RESTError GT.AsyncProgress)
queryProgress :: Record QueryProgressParams -> Aff
RESTError GT.AsyncProgress
queryProgress { graphId, session, taskId } = do
queryProgress { graphId, session, taskId } = do
get session $ GR.GraphAPI graphId $ "async/" <> taskId <> "/poll"
get session $ GR.GraphAPI graphId $ "async/" <> taskId <> "/poll"
...
@@ -67,7 +65,7 @@ type GraphVersionsParams =
...
@@ -67,7 +65,7 @@ type GraphVersionsParams =
, session :: Session
, session :: Session
)
)
graphVersions :: Record GraphVersionsParams -> Aff
(Either RESTError (Record GraphVersions)
)
graphVersions :: Record GraphVersionsParams -> Aff
RESTError (Record GraphVersions
)
graphVersions { graphId, session } = get session $ GR.GraphAPI graphId $ "versions"
graphVersions { graphId, session } = get session $ GR.GraphAPI graphId $ "versions"
type UpdateGraphVersionsParams =
type UpdateGraphVersionsParams =
...
@@ -75,7 +73,7 @@ type UpdateGraphVersionsParams =
...
@@ -75,7 +73,7 @@ type UpdateGraphVersionsParams =
, session :: Session
, session :: Session
)
)
updateGraphVersions :: Record UpdateGraphVersionsParams -> Aff
(Either RESTError GET.GraphData)
updateGraphVersions :: Record UpdateGraphVersionsParams -> Aff
RESTError GET.GraphData
updateGraphVersions { graphId, session } = post session (GR.GraphAPI graphId $ "versions") {}
updateGraphVersions { graphId, session } = post session (GR.GraphAPI graphId $ "versions") {}
type CloneGraphParams =
type CloneGraphParams =
...
@@ -84,5 +82,5 @@ type CloneGraphParams =
...
@@ -84,5 +82,5 @@ type CloneGraphParams =
, session :: Session
, session :: Session
)
)
cloneGraph :: Record CloneGraphParams -> Aff
(Either RESTError Int)
cloneGraph :: Record CloneGraphParams -> Aff
RESTError Int
cloneGraph { hyperdataGraph, id, session } = post session (GR.GraphAPI id $ "clone") hyperdataGraph
cloneGraph { hyperdataGraph, id, session } = post session (GR.GraphAPI id $ "clone") hyperdataGraph
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
24d97953
...
@@ -15,7 +15,7 @@ import Data.Maybe (Maybe(..), fromJust)
...
@@ -15,7 +15,7 @@ import Data.Maybe (Maybe(..), fromJust)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Set as Set
import Data.Set as Set
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphExplorer.Legend as Legend
import Gargantext.Components.GraphExplorer.Legend as Legend
...
@@ -26,7 +26,7 @@ import Gargantext.Components.NgramsTable.Core as NTC
...
@@ -26,7 +26,7 @@ import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Graph.Tabs (tabs) as CGT
import Gargantext.Components.Nodes.Corpus.Graph.Tabs (tabs) as CGT
import Gargantext.Components.RandomText (words)
import Gargantext.Components.RandomText (words)
import Gargantext.Components.Search (SearchType(..), SearchQuery(..))
import Gargantext.Components.Search (SearchType(..), SearchQuery(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Data.Array (mapMaybe)
import Gargantext.Data.Array (mapMaybe)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
import Gargantext.Hooks.Sigmax.Types as SigmaxT
...
@@ -375,7 +375,7 @@ sendPatch :: TermList
...
@@ -375,7 +375,7 @@ sendPatch :: TermList
-> Session
-> Session
-> GET.MetaData
-> GET.MetaData
-> Record SigmaxT.Node
-> Record SigmaxT.Node
-> Aff
(Either RESTError NTC.VersionedNgramsPatches)
-> Aff
RESTError NTC.VersionedNgramsPatches
sendPatch termList session (GET.MetaData metaData) node = do
sendPatch termList session (GET.MetaData metaData) node = do
eRet <- NTC.putNgramsPatches coreParams versioned
eRet <- NTC.putNgramsPatches coreParams versioned
case eRet of
case eRet of
...
...
src/Gargantext/Components/GraphQL/Endpoints.purs
View file @
24d97953
...
@@ -8,10 +8,10 @@ import Effect.Class (liftEffect)
...
@@ -8,10 +8,10 @@ import Effect.Class (liftEffect)
import Gargantext.Components.GraphQL (queryGql)
import Gargantext.Components.GraphQL (queryGql)
import Gargantext.Components.GraphQL.Node
import Gargantext.Components.GraphQL.Node
import Gargantext.Components.GraphQL.User
import Gargantext.Components.GraphQL.User
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Config.REST (
AffRESTError,
RESTError(..))
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (NodeType
(..)
)
import Gargantext.Types (NodeType)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import GraphQL.Client.Variables (withVars)
import GraphQL.Client.Variables (withVars)
...
@@ -26,7 +26,7 @@ getNodeParent session nodeId parentType = do
...
@@ -26,7 +26,7 @@ getNodeParent session nodeId parentType = do
liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
liftEffect $ here.log2 "[getNodeParent] node_parent" node_parent
pure $ node_parent
pure $ node_parent
getUserInfo :: Session -> Int -> Aff
(Either RESTError UserInfo)
getUserInfo :: Session -> Int -> Aff
RESTError UserInfo
getUserInfo session id = do
getUserInfo session id = do
{ user_infos } <- queryGql session "get user infos" $ userInfoQuery `withVars` { id }
{ user_infos } <- queryGql session "get user infos" $ userInfoQuery `withVars` { id }
liftEffect $ here.log2 "[getUserInfo] user infos" user_infos
liftEffect $ here.log2 "[getUserInfo] user infos" user_infos
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
24d97953
...
@@ -27,14 +27,13 @@ import Data.Tuple.Nested ((/\))
...
@@ -27,14 +27,13 @@ import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Versioned(..), VersionedNgramsTable, VersionedWithCountNgramsTable, _NgramsElement, _NgramsRepoElement, _NgramsTable, _children, _list, _ngrams, _ngrams_repo_elements, _ngrams_scores, _occurrences, _root, addNewNgramA, applyNgramsPatches, applyPatchSet, chartsAfterSync, commitPatch, convOrderBy, coreDispatch, filterTermSize, fromNgramsPatches, ngramsRepoElementToNgramsElement, ngramsTermText, normNgram, patchSetFromMap, replace, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoaderBox)
import Gargantext.Hooks.Loader (useLoaderBox)
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -633,7 +632,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
...
@@ -633,7 +632,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
errorHandler = logRESTError here "[mainNgramsTable]"
errorHandler = logRESTError here "[mainNgramsTable]"
-- NOTE With cache off
-- NOTE With cache off
loader :: PageParams -> Aff
(Either RESTError VersionedWithCountNgramsTable)
loader :: PageParams -> Aff
RESTError VersionedWithCountNgramsTable
loader { listIds
loader { listIds
, nodeId
, nodeId
, params: { limit, offset }
, params: { limit, offset }
...
...
src/Gargantext/Components/NgramsTable/API.purs
View file @
24d97953
module Gargantext.Components.NgramsTable.API where
module Gargantext.Components.NgramsTable.API where
import Data.Either (Either)
import Gargantext.Config.REST (AffRESTError)
import Effect.Aff (Aff)
import Gargantext.Config.REST (RESTError)
import Gargantext.Routes as GR
import Gargantext.Routes as GR
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as GT
import Gargantext.Types as GT
...
@@ -16,6 +13,6 @@ type UpdateNodeListParams =
...
@@ -16,6 +13,6 @@ type UpdateNodeListParams =
, session :: Session
, session :: Session
)
)
updateNodeList :: Record UpdateNodeListParams -> Aff
(Either RESTError Int)
updateNodeList :: Record UpdateNodeListParams -> Aff
RESTError Int
updateNodeList { listId, nodeId, nodeType, session } =
updateNodeList { listId, nodeId, nodeType, session } =
post session (GR.RecomputeNgrams nodeType nodeId listId) {}
post session (GR.RecomputeNgrams nodeType nodeId listId) {}
src/Gargantext/Components/NgramsTable/Core.purs
View file @
24d97953
...
@@ -79,6 +79,8 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -79,6 +79,8 @@ module Gargantext.Components.NgramsTable.Core
)
)
where
where
import Gargantext.Prelude
import Control.Monad.State (class MonadState, execState)
import Control.Monad.State (class MonadState, execState)
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Data.Array (head)
import Data.Array (head)
...
@@ -125,23 +127,22 @@ import Effect.Exception.Unsafe (unsafeThrow)
...
@@ -125,23 +127,22 @@ import Effect.Exception.Unsafe (unsafeThrow)
import FFI.Simple.Functions (delay)
import FFI.Simple.Functions (delay)
import Foreign as F
import Foreign as F
import Foreign.Object as FO
import Foreign.Object as FO
import Reactix (Component, Element, createElement) as R
import Reactix.DOM.HTML as H
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T
import Gargantext.Components.Table.Types as T
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, AffRESTError
)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, post, put)
import Gargantext.Sessions (Session, get, post, put)
import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), FrontendError, ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..))
import Gargantext.Types (AsyncTask, AsyncTaskType(..), AsyncTaskWithType(..), CTabNgramType(..), FrontendError, ListId, OrderBy(..), ScoreType(..), TabSubType(..), TabType(..), TermList(..), TermSize(..))
import Gargantext.Utils.Either (eitherMap)
import Gargantext.Utils.Either (eitherMap)
import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.KarpRabin (indicesOfAny)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Reactix (Component, Element, createElement) as R
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Simple.JSON as JSON
import Toestand as T
import Toestand as T
...
@@ -903,7 +904,7 @@ setTermListP ngram patch_list = singletonNgramsTablePatch ngram pe
...
@@ -903,7 +904,7 @@ setTermListP ngram patch_list = singletonNgramsTablePatch ngram pe
setTermListA :: NgramsTerm -> Replace TermList -> CoreAction
setTermListA :: NgramsTerm -> Replace TermList -> CoreAction
setTermListA ngram termList = CommitPatch $ setTermListP ngram termList
setTermListA ngram termList = CommitPatch $ setTermListP ngram termList
putNgramsPatches :: forall s. CoreParams s -> VersionedNgramsPatches -> Aff
(Either RESTError VersionedNgramsPatches)
putNgramsPatches :: forall s. CoreParams s -> VersionedNgramsPatches -> Aff
RESTError VersionedNgramsPatches
putNgramsPatches { listIds, nodeId, session, tabType } = put session putNgrams
putNgramsPatches { listIds, nodeId, session, tabType } = put session putNgrams
where putNgrams = PutNgrams tabType (head listIds) Nothing (Just nodeId)
where putNgrams = PutNgrams tabType (head listIds) Nothing (Just nodeId)
...
@@ -967,7 +968,7 @@ commitPatch tablePatch state = do
...
@@ -967,7 +968,7 @@ commitPatch tablePatch state = do
T.modify_ (\s -> s { ngramsLocalPatch = tablePatch <> s.ngramsLocalPatch }) state
T.modify_ (\s -> s { ngramsLocalPatch = tablePatch <> s.ngramsLocalPatch }) state
-- First we apply the patches we have locally and then the new patch (tablePatch).
-- First we apply the patches we have locally and then the new patch (tablePatch).
loadNgramsTable :: PageParams -> Aff
(Either RESTError VersionedNgramsTable)
loadNgramsTable :: PageParams -> Aff
RESTError VersionedNgramsTable
loadNgramsTable
loadNgramsTable
{ nodeId
{ nodeId
, listIds
, listIds
...
@@ -988,7 +989,7 @@ loadNgramsTable
...
@@ -988,7 +989,7 @@ loadNgramsTable
type NgramsListByTabType = Map TabType VersionedNgramsTable
type NgramsListByTabType = Map TabType VersionedNgramsTable
loadNgramsTableAll :: PageParams -> Aff
(Either RESTError NgramsListByTabType)
loadNgramsTableAll :: PageParams -> Aff
RESTError NgramsListByTabType
loadNgramsTableAll { nodeId, listIds, session } = do
loadNgramsTableAll { nodeId, listIds, session } = do
let
let
cTagNgramTypes =
cTagNgramTypes =
...
@@ -1127,7 +1128,7 @@ chartsAfterSync path'@{ nodeId } errors tasks _ = do
...
@@ -1127,7 +1128,7 @@ chartsAfterSync path'@{ nodeId } errors tasks _ = do
log2 "[chartsAfterSync] Synchronize task" task
log2 "[chartsAfterSync] Synchronize task" task
GAT.insert nodeId task tasks
GAT.insert nodeId task tasks
postNgramsChartsAsync :: forall s. CoreParams s -> Aff
(Either RESTError AsyncTaskWithType)
postNgramsChartsAsync :: forall s. CoreParams s -> Aff
RESTError AsyncTaskWithType
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
postNgramsChartsAsync { listIds, nodeId, session, tabType } = do
eTask :: Either RESTError AsyncTask <- post session putNgramsAsync acu
eTask :: Either RESTError AsyncTask <- post session putNgramsAsync acu
pure $ (\task -> AsyncTaskWithType { task, typ: UpdateNgramsCharts }) <$> eTask
pure $ (\task -> AsyncTaskWithType { task, typ: UpdateNgramsCharts }) <$> eTask
...
...
src/Gargantext/Components/NgramsTable/Loader.purs
View file @
24d97953
...
@@ -11,7 +11,7 @@ import Effect.Class (liftEffect)
...
@@ -11,7 +11,7 @@ import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.NgramsTable.Core (Version, Versioned(..))
import Gargantext.Components.NgramsTable.Core (Version, Versioned(..))
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Config.REST (RESTError(..)
, AffRESTError
)
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Reactix as R
import Reactix as R
import Simple.JSON as JSON
import Simple.JSON as JSON
...
@@ -26,7 +26,7 @@ clearCache _ = GUC.delete $ GUC.CacheName cacheName
...
@@ -26,7 +26,7 @@ clearCache _ = GUC.delete $ GUC.CacheName cacheName
type LoaderWithCacheAPIProps path res ret = (
type LoaderWithCacheAPIProps path res ret = (
cacheEndpoint :: path -> Aff
(Either RESTError Version)
cacheEndpoint :: path -> Aff
RESTError Version
, errorHandler :: RESTError -> Effect Unit
, errorHandler :: RESTError -> Effect Unit
, handleResponse :: Versioned res -> ret
, handleResponse :: Versioned res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
...
@@ -51,7 +51,7 @@ useLoaderWithCacheAPI { cacheEndpoint, errorHandler, handleResponse, mkRequest,
...
@@ -51,7 +51,7 @@ useLoaderWithCacheAPI { cacheEndpoint, errorHandler, handleResponse, mkRequest,
pure $ maybe (loadingSpinner {}) renderer state'
pure $ maybe (loadingSpinner {}) renderer state'
type LoaderWithCacheAPIEffectProps path res ret = (
type LoaderWithCacheAPIEffectProps path res ret = (
cacheEndpoint :: path -> Aff
(Either RESTError Version)
cacheEndpoint :: path -> Aff
RESTError Version
, errorHandler :: RESTError -> Effect Unit
, errorHandler :: RESTError -> Effect Unit
, handleResponse :: Versioned res -> ret
, handleResponse :: Versioned res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
24d97953
...
@@ -5,20 +5,19 @@ module Gargantext.Components.Nodes.Annuaire
...
@@ -5,20 +5,19 @@ module Gargantext.Components.Nodes.Annuaire
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Sequence as Seq
import Data.Sequence as Seq
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types as CT
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types as CT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table (defaultContainer, initialParams, makeRow, table, tableHeaderLayout) as TT
import Gargantext.Components.Table (defaultContainer, initialParams, makeRow, table, tableHeaderLayout) as TT
import Gargantext.Components.Table.Types (ColumnName(..), Params) as TT
import Gargantext.Components.Table.Types (ColumnName(..), Params) as TT
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Ends (url, Frontends)
import Gargantext.Ends (url, Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
...
@@ -293,6 +292,6 @@ loadPage session {nodeId, params: { offset, limit }} =
...
@@ -293,6 +292,6 @@ loadPage session {nodeId, params: { offset, limit }} =
where
where
children = Children NodeContact offset limit Nothing {-(convOrderBy <$> orderBy)-} (Just nodeId)
children = Children NodeContact offset limit Nothing {-(convOrderBy <$> orderBy)-} (Just nodeId)
getAnnuaireInfo :: Session -> Int -> Aff
(Either RESTError AnnuaireInfo)
getAnnuaireInfo :: Session -> Int -> Aff
RESTError AnnuaireInfo
getAnnuaireInfo session id = get session (NodeAPI Node (Just id) "")
getAnnuaireInfo session id = get session (NodeAPI Node (Just id) "")
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
24d97953
...
@@ -7,10 +7,9 @@ module Gargantext.Components.Nodes.Annuaire.User
...
@@ -7,10 +7,9 @@ module Gargantext.Components.Nodes.Annuaire.User
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphQL.User (UserInfo)
import Gargantext.Components.GraphQL.User (UserInfo)
...
@@ -18,13 +17,13 @@ import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
...
@@ -18,13 +17,13 @@ import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contact (getUserInfoWithReload, saveUserInfo, contactInfos)
import Gargantext.Components.Nodes.Annuaire.User.Contact (getUserInfoWithReload, saveUserInfo, contactInfos)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (Contact(..), ContactData, ContactTouch(..), ContactWhere(..), ContactWho(..), HyperdataContact(..), HyperdataUser(..), _city, _country, _firstName, _labTeamDeptsJoinComma, _lastName, _mail, _office, _organizationJoinComma, _ouFirst, _phone, _role, _shared, _touch, _who, defaultContactTouch, defaultContactWhere, defaultContactWho, defaultHyperdataContact, defaultHyperdataUser)
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (
RESTError,
logRESTError)
import Gargantext.Config.REST (logRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (WithSession, WithSessionContext,
Session, get, put,
sessionId)
import Gargantext.Sessions (WithSession, WithSessionContext, sessionId)
import Gargantext.Types (FrontendError
, NodeType(..)
)
import Gargantext.Types (FrontendError)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix as R
...
@@ -131,11 +130,11 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
...
@@ -131,11 +130,11 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
handleRESTError errors res $ \_ ->
handleRESTError errors res $ \_ ->
liftEffect $ T2.reload reload
liftEffect $ T2.reload reload
--saveContactHyperdata :: Session -> Int -> HyperdataUser -> Aff
(Either RESTError Int)
--saveContactHyperdata :: Session -> Int -> HyperdataUser -> Aff
RESTError Int
--saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
--saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
-- | toUrl to get data XXX
-- | toUrl to get data XXX
--getContact :: Session -> Int -> Aff
(Either RESTError ContactData)
--getContact :: Session -> Int -> Aff
RESTError ContactData
--getContact session id = do
--getContact session id = do
-- eContactNode <- get session $ Routes.NodeAPI Node (Just id) ""
-- eContactNode <- get session $ Routes.NodeAPI Node (Just id) ""
-- -- TODO: we need a default list for the pairings
-- -- TODO: we need a default list for the pairings
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
24d97953
...
@@ -7,34 +7,33 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact
...
@@ -7,34 +7,33 @@ module Gargantext.Components.Nodes.Annuaire.User.Contact
, saveUserInfo
, saveUserInfo
) where
) where
import Affjax.RequestBody (RequestBody(..))
import Gargantext.Components.GraphQL.User
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Lens as L
import Data.Lens as L
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphQL (getClient
, queryGql
)
import Gargantext.Components.GraphQL (getClient)
import Gargantext.Components.GraphQL.Endpoints (getUserInfo)
import Gargantext.Components.GraphQL.Endpoints (getUserInfo)
import Gargantext.Components.GraphQL.User
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData', HyperdataContact(..))
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types (ContactData', HyperdataContact(..))
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Config.REST (
RESTError(..)
, logRESTError)
import Gargantext.Config.REST (
AffRESTError
, logRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import GraphQL.Client.Args (IgnoreArg(..), OrArg(..), onlyArgs)
import GraphQL.Client.Args (IgnoreArg(..), OrArg(..), onlyArgs)
import GraphQL.Client.Query (mutationOpts, mutation)
import GraphQL.Client.Query (mutationOpts)
import GraphQL.Client.Variables (withVars)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Record as Record
...
@@ -193,10 +192,10 @@ type KeyLayoutProps =
...
@@ -193,10 +192,10 @@ type KeyLayoutProps =
, session :: Session
, session :: Session
| ReloadProps )
| ReloadProps )
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff
(Either RESTError Int)
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff
RESTError Int
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveUserInfo :: Session -> Int -> UserInfo ->
Aff (Either RESTError Int)
saveUserInfo :: Session -> Int -> UserInfo ->
AffRESTError Int
saveUserInfo session id ui = do
saveUserInfo session id ui = do
client <- liftEffect $ getClient session
client <- liftEffect $ getClient session
res <- mutationOpts
res <- mutationOpts
...
@@ -272,7 +271,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
...
@@ -272,7 +271,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
_ <- saveUserInfo session nodeId ui
_ <- saveUserInfo session nodeId ui
liftEffect (T2.reload reload)
liftEffect (T2.reload reload)
getAnnuaireContact :: Session -> Int -> Int -> Aff
(Either RESTError ContactData')
getAnnuaireContact :: Session -> Int -> Int -> Aff
RESTError ContactData'
getAnnuaireContact session annuaireId id = do
getAnnuaireContact session annuaireId id = do
eContactNode <- get session $ Routes.NodeAPI Annuaire (Just annuaireId) $ show id
eContactNode <- get session $ Routes.NodeAPI Annuaire (Just annuaireId) $ show id
-- TODO: we need a default list for the pairings
-- TODO: we need a default list for the pairings
...
@@ -287,5 +286,5 @@ getAnnuaireContact session annuaireId id = do
...
@@ -287,5 +286,5 @@ getAnnuaireContact session annuaireId id = do
getUserInfoWithReload :: { nodeId :: Int
getUserInfoWithReload :: { nodeId :: Int
, reload :: T2.Reload
, reload :: T2.Reload
, session :: Session} -> Aff
(Either RESTError UserInfo)
, session :: Session} -> Aff
RESTError UserInfo
getUserInfoWithReload {nodeId, session} = getUserInfo session nodeId -- getContact session nodeId
getUserInfoWithReload {nodeId, session} = getUserInfo session nodeId -- getContact session nodeId
src/Gargantext/Components/Nodes/Corpus.purs
View file @
24d97953
...
@@ -8,7 +8,7 @@ import Data.List as List
...
@@ -8,7 +8,7 @@ import Data.List as List
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (
Aff,
throwError)
import Effect.Aff (throwError)
import Effect.Exception (error)
import Effect.Exception (error)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.CodeEditor as CE
...
@@ -18,7 +18,7 @@ import Gargantext.Components.Node (NodePoly(..), HyperdataList)
...
@@ -18,7 +18,7 @@ import Gargantext.Components.Node (NodePoly(..), HyperdataList)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData, Hyperdata)
import Gargantext.Components.Nodes.Types (FTField, FTFieldWithIndex, FTFieldsWithIndex(..), Field(..), FieldType(..), Hash, Index, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Components.Nodes.Types (FTField, FTFieldWithIndex, FTFieldsWithIndex(..), Field(..), FieldType(..), Hash, Index, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Components.TileMenu (tileMenu)
import Gargantext.Components.TileMenu (tileMenu)
import Gargantext.Config.REST (RESTError(..))
import Gargantext.Config.REST (RESTError(..)
, AffRESTError
)
import Gargantext.Data.Array as GDA
import Gargantext.Data.Array as GDA
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (<>), const, (<<<), (+), (==), (-), (<), (>), (<$>))
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (<>), const, (<<<), (+), (==), (-), (<), (>), (<$>))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
...
@@ -363,11 +363,11 @@ type LoadProps =
...
@@ -363,11 +363,11 @@ type LoadProps =
, session :: Session
, session :: Session
)
)
loadCorpus' :: Record LoadProps -> Aff
(Either RESTError (NodePoly Hyperdata)
)
loadCorpus' :: Record LoadProps -> Aff
RESTError (NodePoly Hyperdata
)
loadCorpus' {nodeId, session} = get session $ NodeAPI Corpus (Just nodeId) ""
loadCorpus' {nodeId, session} = get session $ NodeAPI Corpus (Just nodeId) ""
-- Just to make reloading effective
-- Just to make reloading effective
loadCorpusWithReload :: { reload :: T2.Reload | LoadProps } -> Aff
(Either RESTError (NodePoly Hyperdata)
)
loadCorpusWithReload :: { reload :: T2.Reload | LoadProps } -> Aff
RESTError (NodePoly Hyperdata
)
loadCorpusWithReload {nodeId, session} = loadCorpus' {nodeId, session}
loadCorpusWithReload {nodeId, session} = loadCorpus' {nodeId, session}
type SaveProps = (
type SaveProps = (
...
@@ -375,11 +375,11 @@ type SaveProps = (
...
@@ -375,11 +375,11 @@ type SaveProps = (
| LoadProps
| LoadProps
)
)
saveCorpus :: Record SaveProps -> Aff
(Either RESTError Int)
saveCorpus :: Record SaveProps -> Aff
RESTError Int
saveCorpus {hyperdata, nodeId, session} = do
saveCorpus {hyperdata, nodeId, session} = do
put session (NodeAPI Corpus (Just nodeId) "") hyperdata
put session (NodeAPI Corpus (Just nodeId) "") hyperdata
loadCorpus :: Record LoadProps -> Aff
(Either RESTError CorpusData)
loadCorpus :: Record LoadProps -> Aff
RESTError CorpusData
loadCorpus {nodeId, session} = do
loadCorpus {nodeId, session} = do
-- fetch corpus via lists parentId
-- fetch corpus via lists parentId
res <- get session nodePolyRoute
res <- get session nodePolyRoute
...
@@ -416,7 +416,7 @@ loadCorpus {nodeId, session} = do
...
@@ -416,7 +416,7 @@ loadCorpus {nodeId, session} = do
defaultListIdsRoute = Children NodeList 0 1 Nothing <<< Just
defaultListIdsRoute = Children NodeList 0 1 Nothing <<< Just
loadCorpusWithChild :: Record LoadProps -> Aff
(Either RESTError CorpusData)
loadCorpusWithChild :: Record LoadProps -> Aff
RESTError CorpusData
loadCorpusWithChild { nodeId: childId, session } = do
loadCorpusWithChild { nodeId: childId, session } = do
-- fetch corpus via lists parentId
-- fetch corpus via lists parentId
eListNode <- get session $ listNodeRoute childId ""
eListNode <- get session $ listNodeRoute childId ""
...
@@ -452,7 +452,7 @@ type LoadWithReloadProps =
...
@@ -452,7 +452,7 @@ type LoadWithReloadProps =
-- Just to make reloading effective
-- Just to make reloading effective
loadCorpusWithChildAndReload :: Record LoadWithReloadProps -> Aff
(Either RESTError CorpusData)
loadCorpusWithChildAndReload :: Record LoadWithReloadProps -> Aff
RESTError CorpusData
loadCorpusWithChildAndReload {nodeId, session} = loadCorpusWithChild {nodeId, session}
loadCorpusWithChildAndReload {nodeId, session} = loadCorpusWithChild {nodeId, session}
data ViewType = Code | Folders
data ViewType = Code | Folders
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/API.purs
View file @
24d97953
module Gargantext.Components.Nodes.Corpus.Chart.API where
module Gargantext.Components.Nodes.Corpus.Chart.API where
import Data.Either (Either)
import Gargantext.Config.REST (AffRESTError)
import Effect.Aff (Aff)
import Gargantext.Config.REST (RESTError)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, post)
import Gargantext.Sessions (Session, post)
import Gargantext.Types as T
import Gargantext.Types as T
recomputeChart :: Session -> T.ChartType -> T.CTabNgramType -> Int -> Int -> Aff
(Either RESTError (Array Int)
)
recomputeChart :: Session -> T.ChartType -> T.CTabNgramType -> Int -> Int -> Aff
RESTError (Array Int
)
recomputeChart session chartType ngramType corpusId listId =
recomputeChart session chartType ngramType corpusId listId =
post session (RecomputeListChart chartType ngramType corpusId listId) {}
post session (RecomputeListChart chartType ngramType corpusId listId) {}
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
24d97953
...
@@ -3,11 +3,9 @@ module Gargantext.Components.Nodes.Corpus.Chart.Common where
...
@@ -3,11 +3,9 @@ module Gargantext.Components.Nodes.Corpus.Chart.Common where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, ReloadPath)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Hooks.Loader (HashedResponse, useLoader, useLoaderWithCacheAPI)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (FrontendError(..))
import Gargantext.Types (FrontendError(..))
...
@@ -22,7 +20,7 @@ here :: R2.Here
...
@@ -22,7 +20,7 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Common"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Common"
type MetricsLoadViewProps a = (
type MetricsLoadViewProps a = (
getMetrics :: Session -> ReloadPath -> Aff
(Either RESTError a)
getMetrics :: Session -> ReloadPath -> Aff
RESTError a
, loaded :: Record MetricsProps -> a -> R.Element
, loaded :: Record MetricsProps -> a -> R.Element
| MetricsProps
| MetricsProps
)
)
...
@@ -55,7 +53,7 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
...
@@ -55,7 +53,7 @@ metricsLoadViewCpt = here.component "metricsLoadView" cpt
here.log2 "RESTError" error
here.log2 "RESTError" error
type MetricsWithCacheLoadViewProps res ret =
type MetricsWithCacheLoadViewProps res ret =
( getMetricsHash :: Session -> ReloadPath -> Aff
(Either RESTError Hash)
( getMetricsHash :: Session -> ReloadPath -> Aff
RESTError Hash
, handleResponse :: HashedResponse res -> ret
, handleResponse :: HashedResponse res -> ret
, loaded :: Record MetricsProps -> ret -> R.Element
, loaded :: Record MetricsProps -> ret -> R.Element
, mkRequest :: ReloadPath -> GUC.Request
, mkRequest :: ReloadPath -> GUC.Request
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
24d97953
module Gargantext.Components.Nodes.Corpus.Chart.Histo where
module Gargantext.Components.Nodes.Corpus.Chart.Histo where
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Components.Charts.Options.Color (grey, blue)
import Gargantext.Components.Charts.Options.Color (grey, blue)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
...
@@ -19,7 +12,7 @@ import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, template
...
@@ -19,7 +12,7 @@ import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, template
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Charts.Options.Series (seriesBarD1)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==))
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
...
@@ -28,6 +21,10 @@ import Gargantext.Types (ChartType(..))
...
@@ -28,6 +21,10 @@ import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Histo"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Histo"
...
@@ -76,7 +73,7 @@ chartOptions { onClick, onInit } (HistoMetrics { dates: dates', count: count'})
...
@@ -76,7 +73,7 @@ chartOptions { onClick, onInit } (HistoMetrics { dates: dates', count: count'})
map mapSeriesBar count'
map mapSeriesBar count'
]
]
getMetricsHash :: Session -> ReloadPath -> Aff
(Either RESTError String)
getMetricsHash :: Session -> ReloadPath -> Aff
RESTError String
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
get session $ ChartHash { chartType: Histo, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: Histo, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
24d97953
module Gargantext.Components.Nodes.Corpus.Chart.Metrics where
module Gargantext.Components.Nodes.Corpus.Chart.Metrics where
import Data.Generic.Rep (class Generic)
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.
Map as Map
import Data.
Generic.Rep (class Generic)
import Data.Map (Map)
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Prelude (class Eq, bind, negate, pure, ($), (<$>), (<>))
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, yAxis')
import Gargantext.Components.Charts.Options.Type (xAxis)
import Gargantext.Components.Charts.Options.Series (Series, seriesScatterD2)
import Gargantext.Components.Charts.Options.Color (green, grey, red)
import Gargantext.Components.Charts.Options.Color (green, grey, red)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, yAxis')
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Series (Series, seriesScatterD2)
import Gargantext.Components.Charts.Options.Type (xAxis)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
(MetricsProps, Path, Props, ReloadPath)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Config.REST (RESTError)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude (class Eq, bind, negate, pure, ($), (<$>), (<>))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (TermList(..))
import Gargantext.Types (TermList(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Metrics"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Metrics"
...
@@ -95,7 +90,7 @@ scatterOptions { onClick, onInit } metrics' = Options
...
@@ -95,7 +90,7 @@ scatterOptions { onClick, onInit } metrics' = Options
}
}
--}
--}
getMetricsHash :: Session -> ReloadPath -> Aff
(Either RESTError String)
getMetricsHash :: Session -> ReloadPath -> Aff
RESTError String
getMetricsHash session (_ /\ { corpusId, listId, tabType }) =
getMetricsHash session (_ /\ { corpusId, listId, tabType }) =
get session $ CorpusMetricsHash { listId, tabType } (Just corpusId)
get session $ CorpusMetricsHash { listId, tabType } (Just corpusId)
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
24d97953
...
@@ -2,38 +2,33 @@ module Gargantext.Components.Nodes.Corpus.Chart.Pie where
...
@@ -2,38 +2,33 @@ module Gargantext.Components.Nodes.Corpus.Chart.Pie where
import Data.Array (zip, filter)
import Data.Array (zip, filter)
import Data.Array as A
import Data.Array as A
import Data.Generic.Rep (class Generic)
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.String (take, joinWith, Pattern(..), split, length)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==), (>))
import Gargantext.Components.Charts.Options.Color (blue)
import Gargantext.Components.Charts.Options.Color (blue)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.Data (dataSerie)
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (itemStyle, mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Series (seriesBarD1, seriesPieD1)
import Gargantext.Components.Charts.Options.Series (seriesBarD1, seriesPieD1)
import Gargantext.Config.REST (RESTError)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types
import Gargantext.Components.Nodes.Corpus.Chart.Types
(MetricsProps, Path, Props, ReloadPath)
(MetricsProps, Path, Props, ReloadPath
)
import Gargantext.Config.REST (AffRESTError
)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Prelude (class Eq, bind, map, pure, ($), (==), (>))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (ChartType(..))
import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Pie"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Pie"
...
@@ -84,7 +79,7 @@ chartOptionsPie { onClick, onInit } (HistoMetrics { dates: dates', count: count'
...
@@ -84,7 +79,7 @@ chartOptionsPie { onClick, onInit } (HistoMetrics { dates: dates', count: count'
, onInit
, onInit
}
}
getMetricsHash :: Session -> ReloadPath -> Aff
(Either RESTError String)
getMetricsHash :: Session -> ReloadPath -> Aff
RESTError String
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
get session $ ChartHash { chartType: ChartPie, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: ChartPie, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
24d97953
module Gargantext.Components.Nodes.Corpus.Chart.Tree where
module Gargantext.Components.Nodes.Corpus.Chart.Tree where
import Data.Either (Either)
import Gargantext.Prelude
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.ECharts (Options(..), chart, xAxis', yAxis')
import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Font (mkTooltip, templateFormatter)
import Gargantext.Components.Charts.Options.Series (TreeNode, Trees(..), mkTree)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Common (metricsWithCacheLoadView)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Components.Nodes.Corpus.Chart.Types (MetricsProps, Path, Props, ReloadPath)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Hooks.Loader (HashedResponse(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
...
@@ -26,6 +19,10 @@ import Gargantext.Types (ChartType(..))
...
@@ -26,6 +19,10 @@ import Gargantext.Types (ChartType(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Tree"
here = R2.here "Gargantext.Components.Nodes.Corpus.Chart.Tree"
...
@@ -56,7 +53,7 @@ scatterOptions { onClick, onInit } nodes = Options
...
@@ -56,7 +53,7 @@ scatterOptions { onClick, onInit } nodes = Options
}
}
getMetricsHash :: Session -> ReloadPath -> Aff
(Either RESTError String)
getMetricsHash :: Session -> ReloadPath -> Aff
RESTError String
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
getMetricsHash session (_ /\ { corpusId, listId, tabType }) = do
get session $ ChartHash { chartType: ChartTree, listId: mListId, tabType } (Just corpusId)
get session $ ChartHash { chartType: ChartTree, listId: mListId, tabType } (Just corpusId)
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
24d97953
...
@@ -2,14 +2,13 @@ module Gargantext.Components.Nodes.Corpus.Document where
...
@@ -2,14 +2,13 @@ module Gargantext.Components.Nodes.Corpus.Document where
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Effect.Aff (Aff)
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Components.AutoUpdate (autoUpdate)
import Gargantext.Components.AutoUpdate (autoUpdate)
import Gargantext.Components.NgramsTable.Core (CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable, replace, setTermListA, syncResetButtons, findNgramRoot)
import Gargantext.Components.NgramsTable.Core (CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable, replace, setTermListA, syncResetButtons, findNgramRoot)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus.Document.Types (DocPath, Document(..), LoadedData, NodeDocument, Props, State, initialState)
import Gargantext.Components.Nodes.Corpus.Document.Types (DocPath, Document(..), LoadedData, NodeDocument, Props, State, initialState)
import Gargantext.Components.Search (SearchType(..))
import Gargantext.Components.Search (SearchType(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>), (<$>), (<<<))
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>), (<$>), (<<<))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
...
@@ -155,10 +154,10 @@ documentLayoutWithKeyCpt = here.component "documentLayoutWithKey" cpt
...
@@ -155,10 +154,10 @@ documentLayoutWithKeyCpt = here.component "documentLayoutWithKey" cpt
------------------------------------------------------------------------
------------------------------------------------------------------------
loadDocument :: Session -> Int -> Aff
(Either RESTError NodeDocument)
loadDocument :: Session -> Int -> Aff
RESTError NodeDocument
loadDocument session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadDocument session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadData :: DocPath -> Aff
(Either RESTError LoadedData)
loadData :: DocPath -> Aff
RESTError LoadedData
loadData { listIds, nodeId, session, tabType } = do
loadData { listIds, nodeId, session, tabType } = do
eDocument <- loadDocument session nodeId
eDocument <- loadDocument session nodeId
case eDocument of
case eDocument of
...
...
src/Gargantext/Components/Nodes/Dashboard/Types.purs
View file @
24d97953
...
@@ -2,15 +2,13 @@ module Gargantext.Components.Nodes.Dashboard.Types where
...
@@ -2,15 +2,13 @@ module Gargantext.Components.Nodes.Dashboard.Types where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Types (FTFieldList)
import Gargantext.Components.Nodes.Types (FTFieldList)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (
Aff
RESTError)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, put)
import Gargantext.Sessions (Session, get, put)
import Gargantext.Types (NodeType(..))
import Gargantext.Types (NodeType(..))
...
@@ -40,16 +38,16 @@ instance Eq Hyperdata where
...
@@ -40,16 +38,16 @@ instance Eq Hyperdata where
type LoadProps = ( nodeId :: Int, session :: Session )
type LoadProps = ( nodeId :: Int, session :: Session )
loadDashboard' :: Record LoadProps -> Aff
(Either RESTError DashboardData)
loadDashboard' :: Record LoadProps -> Aff
RESTError DashboardData
loadDashboard' {nodeId, session} = get session $ NodeAPI Node (Just nodeId) ""
loadDashboard' {nodeId, session} = get session $ NodeAPI Node (Just nodeId) ""
-- Just to make reloading effective
-- Just to make reloading effective
loadDashboardWithReload :: {reload :: Int | LoadProps} -> Aff
(Either RESTError DashboardData)
loadDashboardWithReload :: {reload :: Int | LoadProps} -> Aff
RESTError DashboardData
loadDashboardWithReload {nodeId, session} = loadDashboard' {nodeId, session}
loadDashboardWithReload {nodeId, session} = loadDashboard' {nodeId, session}
type SaveProps = ( hyperdata :: Hyperdata | LoadProps )
type SaveProps = ( hyperdata :: Hyperdata | LoadProps )
saveDashboard :: Record SaveProps -> Aff
(Either RESTError Int)
saveDashboard :: Record SaveProps -> Aff
RESTError Int
saveDashboard {hyperdata, nodeId, session} = do
saveDashboard {hyperdata, nodeId, session} = do
put session (NodeAPI Node (Just nodeId) "") hyperdata
put session (NodeAPI Node (Just nodeId) "") hyperdata
...
...
src/Gargantext/Components/Nodes/File.purs
View file @
24d97953
...
@@ -2,13 +2,11 @@ module Gargantext.Components.Nodes.File where
...
@@ -2,13 +2,11 @@ module Gargantext.Components.Nodes.File where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Gargantext.Config.REST (AffRESTError, logRESTError)
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Ends (toUrl)
import Gargantext.Ends (toUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Routes (SessionRoute(..))
...
@@ -62,7 +60,7 @@ fileLayoutCpt = here.component "fileLayout" cpt where
...
@@ -62,7 +60,7 @@ fileLayoutCpt = here.component "fileLayout" cpt where
errorHandler = logRESTError here "[fileLayout]"
errorHandler = logRESTError here "[fileLayout]"
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session }
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session }
loadFile :: Session -> NodeID -> Aff
(Either RESTError File)
loadFile :: Session -> NodeID -> Aff
RESTError File
loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) ""
loadFile session nodeId = get session $ NodeAPI Node (Just nodeId) ""
type FileLayoutLoadedProps =
type FileLayoutLoadedProps =
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
24d97953
...
@@ -2,8 +2,8 @@ module Gargantext.Components.Nodes.Frame where
...
@@ -2,8 +2,8 @@ module Gargantext.Components.Nodes.Frame where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import DOM.Simple as DOM
import DOM.Simple as DOM
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
...
@@ -12,13 +12,13 @@ import Data.Newtype (class Newtype)
...
@@ -12,13 +12,13 @@ import Data.Newtype (class Newtype)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.FolderView as FV
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..))
import Gargantext.Components.GraphQL.Endpoints (getNodeParent)
import Gargantext.Components.GraphQL.Endpoints (getNodeParent)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Config.REST (RESTError,
AffRESTError,
logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes as GR
import Gargantext.Routes as GR
...
@@ -199,9 +199,9 @@ type ReloadProps = ( nodeId :: Int
...
@@ -199,9 +199,9 @@ type ReloadProps = ( nodeId :: Int
, reload :: T2.Reload
, reload :: T2.Reload
, session :: Session )
, session :: Session )
loadframe' :: Record LoadProps -> Aff
(Either RESTError (NodePoly Hyperdata)
)
loadframe' :: Record LoadProps -> Aff
RESTError (NodePoly Hyperdata
)
loadframe' { nodeId, session } = get session $ NodeAPI Node (Just nodeId) ""
loadframe' { nodeId, session } = get session $ NodeAPI Node (Just nodeId) ""
-- Just to make reloading effective
-- Just to make reloading effective
loadframeWithReload :: Record ReloadProps -> Aff
(Either RESTError (NodePoly Hyperdata)
)
loadframeWithReload :: Record ReloadProps -> Aff
RESTError (NodePoly Hyperdata
)
loadframeWithReload { nodeId, session } = loadframe' { nodeId, session }
loadframeWithReload { nodeId, session } = loadframe' { nodeId, session }
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
24d97953
...
@@ -2,14 +2,12 @@ module Gargantext.Components.Nodes.Home.Public where
...
@@ -2,14 +2,12 @@ module Gargantext.Components.Nodes.Home.Public where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.String (take)
import Data.String (take)
import Effect.Aff (Aff)
import Gargantext.Config (publicBackend)
import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (RESTError, get, logRESTError)
import Gargantext.Config.REST (
Aff
RESTError, get, logRESTError)
import Gargantext.Ends (backendUrl)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -45,7 +43,7 @@ type LoadData = ()
...
@@ -45,7 +43,7 @@ type LoadData = ()
type LoadProps = (reload :: Int)
type LoadProps = (reload :: Int)
-- | WIP still finding the right way to chose the default public backend
-- | WIP still finding the right way to chose the default public backend
loadPublicData :: Record LoadProps -> Aff
(Either RESTError (Array PublicData)
)
loadPublicData :: Record LoadProps -> Aff
RESTError (Array PublicData
)
loadPublicData _l = do
loadPublicData _l = do
-- This solution is error prone (url needs to be cleaned)
-- This solution is error prone (url needs to be cleaned)
--backend <- liftEffect public
--backend <- liftEffect public
...
...
src/Gargantext/Components/Score.purs
View file @
24d97953
module Gargantext.Components.Score where
module Gargantext.Components.Score where
import Data.Argonaut (class DecodeJson, class EncodeJson, decodeJson, jsonEmptyObject, (.:), (:=), (~>), encodeJson)
import Data.Int (fromString)
import Data.Either (Either)
import Data.Maybe (Maybe(..), maybe)
import DOM.Simple.Console (log2)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Prelude
import Gargantext.Prelude
import Gargantext.Config.REST (RESTError)
import Data.Int (fromString)
import Data.Maybe (Maybe(..))
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Config.REST (AffRESTError)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session,
sessionId, get, delete,
put)
import Gargantext.Sessions (Session, put)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Array as GUA
import Gargantext.Utils.Array as GUA
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as GUT
import Gargantext.Utils.Toestand as GUT
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
type Score = Int
type Score = Int
type DocID = Int
type DocID = Int
...
@@ -79,7 +75,7 @@ instance JSON.WriteForeign ScoreQuery where
...
@@ -79,7 +75,7 @@ instance JSON.WriteForeign ScoreQuery where
writeImpl (ScoreQuery post) = JSON.writeImpl { nts_nodesId: post.nodeIds
writeImpl (ScoreQuery post) = JSON.writeImpl { nts_nodesId: post.nodeIds
, nts_score: post.score }
, nts_score: post.score }
putScore :: Session -> GT.NodeID -> ScoreQuery -> Aff
(Either RESTError (Array Int)
)
putScore :: Session -> GT.NodeID -> ScoreQuery -> Aff
RESTError (Array Int
)
putScore session nodeId = put session $ scoreRoute nodeId
putScore session nodeId = put session $ scoreRoute nodeId
where
where
scoreRoute :: GT.NodeID -> SessionRoute
scoreRoute :: GT.NodeID -> SessionRoute
...
...
src/Gargantext/Config/REST.purs
View file @
24d97953
...
@@ -73,7 +73,7 @@ readJSON affResp =
...
@@ -73,7 +73,7 @@ readJSON affResp =
-- TODO too much duplicate code in `postWwwUrlencoded`
-- TODO too much duplicate code in `postWwwUrlencoded`
send :: forall body res. JSON.WriteForeign body => JSON.ReadForeign res =>
send :: forall body res. JSON.WriteForeign body => JSON.ReadForeign res =>
Method -> Maybe Token -> String -> Maybe body -> Aff
(Either RESTError res)
Method -> Maybe Token -> String -> Maybe body -> Aff
RESTError res
send m mtoken url reqbody = do
send m mtoken url reqbody = do
let req = defaultRequest
let req = defaultRequest
{ url = url
{ url = url
...
@@ -99,30 +99,30 @@ noReqBody :: Maybe String
...
@@ -99,30 +99,30 @@ noReqBody :: Maybe String
noReqBody = Just ""
noReqBody = Just ""
--noReqBody = Nothing
--noReqBody = Nothing
get :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
(Either RESTError a)
get :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
RESTError a
get mtoken url = send GET mtoken url noReqBody
get mtoken url = send GET mtoken url noReqBody
put :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
(Either RESTError b)
put :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
RESTError b
put mtoken url = send PUT mtoken url <<< Just
put mtoken url = send PUT mtoken url <<< Just
put_ :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
(Either RESTError a)
put_ :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
RESTError a
put_ mtoken url = send PUT mtoken url noReqBody
put_ mtoken url = send PUT mtoken url noReqBody
delete :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
(Either RESTError a)
delete :: forall a. JSON.ReadForeign a => Maybe Token -> String -> Aff
RESTError a
delete mtoken url = send DELETE mtoken url noReqBody
delete mtoken url = send DELETE mtoken url noReqBody
-- This might not be a good idea:
-- This might not be a good idea:
-- https://stackoverflow.com/questions/14323716/restful-alternatives-to-delete-request-body
-- https://stackoverflow.com/questions/14323716/restful-alternatives-to-delete-request-body
deleteWithBody :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
(Either RESTError b)
deleteWithBody :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
RESTError b
deleteWithBody mtoken url = send DELETE mtoken url <<< Just
deleteWithBody mtoken url = send DELETE mtoken url <<< Just
post :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
(Either RESTError b)
post :: forall a b. JSON.WriteForeign a => JSON.ReadForeign b => Maybe Token -> String -> a -> Aff
RESTError b
post mtoken url = send POST mtoken url <<< Just
post mtoken url = send POST mtoken url <<< Just
type FormDataParams = Array (Tuple String (Maybe String))
type FormDataParams = Array (Tuple String (Maybe String))
-- TODO too much duplicate code with `send`
-- TODO too much duplicate code with `send`
postWwwUrlencoded :: forall b. JSON.ReadForeign b => Maybe Token -> String -> FormDataParams -> Aff
(Either RESTError b)
postWwwUrlencoded :: forall b. JSON.ReadForeign b => Maybe Token -> String -> FormDataParams -> Aff
RESTError b
postWwwUrlencoded mtoken url bodyParams = do
postWwwUrlencoded mtoken url bodyParams = do
affResp <- request $ defaultRequest
affResp <- request $ defaultRequest
{ url = url
{ url = url
...
@@ -140,7 +140,7 @@ postWwwUrlencoded mtoken url bodyParams = do
...
@@ -140,7 +140,7 @@ postWwwUrlencoded mtoken url bodyParams = do
where
where
urlEncodedBody = FormURLEncoded.fromArray bodyParams
urlEncodedBody = FormURLEncoded.fromArray bodyParams
postMultipartFormData :: forall b. JSON.ReadForeign b => Maybe Token -> String -> String -> Aff
(Either RESTError b)
postMultipartFormData :: forall b. JSON.ReadForeign b => Maybe Token -> String -> String -> Aff
RESTError b
postMultipartFormData mtoken url body = do
postMultipartFormData mtoken url body = do
fd <- liftEffect $ XHRFormData.new
fd <- liftEffect $ XHRFormData.new
_ <- liftEffect $ XHRFormData.append (XHRFormData.EntryName "body") body fd
_ <- liftEffect $ XHRFormData.append (XHRFormData.EntryName "body") body fd
...
...
src/Gargantext/Hooks/Loader.purs
View file @
24d97953
...
@@ -13,7 +13,7 @@ import Effect.Class (liftEffect)
...
@@ -13,7 +13,7 @@ import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Components.LoadingSpinner (loadingSpinner)
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, AffRESTError
)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Types (FrontendError(..))
import Gargantext.Types (FrontendError(..))
import Gargantext.Utils.CacheAPI as GUC
import Gargantext.Utils.CacheAPI as GUC
...
@@ -34,7 +34,7 @@ clearCache _ = GUC.delete $ GUC.CacheName cacheName
...
@@ -34,7 +34,7 @@ clearCache _ = GUC.delete $ GUC.CacheName cacheName
type UseLoader path state =
type UseLoader path state =
( errorHandler :: RESTError -> Effect Unit
( errorHandler :: RESTError -> Effect Unit
, loader :: path -> Aff
(Either RESTError state)
, loader :: path -> Aff
RESTError state
, path :: path
, path :: path
, render :: state -> R.Element
, render :: state -> R.Element
)
)
...
@@ -66,7 +66,7 @@ loaderCpt = here.component "loader" cpt
...
@@ -66,7 +66,7 @@ loaderCpt = here.component "loader" cpt
type UseLoaderEffect path state =
type UseLoaderEffect path state =
( errorHandler :: RESTError -> Effect Unit
( errorHandler :: RESTError -> Effect Unit
, loader :: path -> Aff
(Either RESTError state)
, loader :: path -> Aff
RESTError state
, path :: path
, path :: path
, state :: T.Box (Maybe state)
, state :: T.Box (Maybe state)
)
)
...
@@ -93,7 +93,7 @@ useLoaderEffect { errorHandler, loader: loader', path, state } = do
...
@@ -93,7 +93,7 @@ useLoaderEffect { errorHandler, loader: loader', path, state } = do
type UseLoaderBox path state =
type UseLoaderBox path state =
( errorHandler :: RESTError -> Effect Unit
( errorHandler :: RESTError -> Effect Unit
, loader :: path -> Aff
(Either RESTError state)
, loader :: path -> Aff
RESTError state
, path :: T.Box path
, path :: T.Box path
, render :: state -> R.Element
, render :: state -> R.Element
)
)
...
@@ -110,7 +110,7 @@ useLoaderBox { errorHandler, loader: loader', path, render } = do
...
@@ -110,7 +110,7 @@ useLoaderBox { errorHandler, loader: loader', path, render } = do
type UseLoaderBoxEffect path state =
type UseLoaderBoxEffect path state =
( errorHandler :: RESTError -> Effect Unit
( errorHandler :: RESTError -> Effect Unit
, loader :: path -> Aff
(Either RESTError state)
, loader :: path -> Aff
RESTError state
, path :: T.Box path
, path :: T.Box path
, state :: T.Box (Maybe state)
, state :: T.Box (Maybe state)
)
)
...
@@ -137,7 +137,7 @@ derive newtype instance JSON.WriteForeign a => JSON.WriteForeign (HashedResponse
...
@@ -137,7 +137,7 @@ derive newtype instance JSON.WriteForeign a => JSON.WriteForeign (HashedResponse
type LoaderWithCacheAPIProps path res ret =
type LoaderWithCacheAPIProps path res ret =
( boxes :: Boxes
( boxes :: Boxes
, cacheEndpoint :: path -> Aff
(Either RESTError Hash)
, cacheEndpoint :: path -> Aff
RESTError Hash
, handleResponse :: HashedResponse res -> ret
, handleResponse :: HashedResponse res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
, path :: path
, path :: path
...
@@ -167,7 +167,7 @@ useLoaderWithCacheAPI { boxes
...
@@ -167,7 +167,7 @@ useLoaderWithCacheAPI { boxes
type LoaderWithCacheAPIEffectProps path res ret = (
type LoaderWithCacheAPIEffectProps path res ret = (
boxes :: Boxes
boxes :: Boxes
, cacheEndpoint :: path -> Aff
(Either RESTError Hash)
, cacheEndpoint :: path -> Aff
RESTError Hash
, handleResponse :: HashedResponse res -> ret
, handleResponse :: HashedResponse res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
, path :: path
, path :: path
...
...
src/Gargantext/Sessions.purs
View file @
24d97953
...
@@ -122,30 +122,30 @@ postAuthRequest backend ar@(AuthRequest {username}) =
...
@@ -122,30 +122,30 @@ postAuthRequest backend ar@(AuthRequest {username}) =
| otherwise = Left "Invalid response from server"
| otherwise = Left "Invalid response from server"
get :: forall a p. JSON.ReadForeign a => ToUrl Session p =>
get :: forall a p. JSON.ReadForeign a => ToUrl Session p =>
Session -> p ->
Aff (Either REST.RESTError a)
Session -> p ->
REST.AffRESTError a
get session@(Session {token}) p = REST.get (Just token) (toUrl session p)
get session@(Session {token}) p = REST.get (Just token) (toUrl session p)
put :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
put :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
Session -> p -> a ->
Aff (Either REST.RESTError b)
Session -> p -> a ->
REST.AffRESTError b
put session@(Session {token}) p = REST.put (Just token) (toUrl session p)
put session@(Session {token}) p = REST.put (Just token) (toUrl session p)
put_ :: forall b p. JSON.ReadForeign b => ToUrl Session p => Session -> p ->
Aff (Either REST.RESTError b)
put_ :: forall b p. JSON.ReadForeign b => ToUrl Session p => Session -> p ->
REST.AffRESTError b
put_ session@(Session {token}) p = REST.put_ (Just token) (toUrl session p)
put_ session@(Session {token}) p = REST.put_ (Just token) (toUrl session p)
delete :: forall a p. JSON.ReadForeign a => ToUrl Session p =>
delete :: forall a p. JSON.ReadForeign a => ToUrl Session p =>
Session -> p ->
Aff (Either REST.RESTError a)
Session -> p ->
REST.AffRESTError a
delete session@(Session {token}) p = REST.delete (Just token) (toUrl session p)
delete session@(Session {token}) p = REST.delete (Just token) (toUrl session p)
-- This might not be a good idea:
-- This might not be a good idea:
-- https://stackoverflow.com/questions/14323716/restful-alternatives-to-delete-request-body
-- https://stackoverflow.com/questions/14323716/restful-alternatives-to-delete-request-body
deleteWithBody :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
deleteWithBody :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
Session -> p -> a ->
Aff (Either REST.RESTError b)
Session -> p -> a ->
REST.AffRESTError b
deleteWithBody session@(Session {token}) p = REST.deleteWithBody (Just token) (toUrl session p)
deleteWithBody session@(Session {token}) p = REST.deleteWithBody (Just token) (toUrl session p)
post :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
post :: forall a b p. JSON.WriteForeign a => JSON.ReadForeign b => ToUrl Session p =>
Session -> p -> a ->
Aff (Either REST.RESTError b)
Session -> p -> a ->
REST.AffRESTError b
post session@(Session {token}) p = REST.post (Just token) (toUrl session p)
post session@(Session {token}) p = REST.post (Just token) (toUrl session p)
postWwwUrlencoded :: forall b p. JSON.ReadForeign b => ToUrl Session p =>
postWwwUrlencoded :: forall b p. JSON.ReadForeign b => ToUrl Session p =>
Session -> p -> REST.FormDataParams ->
Aff (Either REST.RESTError b)
Session -> p -> REST.FormDataParams ->
REST.AffRESTError b
postWwwUrlencoded session@(Session {token}) p = REST.postWwwUrlencoded (Just token) (toUrl session p)
postWwwUrlencoded session@(Session {token}) p = REST.postWwwUrlencoded (Just token) (toUrl session p)
src/Gargantext/Types.purs
View file @
24d97953
...
@@ -3,7 +3,6 @@ module Gargantext.Types where
...
@@ -3,7 +3,6 @@ module Gargantext.Types where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Generic.Rep (class Generic)
import Data.Int (toNumber)
import Data.Int (toNumber)
...
@@ -15,7 +14,7 @@ import Data.String as S
...
@@ -15,7 +14,7 @@ import Data.String as S
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Foreign as F
import Foreign as F
import Gargantext.Components.Lang (class Translate, Lang(..))
import Gargantext.Components.Lang (class Translate, Lang(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, AffRESTError
)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import Gargantext.Utils.Glyphicon (classNamePrefix, glyphiconToCharCode)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Args (class ArgGql)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
import GraphQL.Client.Variables.TypeName (class VarTypeName)
...
@@ -629,7 +628,7 @@ instance DecodeJson TabType where
...
@@ -629,7 +628,7 @@ instance DecodeJson TabType where
type TableResult a = {count :: Int, docs :: Array a}
type TableResult a = {count :: Int, docs :: Array a}
type AffTableResult a = Aff (TableResult a)
type AffTableResult a = Aff (TableResult a)
type AffETableResult a = Aff
(Either RESTError (TableResult a)
)
type AffETableResult a = Aff
RESTError (TableResult a
)
data Mode = Authors
data Mode = Authors
| Sources
| Sources
...
...
src/Gargantext/Version.purs
View file @
24d97953
...
@@ -5,7 +5,7 @@ import Prelude
...
@@ -5,7 +5,7 @@ import Prelude
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (
Aff,
launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
...
@@ -24,7 +24,7 @@ type Version = String
...
@@ -24,7 +24,7 @@ type Version = String
foreign import version :: Version
foreign import version :: Version
getBackendVersion :: Session ->
Aff (Either REST.RESTError Version)
getBackendVersion :: Session ->
REST.AffRESTError Version
getBackendVersion (Session { backend }) = REST.get Nothing (toUrl backend "version")
getBackendVersion (Session { backend }) = REST.get Nothing (toUrl backend "version")
...
...
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