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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
e3eb2757
Commit
e3eb2757
authored
Oct 05, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[rest, search] resterror handler, search fixes
parent
41ecf1e2
Pipeline
#1931
failed with stage
Changes
21
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
112 additions
and
105 deletions
+112
-105
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+6
-6
Types.purs
src/Gargantext/Components/DocsTable/Types.purs
+16
-12
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+2
-1
FolderView.purs
src/Gargantext/Components/FolderView.purs
+6
-7
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+3
-3
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+3
-2
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+2
-2
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+10
-11
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+3
-3
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+11
-12
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+2
-2
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+2
-2
Code.purs
src/Gargantext/Components/Nodes/Corpus/Code.purs
+2
-1
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+2
-1
Document.purs
src/Gargantext/Components/Nodes/Corpus/Document.purs
+10
-14
File.purs
src/Gargantext/Components/Nodes/File.purs
+8
-9
Frame.purs
src/Gargantext/Components/Nodes/Frame.purs
+7
-8
Public.purs
src/Gargantext/Components/Nodes/Home/Public.purs
+7
-7
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+2
-1
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+2
-1
REST.purs
src/Gargantext/Config/REST.purs
+6
-0
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
e3eb2757
...
...
@@ -25,12 +25,12 @@ import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category.Types (Star(..))
import Gargantext.Components.DocsTable.Types (DocumentsView(..), Hyperdata(..), LocalUserScore, Query, Response(..), Year, sampleData)
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.Texts.Types as TextsT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Routes (SessionRoute(NodeAPI))
...
...
@@ -324,7 +324,7 @@ pageLayoutCpt = here.component "pageLayout" cpt where
, totalRecords = count }
, localCategories
, params: paramsS } []
let errorHandler
err = here.log2 "[pageLayout] RESTError" err
let errorHandler
= logRESTError here "[pageLayout]"
useLoader { errorHandler
, path: path { params = paramsS' }
, loader
...
...
@@ -370,8 +370,8 @@ pagePaintCpt = here.component "pagePaintCpt" cpt
case convOrderBy orderBy of
Just DateAsc -> sortWith \(DocumentsView { date }) -> date
Just DateDesc -> sortWith \(DocumentsView { date }) -> Down date
Just SourceAsc -> sortWith \(DocumentsView { source }) -> Str.toLower source
Just SourceDesc -> sortWith \(DocumentsView { source }) -> Down $ Str.toLower source
Just SourceAsc -> sortWith \(DocumentsView { source }) -> Str.toLower
$ fromMaybe ""
source
Just SourceDesc -> sortWith \(DocumentsView { source }) -> Down $ Str.toLower
$ fromMaybe ""
source
Just TitleAsc -> sortWith \(DocumentsView { title }) -> Str.toLower title
Just TitleDesc -> sortWith \(DocumentsView { title }) -> Down $ Str.toLower title
_ -> identity -- the server ordering is enough here
...
...
@@ -452,7 +452,7 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
[ H.a { href: url frontends $ corpusDocument r._id, target: "_blank"}
[ H.text r.title ]
]
, H.div { className: tClassName } [ H.text $
if r.source == "" then "Source" els
e r.source ]
, H.div { className: tClassName } [ H.text $
showSourc
e r.source ]
, H.div {} [ H.text $ maybe "-" show r.ngramCount ]
]
, delete: true }
...
...
src/Gargantext/Components/DocsTable/Types.purs
View file @
e3eb2757
module Gargantext.Components.DocsTable.Types where
import Data.Generic.Rep (class Generic)
import Gargantext.Prelude
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Map (Map)
import Data.Map as Map
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple (Tuple(..))
import Gargantext.Components.Category.Types (Category, Star(..), decodeStar)
import Simple.JSON as JSON
import Gargantext.Prelude
import Gargantext.Components.Category.Types (Category(..), decodeCategory, Star(..), decodeStar)
data Action
= MarkCategory Int Category
...
...
@@ -20,7 +18,7 @@ type DocumentsViewT =
, date :: Int
, ngramCount :: Maybe Int
, score :: Maybe Int
, source :: String
, source ::
Maybe
String
, title :: String
, url :: String
)
...
...
@@ -33,15 +31,21 @@ derive instance Generic DocumentsView _
instance Eq DocumentsView where
eq = genericEq
showSource :: Maybe String -> String
showSource s = fromMaybe "NOT FOUND" s
instance JSON.ReadForeign DocumentsView where
readImpl f = do
{ id, category, date, ngramCount, score, source, title, url } :: { id :: Int | DocumentsViewT } <- JSON.readImpl f
let source' = case source of
Just "NOT FOUND" -> Nothing
s -> s
pure $ DocumentsView { _id: id
, category
, date
, ngramCount
, score
, source
, source
: source'
, title
, url }
instance JSON.WriteForeign DocumentsView where
...
...
@@ -80,7 +84,7 @@ instance JSON.ReadForeign Response where
type HyperdataT =
( title :: String
, source :: String )
, source ::
Maybe
String )
newtype Hyperdata = Hyperdata
{ pub_year :: Int
| HyperdataT
...
...
@@ -105,7 +109,7 @@ sampleData' = DocumentsView { _id : 1
, url : ""
, date : 2010
, title : "title"
, source : "source"
, source :
Just
"source"
, category : Star_1
, ngramCount : Just 1
, score: Just 1 }
...
...
@@ -116,7 +120,7 @@ sampleData = map (\(Tuple t s) -> DocumentsView { _id : 1
, url : ""
, date : 2017
, title: t
, source: s
, source:
Just
s
, category : Star_1
, ngramCount : Just 10
, score: Just 1 }) sampleDocuments
...
...
src/Gargantext/Components/FacetsTable.purs
View file @
e3eb2757
...
...
@@ -21,6 +21,7 @@ import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Gargantext.Components.Category (CategoryQuery(..), putCategories)
import Gargantext.Components.Category.Types (Category(..), decodeCategory, favCategory)
import Gargantext.Components.DocsTable.Types (showSource)
import Gargantext.Components.Search (Contact(..), Document(..), HyperdataRowContact(..), HyperdataRowDocument(..), SearchQuery, SearchResult(..), SearchResultTypes(..))
import Gargantext.Components.Table as T
import Gargantext.Components.Table.Types as T
...
...
@@ -245,7 +246,7 @@ doc2view ( Document { id
) = DocumentsView { id
, date
, title: title
, source:
fromMaybe "Source"
source
, source:
showSource
source
, score
, authors: fromMaybe "Authors" authors
, category: decodeCategory category
...
...
src/Gargantext/Components/FolderView.purs
View file @
e3eb2757
...
...
@@ -8,11 +8,6 @@ import Data.Traversable (traverse_)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action.Add (AddNodeValue(..), addNode)
...
...
@@ -30,7 +25,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.WriteNodesDocuments (docume
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Tools.FTree (FTree, LNode(..), NTree(..), ID, fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Ordering, Unit, bind, compare, discard, pure, unit, void, ($), (<$>), (<>))
...
...
@@ -41,6 +36,10 @@ import Gargantext.Types as GT
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
foreign import back :: Effect Unit
foreign import link :: String -> Effect Unit
...
...
@@ -76,7 +75,7 @@ folderViewCpt = here.component "folderViewCpt" cpt where
, session
, setPopoverRef } [] }
where
errorHandler
err = here.log2 "[folderView] RESTError" err
errorHandler
= logRESTError here "[folderView]"
type FolderViewProps =
( backFolder :: Boolean
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
e3eb2757
...
...
@@ -26,7 +26,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.Tools.FTree (FTree, LNode(..), NTree(..), fTreeID)
import Gargantext.Components.Forest.Tree.Node.Tools.SubTree.Types (SubTreeOut(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
...
...
@@ -122,7 +122,7 @@ treeLoaderCpt = here.component "treeLoader" cpt where
props = Record.merge common extra where
common = RecordE.pick p :: Record Common
extra = { reloadTree: p.reload, root, session, tree: tree' }
errorHandler
err = here.log2 "[treeLoader] RESTError" err
errorHandler
= logRESTError here "[treeLoader]"
getNodeTree :: Session -> ID -> Aff (Either RESTError FTree)
getNodeTree session nodeId = get session $ GR.NodeAPI GT.Tree (Just nodeId) ""
...
...
@@ -216,7 +216,7 @@ childLoaderCpt = here.component "childLoader" cpt where
, path: cache
, render: paint reload }
where
errorHandler
err = here.log2 "[childLoader] RESTError" err
errorHandler
= logRESTError here "[childLoader]"
fetch _ = getNodeTreeFirstLevel p.session p.id
paint reload tree' = render (Record.merge base extra) where
base = nodeProps { reload = reload }
...
...
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
e3eb2757
...
...
@@ -21,6 +21,7 @@ import Gargantext.Components.Forest.Tree.Node.Tools.Sync (nodeActionsGraph, node
import Gargantext.Components.GraphExplorer.API as GraphAPI
import Gargantext.Components.Lang (Lang(EN))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Config.REST (logRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as Routes
...
...
@@ -315,7 +316,7 @@ graphNodeActionsCpt = here.component "graphNodeActions" cpt where
, path: id
, render: \gv -> nodeActionsGraph { graphVersions: gv, session, id, refresh } [] }
graphVersions session graphId = GraphAPI.graphVersions { graphId, session }
errorHandler
err = here.log2 "[graphNodeActions] RESTError" err
errorHandler
= logRESTError here "[graphNodeActions]"
listNodeActions :: R2.Leaf NodeActionsCommon
listNodeActions props = R.createElement listNodeActionsCpt props []
...
...
@@ -329,5 +330,5 @@ listNodeActionsCpt = here.component "listNodeActions" cpt where
{ listId: id, nodeId: corpusId, session, refresh: refresh
, nodeType: GT.TabNgramType GT.CTabTerms } }
where
errorHandler
err = here.log2 "[listNodeActions] RESTError" err
errorHandler
= logRESTError here "[listNodeActions]"
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
e3eb2757
...
...
@@ -15,7 +15,7 @@ import Gargantext.Components.Forest.Tree.Node.Action.Types (Action)
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.SubTree.Types (SubTreeParams(..), SubTreeOut(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
...
...
@@ -75,7 +75,7 @@ subTreeViewCpt = here.component "subTreeView" cpt
, tree
} [] }
where
errorHandler
err = here.log2 "RESTError" err
errorHandler
= logRESTError here "[subTreeView]"
loadSubTree :: Array GT.NodeType -> Session -> Aff (Either RESTError FTree)
loadSubTree nodetypes session = getSubTree session treeId nodetypes
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
e3eb2757
...
...
@@ -2,6 +2,7 @@ module Gargantext.Components.GraphExplorer where
import Gargantext.Prelude hiding (max, min)
import DOM.Simple.Types (Element)
import Data.Array as A
import Data.Either (Either)
import Data.FoldableWithIndex (foldMapWithIndex)
...
...
@@ -12,22 +13,13 @@ import Data.Nullable (null, Nullable)
import Data.Sequence as Seq
import Data.Set as Set
import Data.Tuple (Tuple(..))
import DOM.Simple.Types (Element)
import Effect.Aff (Aff)
import Math as Math
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as RH
import Record as Record
import Record.Extra as RX
import Toestand as T
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Controls as Controls
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Data.Louvain as Louvain
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Sigmax.Types as SigmaxT
...
...
@@ -37,6 +29,13 @@ import Gargantext.Types as Types
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Math as Math
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as RH
import Record as Record
import Record.Extra as RX
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer"
...
...
@@ -74,7 +73,7 @@ explorerLayoutCpt = here.component "explorerLayout" cpt where
, path: graphId
, render: handler }
where
errorHandler
err = here.log2 "[explorerLayout] RESTError" err
errorHandler
= logRESTError here "[explorerLayout]"
handler loaded@(GET.HyperdataGraph { graph: hyperdataGraph }) =
explorerWriteGraph (Record.merge props { graph, hyperdataGraph: loaded, mMetaData' }) []
where
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
e3eb2757
...
...
@@ -34,7 +34,7 @@ import Gargantext.Components.NgramsTable.Loader (useLoaderWithCacheAPI)
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table as TT
import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Hooks.Loader (useLoaderBox)
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Sessions (Session, get)
...
...
@@ -582,7 +582,7 @@ mainNgramsTableCacheOnCpt = here.component "mainNgramsTableCacheOn" cpt where
, renderer: render
}
versionEndpoint { defaultListId, path: { nodeId, tabType, session } } _ = get session $ R.GetNgramsTableVersion { listId: defaultListId, tabType } (Just nodeId)
errorHandler
err = here.log2 "[mainNgramsTable] RESTError" err
errorHandler
= logRESTError here "[mainNgramsTable]"
mkRequest :: PageParams -> GUC.Request
mkRequest path@{ session } = GUC.makeGetRequest session $ url path
where
...
...
@@ -616,7 +616,7 @@ mainNgramsTableCacheOffCpt = here.component "mainNgramsTableCacheOff" cpt where
, path
, render }
errorHandler
err = here.log2 "[mainNgramsTable] RESTError" err
errorHandler
= logRESTError here "[mainNgramsTable]"
-- NOTE With cache off
loader :: PageParams -> Aff (Either RESTError VersionedWithCountNgramsTable)
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
e3eb2757
...
...
@@ -2,29 +2,23 @@ module Gargantext.Components.Nodes.Annuaire
-- ( annuaire )
where
import Gargantext.Prelude
import Data.Array as A
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..), maybe, fromMaybe)
import Data.Newtype (class Newtype)
import Data.Sequence as Seq
import Data.Symbol (SProxy(..))
import Effect.Aff (Aff, launchAff_)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Simple.JSON as JSON
import Toestand as T
import Gargantext.Prelude
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Types as CT
import Gargantext.Components.Nodes.Lists.Types as NT
import Gargantext.Components.Table (defaultContainer, initialParams, makeRow, table, tableHeaderLayout) as TT
import Gargantext.Components.Table.Types (ColumnName(..), Params) as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Ends (url, Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
...
...
@@ -32,6 +26,11 @@ import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, get)
import Gargantext.Types (NodeType(..), AffETableResult, TableResult)
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Simple.JSON as JSON
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Annuaire"
...
...
@@ -84,7 +83,7 @@ annuaireLayoutWithKeyCpt = here.component "annuaireLayoutWithKey" cpt where
, path: path'
, render: \info -> annuaire { frontends, info, path, session } }
where
errorHandler
err = here.log2 "[annuaireLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[annuaireLayoutWithKey]"
type AnnuaireProps =
( session :: Session
...
...
@@ -151,7 +150,7 @@ pageLayoutCpt = here.component "pageLayout" cpt
, path: pagePath'
, render: \table -> page { session, table, frontends, pagePath } }
where
errorHandler
err = here.log2 "[pageLayout] RESTError" err
errorHandler
= logRESTError here "[pageLayout]"
type PageProps =
( session :: Session
...
...
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
e3eb2757
...
...
@@ -17,7 +17,7 @@ import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
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.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes as Routes
...
...
@@ -209,7 +209,7 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
]
}
where
errorHandler
err = here.log2 "[userLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[userLayoutWithKey]"
onUpdateHyperdata :: T2.ReloadS -> HyperdataUser -> Effect Unit
onUpdateHyperdata reload hd = do
launchAff_ $ do
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
e3eb2757
...
...
@@ -14,7 +14,7 @@ import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.User.Contacts.Tabs as Tabs
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.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
...
...
@@ -191,7 +191,7 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
, sidePanel: sidePanelTexts
} ] }
where
errorHandler
err = here.log2 "[contactLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[contactLayoutWithKey]"
onUpdateHyperdata :: T2.ReloadS -> HyperdataContact -> Effect Unit
onUpdateHyperdata reload hd =
launchAff_ $
...
...
src/Gargantext/Components/Nodes/Corpus/Code.purs
View file @
e3eb2757
...
...
@@ -12,6 +12,7 @@ import Gargantext.Components.Nodes.Corpus (fieldsCodeEditor, loadCorpusWithReloa
import Gargantext.Components.Nodes.Corpus.Types (Hyperdata(..))
import Gargantext.Components.Nodes.Types (FTFieldList(..), FTFieldsWithIndex(..), defaultField)
import Gargantext.Components.TileMenu (tileMenu)
import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, pure, unit, ($), (<$>), (<>), (==), const)
import Gargantext.Routes as GR
...
...
@@ -51,7 +52,7 @@ corpusCodeLayoutCpt = here.component "corpusCodeLayout" cpt where
, path: { nodeId, reload: reload', session }
, render: \corpus -> corpusCodeView { corpus, nodeId, reload, session, boxes } }
where
errorHandler
err = here.log2 "[corpusLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[corpusLayoutWithKey]"
corpusCodeView :: Record ViewProps -> R.Element
corpusCodeView props = R.createElement corpusCodeViewCpt props []
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
e3eb2757
...
...
@@ -12,6 +12,7 @@ import Gargantext.Components.Nodes.Corpus (fieldsCodeEditor)
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Dashboard.Types as DT
import Gargantext.Components.Nodes.Types (FTFieldList(..), FTFieldsWithIndex(..), defaultField)
import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (Unit, bind, discard, pure, read, show, unit, ($), (<$>), (<>), (==))
import Gargantext.Sessions (Session, sessionId)
...
...
@@ -68,7 +69,7 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
, onChange: onChange nodeId reload (DT.Hyperdata h)
, session } [] }
where
errorHandler
err = here.log2 "[dashboardLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[dashboardLayoutWithKey]"
onChange :: NodeID -> T2.ReloadS -> DT.Hyperdata -> { charts :: Array P.PredefinedChart
, fields :: FTFieldList } -> Effect Unit
onChange nodeId' reload (DT.Hyperdata h) { charts, fields } = do
...
...
src/Gargantext/Components/Nodes/Corpus/Document.purs
View file @
e3eb2757
...
...
@@ -3,28 +3,24 @@ module Gargantext.Components.Nodes.Corpus.Document where
import Data.Either (Either(..))
import Data.Maybe (Maybe(..), fromMaybe)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>), (<$>), (<<<))
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Components.AutoUpdate (autoUpdate)
import Gargantext.Components.
Search (SearchType(..)
)
import Gargantext.Components.
NgramsTable.Core (CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable, replace, setTermListA, syncResetButtons, findNgramRoot
)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus.Document.Types (DocPath, Document(..), LoadedData, NodeDocument, Props, State, initialState)
import Gargantext.Components.NgramsTable.Core
( CoreAction(..), Versioned(..), addNewNgramA, applyNgramsPatches, coreDispatch, loadNgramsTable
, replace, setTermListA, syncResetButtons, findNgramRoot )
import Gargantext.Components.Annotation.AnnotatedField as AnnotatedField
import Gargantext.Config.REST (RESTError)
import Gargantext.Components.Search (SearchType(..))
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (bind, pure, show, unit, ($), (<>), (<$>), (<<<))
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get, sessionId)
import Gargantext.Types (CTabNgramType(..), ListId, NodeID, NodeType(..), TabSubType(..), TabType(..), ScoreType(..))
import Gargantext.Utils as U
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Document"
...
...
@@ -155,7 +151,7 @@ documentLayoutWithKeyCpt = here.component "documentLayoutWithKey" cpt
where
tabType = TabDocument (TabNgramType CTabTerms)
path = { listIds: [listId], mCorpusId, nodeId, session, tabType }
errorHandler
err = here.log2 "[documentLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[documentLayoutWithKey]"
------------------------------------------------------------------------
...
...
src/Gargantext/Components/Nodes/File.purs
View file @
e3eb2757
module Gargantext.Components.Nodes.File where
import Data.Generic.Rep (class Generic)
import Gargantext.Prelude
import Data.Either (Either)
import Data.Eq.Generic (genericEq)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Prelude
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError, logRESTError)
import Gargantext.Ends (toUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..))
import Gargantext.Sessions (Session, get)
import Gargantext.Types (NodeType(..), NodeID)
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 "Gargantext.Components.Nodes.File"
...
...
@@ -60,7 +59,7 @@ fileLayoutCpt = here.component "fileLayout" cpt where
, path: nodeId
, render: onLoad }
where
errorHandler
err = here.log2 "RESTError" err
errorHandler
= logRESTError here "[fileLayout]"
onLoad loaded = fileLayoutLoaded { loaded, nodeId, session }
loadFile :: Session -> NodeID -> Aff (Either RESTError File)
...
...
src/Gargantext/Components/Nodes/Frame.purs
View file @
e3eb2757
...
...
@@ -11,15 +11,9 @@ import Data.Newtype (class Newtype)
import Data.Nullable (Nullable, null, toMaybe)
import Data.Show.Generic (genericShow)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
import Web.URL as WURL
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
, logRESTError
)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Sessions (Session, get, sessionId)
...
...
@@ -27,6 +21,11 @@ import Gargantext.Types (NodeType(..))
import Gargantext.Utils.JitsiMeet as JM
import Gargantext.Utils.Reactix as R2
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
import Web.URL as WURL
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Frame"
...
...
@@ -71,7 +70,7 @@ frameLayoutWithKeyCpt = here.component "frameLayoutWithKey" cpt where
, path: {nodeId, reload: reload', session}
, render: \frame -> frameLayoutView {frame, nodeId, reload, session, nodeType} }
where
errorHandler
err = here.log2 "[frameLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[frameLayoutWithKey]"
type ViewProps =
( frame :: NodePoly Hyperdata
...
...
src/Gargantext/Components/Nodes/Home/Public.purs
View file @
e3eb2757
module Gargantext.Components.Nodes.Home.Public where
import Gargantext.Prelude
import Data.Either (Either)
import Data.Generic.Rep (class Generic)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.String (take)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Gargantext.Config (publicBackend)
import Gargantext.Config.REST (
get,
RESTError)
import Gargantext.Config.REST (
RESTError, get, log
RESTError)
import Gargantext.Ends (backendUrl)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude
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
here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Home.Public"
...
...
@@ -78,7 +78,7 @@ renderPublicCpt = here.component "renderPublic" cpt where
, render: loaded }
where
loaded publicData = publicLayout { publicData }
errorHandler
err = here.log2 "RESTError" err
errorHandler
= logRESTError here "[renderPublic]"
publicLayout :: Record PublicDataProps -> R.Element
publicLayout props = R.createElement publicLayoutCpt props []
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
e3eb2757
...
...
@@ -12,6 +12,7 @@ import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..),
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types (CacheState(..))
import Gargantext.Components.Table as Table
import Gargantext.Config.REST (logRESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types as GT
...
...
@@ -95,7 +96,7 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
}
] }
where
errorHandler
err = here.log2 "[listsLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[listsLayoutWithKey]"
afterCacheStateChange cacheState = do
launchAff_ $ clearCache unit
sessionUpdate $ setCacheState session nodeId cacheState
...
...
src/Gargantext/Components/Nodes/Texts.purs
View file @
e3eb2757
...
...
@@ -22,6 +22,7 @@ import Gargantext.Components.Nodes.Lists.Types as LT
import Gargantext.Components.Nodes.Texts.Types as TT
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Table as Table
import Gargantext.Config.REST (logRESTError)
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (WithSession, Session, getCacheState)
...
...
@@ -117,7 +118,7 @@ textsLayoutWithKeyCpt = here.component "textsLayoutWithKey" cpt
}
] }
where
errorHandler
err = here.log2 "[textsLayoutWithKey] RESTError" err
errorHandler
= logRESTError here "[textsLayoutWithKey]"
afterCacheStateChange cacheState = do
launchAff_ $ clearCache unit
-- TODO
...
...
src/Gargantext/Config/REST.purs
View file @
e3eb2757
...
...
@@ -14,6 +14,7 @@ import Data.HTTP.Method (Method(..))
import Data.Maybe (Maybe(..))
import Data.MediaType.Common (applicationFormURLEncoded, applicationJSON, multipartFormData)
import Data.Tuple (Tuple)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Foreign as Foreign
...
...
@@ -43,6 +44,11 @@ instance Eq RESTError where
-- this is crude but we need it only because of useLoader
eq _ _ = false
logRESTError :: R2.Here -> String -> RESTError -> Effect Unit
logRESTError here prefix (SendResponseError e) = here.log2 (prefix <> " SendResponseError ") e -- TODO: No show
logRESTError here prefix (ReadJSONError e) = here.log2 (prefix <> " ReadJSONError ") $ show e
logRESTError here prefix (CustomError e) = here.log2 (prefix <> " CustomError ") $ e
type AffRESTError a = Aff (Either RESTError a)
...
...
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