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
4da3ef16
Commit
4da3ef16
authored
Aug 12, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[errors] get rid of temporary throwError.*RESTError
parent
c82a7f6b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
89 additions
and
82 deletions
+89
-82
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+18
-29
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+29
-22
Core.purs
src/Gargantext/Components/NgramsTable/Core.purs
+15
-17
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+2
-2
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+20
-10
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+1
-0
Router.purs
src/Gargantext/Components/Router.purs
+4
-2
No files found.
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
4da3ef16
...
@@ -4,9 +4,9 @@ module Gargantext.Components.GraphExplorer.Sidebar
...
@@ -4,9 +4,9 @@ module Gargantext.Components.GraphExplorer.Sidebar
import Gargantext.Prelude
import Gargantext.Prelude
import Control.Monad.Error.Class (throwError)
import Control.Parallel (parTraverse)
import Control.Parallel (parTraverse)
import Data.Array (head, last, concat)
import Data.Array (head, last, concat)
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Int (fromString)
import Data.Int (fromString)
import Data.Map as Map
import Data.Map as Map
...
@@ -14,7 +14,7 @@ import Data.Maybe (Maybe(..), fromJust)
...
@@ -14,7 +14,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,
error,
launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.GraphExplorer.Legend as Legend
import Gargantext.Components.GraphExplorer.Legend as Legend
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
...
@@ -28,7 +28,7 @@ import Gargantext.Data.Array (mapMaybe)
...
@@ -28,7 +28,7 @@ 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
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType, NodeID, TabSubType(..), TabType(..), TermList(..), modeTabType)
import Gargantext.Types (CTabNgramType,
FrontendError(..),
NodeID, TabSubType(..), TabType(..), TermList(..), modeTabType)
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 Partial.Unsafe (unsafePartial)
import Partial.Unsafe (unsafePartial)
...
@@ -43,7 +43,8 @@ here :: R2.Here
...
@@ -43,7 +43,8 @@ here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Common = (
type Common = (
graphId :: NodeID
errors :: T.Box (Array FrontendError)
, graphId :: NodeID
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, reloadForest :: T2.ReloadS
, reloadForest :: T2.ReloadS
, removedNodeIds :: T.Box SigmaxT.NodeIds
, removedNodeIds :: T.Box SigmaxT.NodeIds
...
@@ -61,7 +62,6 @@ type Props = (
...
@@ -61,7 +62,6 @@ type Props = (
sidebar :: R2.Component Props
sidebar :: R2.Component Props
sidebar = R.createElement sidebarCpt
sidebar = R.createElement sidebarCpt
sidebarCpt :: R.Component Props
sidebarCpt :: R.Component Props
sidebarCpt = here.component "sidebar" cpt
sidebarCpt = here.component "sidebar" cpt
where
where
...
@@ -86,7 +86,6 @@ type SideTabNavProps = (
...
@@ -86,7 +86,6 @@ type SideTabNavProps = (
sideTabNav :: R2.Component SideTabNavProps
sideTabNav :: R2.Component SideTabNavProps
sideTabNav = R.createElement sideTabNavCpt
sideTabNav = R.createElement sideTabNavCpt
sideTabNavCpt :: R.Component SideTabNavProps
sideTabNavCpt :: R.Component SideTabNavProps
sideTabNavCpt = here.component "sideTabNav" cpt
sideTabNavCpt = here.component "sideTabNav" cpt
where
where
...
@@ -111,11 +110,10 @@ type SideTabProps = Props
...
@@ -111,11 +110,10 @@ type SideTabProps = Props
sideTabLegend :: R2.Component SideTabProps
sideTabLegend :: R2.Component SideTabProps
sideTabLegend = R.createElement sideTabLegendCpt
sideTabLegend = R.createElement sideTabLegendCpt
sideTabLegendCpt :: R.Component SideTabProps
sideTabLegendCpt :: R.Component SideTabProps
sideTabLegendCpt = here.component "sideTabLegend" cpt
sideTabLegendCpt = here.component "sideTabLegend" cpt
where
where
cpt
props@
{ metaData: GET.MetaData { legend } } _ = do
cpt { metaData: GET.MetaData { legend } } _ = do
pure $ H.div {}
pure $ H.div {}
[ Legend.legend { items: Seq.fromFoldable legend }
[ Legend.legend { items: Seq.fromFoldable legend }
, documentation EN
, documentation EN
...
@@ -123,7 +121,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt
...
@@ -123,7 +121,6 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt
sideTabData :: R2.Component SideTabProps
sideTabData :: R2.Component SideTabProps
sideTabData = R.createElement sideTabDataCpt
sideTabData = R.createElement sideTabDataCpt
sideTabDataCpt :: R.Component SideTabProps
sideTabDataCpt :: R.Component SideTabProps
sideTabDataCpt = here.component "sideTabData" cpt
sideTabDataCpt = here.component "sideTabData" cpt
where
where
...
@@ -143,18 +140,10 @@ sideTabDataCpt = here.component "sideTabData" cpt
...
@@ -143,18 +140,10 @@ sideTabDataCpt = here.component "sideTabData" cpt
} []
} []
]
]
]
]
where
checkbox text = RH.li {}
[ RH.span {} [ RH.text text ]
, RH.input { type: "checkbox"
, className: "checkbox"
, defaultChecked: true
, title: "Mark as completed" } ]
sideTabCommunity :: R2.Component SideTabProps
sideTabCommunity :: R2.Component SideTabProps
sideTabCommunity = R.createElement sideTabCommunityCpt
sideTabCommunity = R.createElement sideTabCommunityCpt
sideTabCommunityCpt :: R.Component SideTabProps
sideTabCommunityCpt :: R.Component SideTabProps
sideTabCommunityCpt = here.component "sideTabCommunity" cpt
sideTabCommunityCpt = here.component "sideTabCommunity" cpt
where
where
...
@@ -185,7 +174,6 @@ type SelectedNodesProps = (
...
@@ -185,7 +174,6 @@ type SelectedNodesProps = (
selectedNodes :: R2.Component SelectedNodesProps
selectedNodes :: R2.Component SelectedNodesProps
selectedNodes = R.createElement selectedNodesCpt
selectedNodes = R.createElement selectedNodesCpt
selectedNodesCpt :: R.Component SelectedNodesProps
selectedNodesCpt :: R.Component SelectedNodesProps
selectedNodesCpt = here.component "selectedNodes" cpt
selectedNodesCpt = here.component "selectedNodes" cpt
where
where
...
@@ -228,7 +216,6 @@ selectedNodesCpt = here.component "selectedNodes" cpt
...
@@ -228,7 +216,6 @@ selectedNodesCpt = here.component "selectedNodes" cpt
neighborhood :: R2.Component Props
neighborhood :: R2.Component Props
neighborhood = R.createElement neighborhoodCpt
neighborhood = R.createElement neighborhoodCpt
neighborhoodCpt :: R.Component Props
neighborhoodCpt :: R.Component Props
neighborhoodCpt = here.component "neighborhood" cpt
neighborhoodCpt = here.component "neighborhood" cpt
where
where
...
@@ -262,6 +249,7 @@ updateTermButtonCpt :: R.Component UpdateTermButtonProps
...
@@ -262,6 +249,7 @@ updateTermButtonCpt :: R.Component UpdateTermButtonProps
updateTermButtonCpt = here.component "updateTermButton" cpt
updateTermButtonCpt = here.component "updateTermButton" cpt
where
where
cpt { buttonType
cpt { buttonType
, errors
, graphId
, graphId
, metaData
, metaData
, nodesMap
, nodesMap
...
@@ -280,10 +268,11 @@ updateTermButtonCpt = here.component "updateTermButton" cpt
...
@@ -280,10 +268,11 @@ updateTermButtonCpt = here.component "updateTermButton" cpt
, on: { click: onClickRemove selectedNodeIds' }
, on: { click: onClickRemove selectedNodeIds' }
} [ RH.text text ]
} [ RH.text text ]
where
where
onClickRemove selectedNodeIds'
e
= do
onClickRemove selectedNodeIds'
_
= do
let nodes = mapMaybe (\id -> Map.lookup id nodesMap)
let nodes = mapMaybe (\id -> Map.lookup id nodesMap)
$ Set.toUnfoldable selectedNodeIds'
$ Set.toUnfoldable selectedNodeIds'
sendPatches { graphId: graphId
sendPatches { errors
, graphId: graphId
, metaData: metaData
, metaData: metaData
, nodes
, nodes
, session: session
, session: session
...
@@ -300,7 +289,7 @@ badge selectedNodeIds {id, label} =
...
@@ -300,7 +289,7 @@ badge selectedNodeIds {id, label} =
, on: { click: onClick }
, on: { click: onClick }
} [ RH.h6 {} [ RH.text label ] ]
} [ RH.h6 {} [ RH.text label ] ]
where
where
onClick
e
= do
onClick
_
= do
T.write_ (Set.singleton id) selectedNodeIds
T.write_ (Set.singleton id) selectedNodeIds
badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
badges :: SigmaxT.SGraph -> SigmaxT.NodeIds -> Seq.Seq (Record SigmaxT.Node)
...
@@ -311,7 +300,8 @@ neighbourBadges graph selectedNodeIds = SigmaxT.neighbours graph selectedNodes'
...
@@ -311,7 +300,8 @@ neighbourBadges graph selectedNodeIds = SigmaxT.neighbours graph selectedNodes'
selectedNodes' = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
selectedNodes' = SigmaxT.graphNodes $ SigmaxT.nodesById graph selectedNodeIds
type SendPatches =
type SendPatches =
( graphId :: NodeID
( errors :: T.Box (Array FrontendError)
, graphId :: NodeID
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, nodes :: Array (Record SigmaxT.Node)
, nodes :: Array (Record SigmaxT.Node)
, reloadForest :: T2.ReloadS
, reloadForest :: T2.ReloadS
...
@@ -320,13 +310,15 @@ type SendPatches =
...
@@ -320,13 +310,15 @@ type SendPatches =
)
)
sendPatches :: Record SendPatches -> Effect Unit
sendPatches :: Record SendPatches -> Effect Unit
sendPatches {
metaData, nodes, session, termList, reloadFore
st } = do
sendPatches {
errors, metaData, nodes, reloadForest, session, termLi
st } = do
launchAff_ do
launchAff_ do
patches <- (parTraverse (sendPatch termList session metaData) nodes) -- :: Aff (Array NTC.VersionedNgramsPatches)
patches <- (parTraverse (sendPatch termList session metaData) nodes) -- :: Aff (Array NTC.VersionedNgramsPatches)
let mPatch = last patches
let mPatch = last patches
case mPatch of
case mPatch of
Nothing -> pure unit
Nothing -> pure unit
Just (Left _err) -> throwError $ error $ "[sendPatches] RESTError"
Just (Left err) -> liftEffect $ do
T.modify_ (A.cons $ FRESTError { error: err }) errors
here.log2 "[sendPatches] RESTError" err
Just (Right (NTC.Versioned _patch)) -> do
Just (Right (NTC.Versioned _patch)) -> do
liftEffect $ T2.reload reloadForest
liftEffect $ T2.reload reloadForest
...
@@ -341,7 +333,7 @@ sendPatch termList session (GET.MetaData metaData) node = do
...
@@ -341,7 +333,7 @@ sendPatch termList session (GET.MetaData metaData) node = do
case eRet of
case eRet of
Left err -> pure $ Left err
Left err -> pure $ Left err
Right ret -> do
Right ret -> do
task <- NTC.postNgramsChartsAsync coreParams -- TODO add task
_
task <- NTC.postNgramsChartsAsync coreParams -- TODO add task
pure $ Right ret
pure $ Right ret
where
where
nodeId :: NodeID
nodeId :: NodeID
...
@@ -362,9 +354,6 @@ sendPatch termList session (GET.MetaData metaData) node = do
...
@@ -362,9 +354,6 @@ sendPatch termList session (GET.MetaData metaData) node = do
term :: NTC.NgramsTerm
term :: NTC.NgramsTerm
term = NTC.normNgram tabNgramType node.label
term = NTC.normNgram tabNgramType node.label
pt :: NTC.NgramsTablePatch
pt = NTC.fromNgramsPatches np
np :: NTC.NgramsPatches
np :: NTC.NgramsPatches
np = NTC.singletonPatchMap term $ NTC.NgramsPatch { patch_children: mempty, patch_list }
np = NTC.singletonPatchMap term $ NTC.NgramsPatch { patch_children: mempty, patch_list }
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
4da3ef16
...
@@ -26,11 +26,6 @@ import Data.Tuple (Tuple(..))
...
@@ -26,11 +26,6 @@ import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
import Gargantext.Components.NgramsTable.Components as NTC
import Gargantext.Components.NgramsTable.Components as NTC
...
@@ -43,12 +38,16 @@ import Gargantext.Config.REST (RESTError)
...
@@ -43,12 +38,16 @@ import Gargantext.Config.REST (RESTError)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Routes (SessionRoute(..)) as R
import Gargantext.Sessions (Session, get)
import Gargantext.Sessions (Session, get)
import Gargantext.Types (CTabNgramType, OrderBy(..), SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes)
import Gargantext.Types (CTabNgramType,
FrontendError,
OrderBy(..), SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes)
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
import Gargantext.Utils (queryMatchesLabel, toggleSet, sortWith)
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.Seq as Seq
import Gargantext.Utils.Seq as Seq
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix.DOM.HTML as H
import Toestand as T
import Unsafe.Coerce (unsafeCoerce)
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.NgramsTable"
here = R2.here "Gargantext.Components.NgramsTable"
...
@@ -250,12 +249,13 @@ tableContainerCpt { dispatch
...
@@ -250,12 +249,13 @@ tableContainerCpt { dispatch
-- NEXT
-- NEXT
type CommonProps = (
type CommonProps = (
afterSync :: Unit -> Aff Unit
afterSync :: Unit -> Aff Unit
, reloadForest :: T2.ReloadS
, errors :: T.Box (Array FrontendError)
, reloadRoot :: T2.ReloadS
, reloadForest :: T2.ReloadS
, tabNgramType :: CTabNgramType
, reloadRoot :: T2.ReloadS
, tasks :: T.Box GAT.Storage
, tabNgramType :: CTabNgramType
, withAutoUpdate :: Boolean
, tasks :: T.Box GAT.Storage
, withAutoUpdate :: Boolean
)
)
type Props =
type Props =
...
@@ -273,6 +273,7 @@ loadedNgramsTableCpt :: R.Component Props
...
@@ -273,6 +273,7 @@ loadedNgramsTableCpt :: R.Component Props
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
cpt { afterSync
cpt { afterSync
, cacheState
, cacheState
, errors
, mTotalRows
, mTotalRows
, path
, path
, reloadForest
, reloadForest
...
@@ -343,7 +344,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
...
@@ -343,7 +344,7 @@ loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
totalRecords = fromMaybe (Seq.length rows) mTotalRows
totalRecords = fromMaybe (Seq.length rows) mTotalRows
afterSync' _ = do
afterSync' _ = do
chartsAfterSync path' tasks unit
chartsAfterSync path'
errors
tasks unit
afterSync unit
afterSync unit
syncResetButton = syncResetButtons { afterSync: afterSync'
syncResetButton = syncResetButtons { afterSync: afterSync'
...
@@ -509,12 +510,12 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
...
@@ -509,12 +510,12 @@ selectNgramsOnFirstPage rows = Set.fromFoldable $ (view $ _NgramsElement <<< _ng
type MainNgramsTableProps = (
type MainNgramsTableProps = (
cacheState
:: T.Box NT.CacheState
cacheState :: T.Box NT.CacheState
, defaultListId
:: Int
, defaultListId :: Int
-- ^ This node can be a corpus or contact.
-- ^ This node can be a corpus or contact.
, path
:: T.Box PageParams
, path :: T.Box PageParams
, session
:: Session
, session :: Session
, tabType
:: TabType
, tabType :: TabType
| CommonProps
| CommonProps
)
)
...
@@ -526,6 +527,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -526,6 +527,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
cpt { afterSync
cpt { afterSync
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -541,6 +543,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -541,6 +543,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
NT.CacheOn -> do
NT.CacheOn -> do
let render versioned = mainNgramsTablePaint { afterSync
let render versioned = mainNgramsTablePaint { afterSync
, cacheState: cacheState'
, cacheState: cacheState'
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -560,6 +563,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -560,6 +563,7 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
-- path <- R.useState' path
-- path <- R.useState' path
let render versionedWithCount = mainNgramsTablePaintNoCache { afterSync
let render versionedWithCount = mainNgramsTablePaintNoCache { afterSync
, cacheState: cacheState'
, cacheState: cacheState'
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -615,20 +619,20 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -615,20 +619,20 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
handleResponse v = v
handleResponse v = v
type MainNgramsTablePaintProps = (
type MainNgramsTablePaintProps = (
cacheState
:: NT.CacheState
cacheState :: NT.CacheState
, path
:: T.Box PageParams
, path :: T.Box PageParams
, versioned
:: VersionedNgramsTable
, versioned :: VersionedNgramsTable
| CommonProps
| CommonProps
)
)
mainNgramsTablePaint :: R2.Component MainNgramsTablePaintProps
mainNgramsTablePaint :: R2.Component MainNgramsTablePaintProps
mainNgramsTablePaint = R.createElement mainNgramsTablePaintCpt
mainNgramsTablePaint = R.createElement mainNgramsTablePaintCpt
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
where
where
cpt { afterSync
cpt { afterSync
, cacheState
, cacheState
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -640,6 +644,7 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
...
@@ -640,6 +644,7 @@ mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
pure $ loadedNgramsTable { afterSync
pure $ loadedNgramsTable { afterSync
, cacheState
, cacheState
, errors
, mTotalRows: Nothing
, mTotalRows: Nothing
, path
, path
, reloadForest
, reloadForest
...
@@ -666,6 +671,7 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
...
@@ -666,6 +671,7 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
where
where
cpt { afterSync
cpt { afterSync
, cacheState
, cacheState
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
@@ -680,6 +686,7 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
...
@@ -680,6 +686,7 @@ mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cp
pure $ loadedNgramsTable {
pure $ loadedNgramsTable {
afterSync
afterSync
, cacheState
, cacheState
, errors
, mTotalRows: Just count
, mTotalRows: Just count
, path: path
, path: path
, reloadForest
, reloadForest
...
...
src/Gargantext/Components/NgramsTable/Core.purs
View file @
4da3ef16
...
@@ -81,8 +81,8 @@ module Gargantext.Components.NgramsTable.Core
...
@@ -81,8 +81,8 @@ module Gargantext.Components.NgramsTable.Core
import Gargantext.Prelude
import Gargantext.Prelude
import Control.Monad.Error.Class (throwError)
import Control.Monad.State (class MonadState, execState)
import Control.Monad.State (class MonadState, execState)
import DOM.Simple.Console (log2)
import Data.Array (head)
import Data.Array (head)
import Data.Array as A
import Data.Array as A
import Data.Bifunctor (lmap)
import Data.Bifunctor (lmap)
...
@@ -120,7 +120,6 @@ import Data.Traversable (for, traverse_, traverse)
...
@@ -120,7 +120,6 @@ import Data.Traversable (for, traverse_, traverse)
import Data.TraversableWithIndex (traverseWithIndex)
import Data.TraversableWithIndex (traverseWithIndex)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import DOM.Simple.Console (log2)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, error, launchAff_)
import Effect.Aff (Aff, error, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
...
@@ -128,23 +127,23 @@ import Effect.Exception.Unsafe (unsafeThrow)
...
@@ -128,23 +127,23 @@ 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 Partial (crashWith)
import Partial.Unsafe (unsafePartial)
import Reactix as R
import Reactix.DOM.HTML as H
import Simple.JSON as JSON
import Toestand as T
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)
import Gargantext.Config.Utils (handleRESTError)
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(..), 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 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.NgramsTable.Core"
here = R2.here "Gargantext.Components.NgramsTable.Core"
...
@@ -1117,21 +1116,20 @@ chartsAfterSync :: forall props discard.
...
@@ -1117,21 +1116,20 @@ chartsAfterSync :: forall props discard.
, tabType :: TabType
, tabType :: TabType
| props
| props
}
}
-> T.Box (Array FrontendError)
-> T.Box GAT.Storage
-> T.Box GAT.Storage
-> discard
-> discard
-> Aff Unit
-> Aff Unit
chartsAfterSync path'@{ nodeId } tasks _ = do
chartsAfterSync path'@{ nodeId }
errors
tasks _ = do
t
ask <- postNgramsChartsAsync path'
eT
ask <- postNgramsChartsAsync path'
liftEffect $ do
handleRESTError errors eTask $ \task ->
liftEffect $ 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
AsyncTaskWithType
postNgramsChartsAsync :: forall s. CoreParams s -> Aff
(Either 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
case eTask of
pure $ (\task -> AsyncTaskWithType { task, typ: UpdateNgramsCharts }) <$> eTask
Left _err -> liftEffect $ throwError $ error "[postNgramsChartsAsync] RESTError"
Right task -> pure $ AsyncTaskWithType { task, typ: UpdateNgramsCharts }
where
where
acu = AsyncNgramsChartsUpdate { listId: head listIds
acu = AsyncNgramsChartsUpdate { listId: head listIds
, tabType }
, tabType }
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
4da3ef16
...
@@ -113,10 +113,9 @@ type NgramsViewTabsProps =
...
@@ -113,10 +113,9 @@ type NgramsViewTabsProps =
ngramsView :: R2.Leaf NgramsViewTabsProps
ngramsView :: R2.Leaf NgramsViewTabsProps
ngramsView props = R.createElement ngramsViewCpt props []
ngramsView props = R.createElement ngramsViewCpt props []
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt where
ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ defaultListId, mode, nodeId, session } _ = do
cpt props@{ defaultListId,
errors,
mode, nodeId, session } _ = do
path <- T.useBox $
path <- T.useBox $
NTC.initialPageParams session nodeId
NTC.initialPageParams session nodeId
[ defaultListId ] (TabDocument TabDocs)
[ defaultListId ] (TabDocument TabDocs)
...
@@ -126,6 +125,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -126,6 +125,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
props' path =
props' path =
(Record.merge most
(Record.merge most
{ afterSync
{ afterSync
, errors
, path
, path
, tabType: TabPairing (TabNgramType $ modeTabType mode)
, tabType: TabPairing (TabNgramType $ modeTabType mode)
, tabNgramType: modeTabType' mode
, tabNgramType: modeTabType' mode
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
4da3ef16
...
@@ -92,29 +92,36 @@ tabsCpt = here.component "tabs" cpt
...
@@ -92,29 +92,36 @@ tabsCpt = here.component "tabs" cpt
, "Trash" /\ docs -- TODO pass-in trash mode
, "Trash" /\ docs -- TODO pass-in trash mode
]
]
where
where
patentsView = { reloadRoot
patentsView = { cacheState
, tasks
, cacheState
, defaultListId
, defaultListId
, errors
, mode: Patents
, mode: Patents
, nodeId
, nodeId
, reloadForest
, reloadForest
,
session }
,
reloadRoot
booksView = { reloadRoot
, session
, tasks
, tasks
, cacheState
}
booksView = { cacheState
, defaultListId
, defaultListId
, errors
, mode: Books
, mode: Books
, nodeId
, nodeId
, reloadForest
, reloadForest
, session }
, reloadRoot
commView = { reloadRoot, tasks
, session
, cacheState
, tasks
}
commView = { cacheState
, defaultListId
, defaultListId
, errors
, mode: Communication
, mode: Communication
, nodeId
, nodeId
, reloadForest
, reloadForest
, session }
, reloadRoot
, session
, tasks
}
chart = mempty
chart = mempty
totalRecords = 4736 -- TODO
totalRecords = 4736 -- TODO
docs = DT.docViewLayout
docs = DT.docViewLayout
...
@@ -138,6 +145,7 @@ tabsCpt = here.component "tabs" cpt
...
@@ -138,6 +145,7 @@ tabsCpt = here.component "tabs" cpt
type NgramsViewTabsProps = (
type NgramsViewTabsProps = (
cacheState :: T.Box LTypes.CacheState
cacheState :: T.Box LTypes.CacheState
, defaultListId :: Int
, defaultListId :: Int
, errors :: T.Box (Array FrontendError)
, mode :: Mode
, mode :: Mode
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, reloadForest :: T2.ReloadS
...
@@ -154,6 +162,7 @@ ngramsViewCpt = here.component "ngramsView" cpt
...
@@ -154,6 +162,7 @@ ngramsViewCpt = here.component "ngramsView" cpt
where
where
cpt { cacheState
cpt { cacheState
, defaultListId
, defaultListId
, errors
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
, mode
, mode
...
@@ -166,6 +175,7 @@ ngramsViewCpt = here.component "ngramsView" cpt
...
@@ -166,6 +175,7 @@ ngramsViewCpt = here.component "ngramsView" cpt
afterSync: \_ -> pure unit
afterSync: \_ -> pure unit
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
4da3ef16
...
@@ -95,6 +95,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -95,6 +95,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
<> [ NT.mainNgramsTable { afterSync: afterSync chartsReload
<> [ NT.mainNgramsTable { afterSync: afterSync chartsReload
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadForest
, reloadRoot
, reloadRoot
...
...
src/Gargantext/Components/Router.purs
View file @
4da3ef16
...
@@ -224,7 +224,8 @@ openedSidePanel :: R2.Component (WithSession Props)
...
@@ -224,7 +224,8 @@ openedSidePanel :: R2.Component (WithSession Props)
openedSidePanel = R.createElement openedSidePanelCpt
openedSidePanel = R.createElement openedSidePanelCpt
openedSidePanelCpt :: R.Component (WithSession Props)
openedSidePanelCpt :: R.Component (WithSession Props)
openedSidePanelCpt = here.component "openedSidePanel" cpt where
openedSidePanelCpt = here.component "openedSidePanel" cpt where
cpt { boxes: { graphVersion
cpt { boxes: { errors
, graphVersion
, reloadForest
, reloadForest
, route
, route
, sidePanelGraph
, sidePanelGraph
...
@@ -249,7 +250,8 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
...
@@ -249,7 +250,8 @@ openedSidePanelCpt = here.component "openedSidePanel" cpt where
(_ /\ Nothing) -> pure $ wrapper []
(_ /\ Nothing) -> pure $ wrapper []
(Just graph /\ Just metaData) -> do
(Just graph /\ Just metaData) -> do
pure $ wrapper
pure $ wrapper
[ GES.sidebar { frontends: defaultFrontends
[ GES.sidebar { errors
, frontends: defaultFrontends
, graph
, graph
, graphId: g
, graphId: g
, graphVersion
, graphVersion
...
...
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