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
c10a6d14
Commit
c10a6d14
authored
Aug 23, 2021
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[boxes] refactoring of boxes
parent
4da3ef16
Changes
42
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
772 additions
and
1046 deletions
+772
-1046
Data.purs
src/Gargantext/Components/App/Data.purs
+1
-1
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+36
-49
FolderView.purs
src/Gargantext/Components/FolderView.purs
+61
-68
Forest.purs
src/Gargantext/Components/Forest.purs
+16
-55
Tree.purs
src/Gargantext/Components/Forest/Tree.purs
+107
-96
Node.purs
src/Gargantext/Components/Forest/Tree/Node.purs
+42
-42
Link.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
+2
-2
Merge.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
+2
-2
Move.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
+8
-8
Search.purs
...Gargantext/Components/Forest/Tree/Node/Action/Search.purs
+5
-4
Share.purs
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
+2
-2
Box.purs
src/Gargantext/Components/Forest/Tree/Node/Box.purs
+24
-17
Types.purs
src/Gargantext/Components/Forest/Tree/Node/Box/Types.purs
+3
-4
Tools.purs
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
+13
-18
SubTree.purs
...Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
+15
-13
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+35
-33
NgramsTable.purs
src/Gargantext/Components/NgramsTable.purs
+36
-61
Annuaire.purs
src/Gargantext/Components/Nodes/Annuaire.purs
+1
-1
Tabs.purs
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
+16
-26
User.purs
src/Gargantext/Components/Nodes/Annuaire/User.purs
+14
-47
Contact.purs
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
+22
-54
Tabs.purs
...gantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
+24
-50
Corpus.purs
src/Gargantext/Components/Nodes/Corpus.purs
+25
-31
Common.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
+13
-6
Histo.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
+3
-3
Metrics.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
+2
-2
Pie.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
+5
-5
Predefined.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
+14
-14
Tree.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
+6
-6
Types.purs
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
+2
-1
Dashboard.purs
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
+30
-16
Tabs.purs
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
+1
-1
Home.purs
src/Gargantext/Components/Nodes/Home.purs
+18
-28
Lists.purs
src/Gargantext/Components/Nodes/Lists.purs
+11
-28
Tabs.purs
src/Gargantext/Components/Nodes/Lists/Tabs.purs
+17
-25
Texts.purs
src/Gargantext/Components/Nodes/Texts.purs
+64
-87
Router.purs
src/Gargantext/Components/Router.purs
+36
-108
Tab.purs
src/Gargantext/Components/Tab.purs
+5
-5
Table.purs
src/Gargantext/Components/Table.purs
+4
-4
TopBar.purs
src/Gargantext/Components/TopBar.purs
+7
-8
REST.purs
src/Gargantext/Config/REST.purs
+7
-5
Loader.purs
src/Gargantext/Hooks/Loader.purs
+17
-10
No files found.
src/Gargantext/Components/App/Data.purs
View file @
c10a6d14
...
@@ -15,7 +15,7 @@ import Gargantext.Routes (AppRoute(Home))
...
@@ -15,7 +15,7 @@ import Gargantext.Routes (AppRoute(Home))
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions (Session, Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Sessions.Types (OpenNodes(..))
import Gargantext.Types (FrontendError
(..)
, Handed(RightHanded), SidePanelState(..))
import Gargantext.Types (FrontendError, Handed(RightHanded), SidePanelState(..))
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
type App =
type App =
...
...
src/Gargantext/Components/DocsTable.purs
View file @
c10a6d14
-- TODO: this module should be replaced by FacetsTable
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.DocsTable where
module Gargantext.Components.DocsTable where
import Gargantext.Prelude
import DOM.Simple.Console (log2)
import DOM.Simple.Console (log2)
import DOM.Simple.Event as DE
import DOM.Simple.Event as DE
import Data.Array as A
import Data.Array as A
...
@@ -21,6 +23,7 @@ import Data.Tuple (Tuple(..))
...
@@ -21,6 +23,7 @@ import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category (rating)
import Gargantext.Components.Category.Types (Star(..))
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)
...
@@ -31,7 +34,6 @@ import Gargantext.Components.Table.Types as TT
...
@@ -31,7 +34,6 @@ import Gargantext.Components.Table.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Hooks.Loader (useLoader, useLoaderWithCacheAPI, HashedResponse(..))
import Gargantext.Prelude
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes (SessionRoute(NodeAPI))
import Gargantext.Routes as Routes
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, get, delete)
import Gargantext.Sessions (Session, sessionId, get, delete)
...
@@ -60,15 +62,14 @@ type Path a =
...
@@ -60,15 +62,14 @@ type Path a =
)
)
type CommonProps =
type CommonProps =
(
cacheState :: T.Box NT.CacheState
(
boxes :: Boxes
,
errors :: T.Box (Array FrontendError)
,
cacheState :: T.Box NT.CacheState
, frontends :: Frontends
, frontends :: Frontends
, listId :: Int
, listId :: Int
, mCorpusId :: Maybe Int
, mCorpusId :: Maybe Int
, nodeId :: Int
, nodeId :: Int
, session :: Session
, session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tabType :: TabType
, tabType :: TabType
-- ^ tabType is not ideal here since it is too much entangled with tabs and
-- ^ tabType is not ideal here since it is too much entangled with tabs and
-- ngramtable. Let's see how this evolves. )
-- ngramtable. Let's see how this evolves. )
...
@@ -77,16 +78,14 @@ type CommonProps =
...
@@ -77,16 +78,14 @@ type CommonProps =
)
)
type LayoutProps =
type LayoutProps =
(
( chart :: R.Element
chart :: R.Element
, showSearch :: Boolean
, showSearch :: Boolean
| CommonProps
| CommonProps
-- , path :: Record (Path a)
-- , path :: Record (Path a)
)
)
type PageLayoutProps =
type PageLayoutProps =
(
( key :: String -- NOTE Necessary to clear the component when cache state changes
key :: String -- NOTE Necessary to clear the component when cache state changes
, params :: TT.Params
, params :: TT.Params
, query :: Query
, query :: Query
| CommonProps
| CommonProps
...
@@ -115,9 +114,9 @@ docView :: R2.Component Props
...
@@ -115,9 +114,9 @@ docView :: R2.Component Props
docView = R.createElement docViewCpt
docView = R.createElement docViewCpt
docViewCpt :: R.Component Props
docViewCpt :: R.Component Props
docViewCpt = here.component "docView" cpt where
docViewCpt = here.component "docView" cpt where
cpt { layout: { cacheState
cpt { layout: { boxes
, cacheState
, chart
, chart
, errors
, frontends
, frontends
, listId
, listId
, mCorpusId
, mCorpusId
...
@@ -125,7 +124,6 @@ docViewCpt = here.component "docView" cpt where
...
@@ -125,7 +124,6 @@ docViewCpt = here.component "docView" cpt where
, session
, session
, showSearch
, showSearch
, sidePanel
, sidePanel
, sidePanelState
, tabType
, tabType
, totalRecords
, totalRecords
, yearFilter
, yearFilter
...
@@ -141,8 +139,8 @@ docViewCpt = here.component "docView" cpt where
...
@@ -141,8 +139,8 @@ docViewCpt = here.component "docView" cpt where
[ chart
[ chart
, if showSearch then searchBar { query } [] else H.div {} []
, if showSearch then searchBar { query } [] else H.div {} []
, H.div {className: "col-md-12"}
, H.div {className: "col-md-12"}
[ pageLayout {
cacheState
[ pageLayout {
boxes
,
errors
,
cacheState
, frontends
, frontends
, key: "docView-" <> (show cacheState')
, key: "docView-" <> (show cacheState')
, listId
, listId
...
@@ -152,7 +150,6 @@ docViewCpt = here.component "docView" cpt where
...
@@ -152,7 +150,6 @@ docViewCpt = here.component "docView" cpt where
, query: query'
, query: query'
, session
, session
, sidePanel
, sidePanel
, sidePanelState
, tabType
, tabType
, totalRecords
, totalRecords
, yearFilter
, yearFilter
...
@@ -262,9 +259,8 @@ pageLayout :: R2.Component PageLayoutProps
...
@@ -262,9 +259,8 @@ pageLayout :: R2.Component PageLayoutProps
pageLayout = R.createElement pageLayoutCpt
pageLayout = R.createElement pageLayoutCpt
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = here.component "pageLayout" cpt where
pageLayoutCpt = here.component "pageLayout" cpt where
cpt props@{ cacheState
cpt props@{ boxes
, errors
, cacheState
, frontends
, listId
, listId
, mCorpusId
, mCorpusId
, nodeId
, nodeId
...
@@ -298,16 +294,16 @@ pageLayoutCpt = here.component "pageLayout" cpt where
...
@@ -298,16 +294,16 @@ pageLayoutCpt = here.component "pageLayout" cpt where
case cacheState' of
case cacheState' of
NT.CacheOn -> do
NT.CacheOn -> do
let paint (Tuple count docs) = page {
documents: doc
s
let paint (Tuple count docs) = page {
boxe
s
,
error
s
,
documents: doc
s
, layout: props { totalRecords = count }
, layout: props { totalRecords = count }
, params } []
, params } []
mkRequest :: PageParams -> GUC.Request
mkRequest :: PageParams -> GUC.Request
mkRequest p = GUC.makeGetRequest session $ tableRoute p
mkRequest p = GUC.makeGetRequest session $ tableRoute p
useLoaderWithCacheAPI
{
useLoaderWithCacheAPI
cacheEndpoint: getPageHash session
{ boxes
,
errors
,
cacheEndpoint: getPageHash session
, handleResponse
, handleResponse
, mkRequest
, mkRequest
, path
, path
...
@@ -335,9 +331,9 @@ pageLayoutCpt = here.component "pageLayout" cpt where
...
@@ -335,9 +331,9 @@ pageLayoutCpt = here.component "pageLayout" cpt where
, loader
, loader
, render }
, render }
type PageProps =
(
type PageProps =
documents :: Array DocumentsView
( boxes :: Boxes
,
errors :: T.Box (Array FrontendError)
,
documents :: Array DocumentsView
, layout :: Record PageLayoutProps
, layout :: Record PageLayoutProps
, params :: TT.Params
, params :: TT.Params
)
)
...
@@ -383,8 +379,8 @@ pagePaintCpt = here.component "pagePaintCpt" cpt
...
@@ -383,8 +379,8 @@ pagePaintCpt = here.component "pagePaintCpt" cpt
filteredRows params' = TT.filterRows { params: params' } $ (orderWith params') $ A.toUnfoldable documents
filteredRows params' = TT.filterRows { params: params' } $ (orderWith params') $ A.toUnfoldable documents
type PagePaintRawProps =
(
type PagePaintRawProps =
documents :: Array DocumentsView
(
documents :: Array DocumentsView
, layout :: Record PageLayoutProps
, layout :: Record PageLayoutProps
, localCategories :: T.Box LocalUserScore
, localCategories :: T.Box LocalUserScore
, params :: T.Box TT.Params
, params :: T.Box TT.Params
...
@@ -392,21 +388,19 @@ type PagePaintRawProps = (
...
@@ -392,21 +388,19 @@ type PagePaintRawProps = (
pagePaintRaw :: R2.Component PagePaintRawProps
pagePaintRaw :: R2.Component PagePaintRawProps
pagePaintRaw = R.createElement pagePaintRawCpt
pagePaintRaw = R.createElement pagePaintRawCpt
pagePaintRawCpt :: R.Component PagePaintRawProps
pagePaintRawCpt :: R.Component PagePaintRawProps
pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
cpt { documents
cpt { documents
, layout: { frontends
, layout: { boxes
, frontends
, listId
, listId
, mCorpusId
, mCorpusId
, nodeId
, nodeId
, session
, session
, sidePanel
, sidePanel
, sidePanelState
, totalRecords }
, totalRecords }
, localCategories
, localCategories
, params } _ = do
, params } _ = do
reload <- T.useBox T2.newReload
mCurrentDocId <- T.useFocused
mCurrentDocId <- T.useFocused
(maybe Nothing _.mCurrentDocId)
(maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
...
@@ -416,17 +410,15 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -416,17 +410,15 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
pure $ TT.table
pure $ TT.table
{ colNames
{ colNames
, container: TT.defaultContainer
{ title: "Documents" }
, container: TT.defaultContainer
, params
, params
, rows: rows
reload
localCategories' mCurrentDocId'
, rows: rows localCategories' mCurrentDocId'
, syncResetButton : [ H.div {} [] ]
, syncResetButton : [ H.div {} [] ]
, totalRecords
, totalRecords
, wrapColElts
, wrapColElts
}
}
where
where
sid = sessionId session
sid = sessionId session
gi Star_1 = "fa fa-star"
gi _ = "fa fa-star-empty"
trashClassName Star_0 _ = "trash"
trashClassName Star_0 _ = "trash"
trashClassName _ true = "active"
trashClassName _ true = "active"
trashClassName _ false = ""
trashClassName _ false = ""
...
@@ -435,18 +427,17 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -435,18 +427,17 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
| otherwise = Routes.Document sid listId
| otherwise = Routes.Document sid listId
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
colNames = TT.ColumnName <$> [ "Show", "Tag", "Date", "Title", "Source", "Score" ]
wrapColElts = const identity
wrapColElts = const identity
rows
reload
localCategories' mCurrentDocId' = row <$> A.toUnfoldable documents
rows localCategories' mCurrentDocId' = row <$> A.toUnfoldable documents
where
where
row dv@(DocumentsView r@{ _id, category }) =
row dv@(DocumentsView r@{ _id, category }) =
{ row:
{ row:
TT.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
TT.makeRow [ -- H.div {} [ H.a { className, style, on: {click: click Favorite} } [] ]
H.div { className: "" }
H.div { className: "" }
[ docChooser { listId
[ docChooser { boxes
, listId
, mCorpusId
, mCorpusId
, nodeId: r._id
, nodeId: r._id
, sidePanel
, sidePanel } []
, sidePanelState
, tableReload: reload } []
]
]
--, H.div { className: "column-tag flex" } [ caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } [] ]
--, H.div { className: "column-tag flex" } [ caroussel { category: cat, nodeId, row: dv, session, setLocalCategories } [] ]
, H.div { className: "column-tag flex" }
, H.div { className: "column-tag flex" }
...
@@ -471,32 +462,28 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
...
@@ -471,32 +462,28 @@ pagePaintRawCpt = here.component "pagePaintRawCpt" cpt where
-- checked = Star_1 == cat
-- checked = Star_1 == cat
selected = mCurrentDocId' == Just r._id
selected = mCurrentDocId' == Just r._id
tClassName = trashClassName cat selected
tClassName = trashClassName cat selected
className = gi cat
type DocChooser = (
type DocChooser = (
listId :: ListId
boxes :: Boxes
, listId :: ListId
, mCorpusId :: Maybe NodeID
, mCorpusId :: Maybe NodeID
, nodeId :: NodeID
, nodeId :: NodeID
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tableReload :: T2.ReloadS
)
)
docChooser :: R2.Component DocChooser
docChooser :: R2.Component DocChooser
docChooser = R.createElement docChooserCpt
docChooser = R.createElement docChooserCpt
docChooserCpt :: R.Component DocChooser
docChooserCpt :: R.Component DocChooser
docChooserCpt = here.component "docChooser" cpt
docChooserCpt = here.component "docChooser" cpt
where
where
cpt { mCorpusId: Nothing } _ = do
cpt { mCorpusId: Nothing } _ = do
pure $ H.div {} []
pure $ H.div {} []
cpt { listId
cpt { boxes: { sidePanelState }
, listId
, mCorpusId: Just corpusId
, mCorpusId: Just corpusId
, nodeId
, nodeId
, sidePanel
, sidePanel } _ = do
, sidePanelState
, tableReload } _ = do
mCurrentDocId <- T.useFocused
mCurrentDocId <- T.useFocused
(maybe Nothing _.mCurrentDocId)
(maybe Nothing _.mCurrentDocId)
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
(\val -> maybe Nothing (\sp -> Just $ sp { mCurrentDocId = val })) sidePanel
...
...
src/Gargantext/Components/FolderView.purs
View file @
c10a6d14
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest.purs
View file @
c10a6d14
module Gargantext.Components.Forest
module Gargantext.Components.Forest
( forest
( forest
, forestLayout
, forestLayout
, Common
, Props
, Props
) where
) where
...
@@ -9,62 +8,33 @@ import Gargantext.Prelude
...
@@ -9,62 +8,33 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree (treeLoader)
import Gargantext.Components.Forest.Tree (treeLoader)
import Gargantext.Ends (Frontends, Backend)
import Gargantext.Ends (Frontends)
import Gargantext.Routes (AppRoute)
import Gargantext.Sessions (Session(..), unSessions)
import Gargantext.Sessions (Session(..), Sessions, OpenNodes, unSessions)
import Gargantext.Types (switchHanded)
import Gargantext.Types (FrontendError, Handed, switchHanded)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record.Extra as RX
import Toestand as T
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest"
here = R2.here "Gargantext.Components.Forest"
-- Shared by components here with Tree
-- Shared by components here with Tree
type Common =
( frontends :: Frontends
, handed :: T.Box Handed
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, route :: T.Box AppRoute
)
type Props =
type Props =
( backend :: T.Box (Maybe Backend)
( boxes :: Boxes
, errors :: T.Box (Array FrontendError)
, frontends :: Frontends
, forestOpen :: T.Box OpenNodes
, reloadForest :: T2.ReloadS
, sessions :: T.Box Sessions
, showLogin :: T.Box Boolean
, tasks :: T.Box GAT.Storage
| Common
)
type TreeExtra = (
forestOpen :: T.Box OpenNodes
)
)
forest :: R2.Component Props
forest :: R2.Component Props
forest = R.createElement forestCpt
forest = R.createElement forestCpt
forestCpt :: R.Component Props
forestCpt :: R.Component Props
forestCpt = here.component "forest" cpt where
forestCpt = here.component "forest" cpt where
cpt props@{ backend
cpt { boxes: boxes@{ handed
, errors
, reloadForest
, forestOpen
, sessions }
, frontends
, frontends } _ = do
, handed
, reloadForest
, reloadMainPage
, reloadRoot
, route
, sessions
, showLogin
, tasks } _ = do
-- TODO Fix this. I think tasks shouldn't be a Box but only a Reductor
-- TODO Fix this. I think tasks shouldn't be a Box but only a Reductor
-- tasks' <- GAT.useTasks reloadRoot reloadForest
-- tasks' <- GAT.useTasks reloadRoot reloadForest
-- R.useEffect' $ do
-- R.useEffect' $ do
...
@@ -78,33 +48,24 @@ forestCpt = here.component "forest" cpt where
...
@@ -78,33 +48,24 @@ forestCpt = here.component "forest" cpt where
-- TODO If `reloadForest` is set, `reload` state should be updated
-- TODO If `reloadForest` is set, `reload` state should be updated
-- TODO fix tasks ref
-- TODO fix tasks ref
pure $ H.div { className: "forest-layout-content" }
pure $ H.div { className: "forest-layout-content" }
(A.cons (plus { b
ackend, handed, showLogin
}) (trees handed' sessions'))
(A.cons (plus { b
oxes
}) (trees handed' sessions'))
where
where
common = RX.pick props :: Record Common
trees handed' sessions' = (tree handed') <$> unSessions sessions'
trees handed' sessions' = (tree handed') <$> unSessions sessions'
tree handed' s@(Session {treeId}) =
tree handed' s@(Session { treeId }) =
treeLoader { errors
treeLoader { boxes
, forestOpen
, frontends
, frontends
, handed: handed'
, handed: handed'
, reload: reloadForest
, reload: reloadForest
, reloadMainPage
, reloadRoot
, root: treeId
, root: treeId
, route
, session: s } []
, session: s
, tasks } []
type Plus =
type Plus = ( boxes :: Boxes )
( backend :: T.Box (Maybe Backend)
, handed :: T.Box Handed
, showLogin :: T.Box Boolean )
plus :: R2.Leaf Plus
plus :: R2.Leaf Plus
plus p = R.createElement plusCpt p []
plus p = R.createElement plusCpt p []
plusCpt :: R.Component Plus
plusCpt :: R.Component Plus
plusCpt = here.component "plus" cpt where
plusCpt = here.component "plus" cpt where
cpt { b
ackend, handed, showLogin
} _ = do
cpt { b
oxes: { backend, handed, showLogin }
} _ = do
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
pure $ H.div {}
pure $ H.div {}
...
...
src/Gargantext/Components/Forest/Tree.purs
View file @
c10a6d14
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Forest/Tree/Node.purs
View file @
c10a6d14
...
@@ -5,17 +5,15 @@ import Gargantext.Prelude
...
@@ -5,17 +5,15 @@ import Gargantext.Prelude
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Nullable (null)
import Data.Nullable (null)
import Data.Symbol (SProxy(..))
import Data.Symbol (SProxy(..))
import Data.Tuple (fst, snd)
import Data.Tuple.Nested ((/\))
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload (DroppedFile(..), fileTypeView)
import Gargantext.Components.Forest.Tree.Node.Action.Upload (DroppedFile(..), fileTypeView)
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileBlob(..))
import Gargantext.Components.Forest.Tree.Node.Action.Upload.Types (FileType(..), UploadFileBlob(..))
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Box (nodePopupView)
import Gargantext.Components.Forest.Tree.Node.Box.Types (CommonProps)
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Settings (SettingsBox(..), settingsBox)
import Gargantext.Components.Forest.Tree.Node.Tools (nodeLink)
import Gargantext.Components.Forest.Tree.Node.Tools (nodeLink)
import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (asyncProgressBar, BarType(..))
import Gargantext.Components.Forest.Tree.Node.Tools.ProgressBar (asyncProgressBar, BarType(..))
...
@@ -27,7 +25,7 @@ import Gargantext.Ends (Frontends)
...
@@ -27,7 +25,7 @@ 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 (Session, sessionId)
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types (
FrontendError,
ID, Name, reverseHanded)
import Gargantext.Types (ID, Name, reverseHanded)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Popover as Popover
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
...
@@ -44,20 +42,17 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node"
...
@@ -44,20 +42,17 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node"
-- Main Node
-- Main Node
type NodeMainSpanProps =
type NodeMainSpanProps =
( errors :: T.Box (Array FrontendError)
( boxes :: Boxes
, folderOpen :: T.Box Boolean
, dispatch :: Action -> Aff Unit
, frontends :: Frontends
, folderOpen :: T.Box Boolean
, id :: ID
, frontends :: Frontends
, isLeaf :: IsLeaf
, id :: ID
, name :: Name
, isLeaf :: IsLeaf
, nodeType :: GT.NodeType
, name :: Name
, reload :: T2.ReloadS
, nodeType :: GT.NodeType
, reloadMainPage :: T2.ReloadS
, reload :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, session :: Session
, route :: T.Box Routes.AppRoute
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, setPopoverRef :: R.Ref (Maybe (Boolean -> Effect Unit))
, tasks :: T.Box GAT.Storage
| CommonProps
)
)
type IsLeaf = Boolean
type IsLeaf = Boolean
...
@@ -67,8 +62,9 @@ nodeSpan = R.createElement nodeSpanCpt
...
@@ -67,8 +62,9 @@ nodeSpan = R.createElement nodeSpanCpt
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt :: R.Component NodeMainSpanProps
nodeSpanCpt = here.component "nodeSpan" cpt
nodeSpanCpt = here.component "nodeSpan" cpt
where
where
cpt props@{ handed } children = do
cpt props@{ boxes: { handed } } children = do
let className = case handed of
handed' <- T.useLive T.unequal handed
let className = case handed' of
GT.LeftHanded -> "lefthanded"
GT.LeftHanded -> "lefthanded"
GT.RightHanded -> "righthanded"
GT.RightHanded -> "righthanded"
...
@@ -79,23 +75,23 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
...
@@ -79,23 +75,23 @@ nodeMainSpan = R.createElement nodeMainSpanCpt
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt :: R.Component NodeMainSpanProps
nodeMainSpanCpt = here.component "nodeMainSpan" cpt
nodeMainSpanCpt = here.component "nodeMainSpan" cpt
where
where
cpt props@{ dispatch
cpt props@{ boxes: boxes@{ errors
, errors
, handed
, reloadMainPage
, reloadRoot
, route
, tasks }
, dispatch
, folderOpen
, folderOpen
, frontends
, frontends
, handed
, id
, id
, isLeaf
, isLeaf
, name
, nodeType
, nodeType
, reload
, reload
, reloadMainPage
, reloadRoot
, route
, session
, session
, setPopoverRef
, setPopoverRef
, tasks
} _ = do
} _ = do
handed' <- T.useLive T.unequal handed
route' <- T.useLive T.unequal route
route' <- T.useLive T.unequal route
-- only 1 popup at a time is allowed to be opened
-- only 1 popup at a time is allowed to be opened
droppedFile <- T.useBox (Nothing :: Maybe DroppedFile)
droppedFile <- T.useBox (Nothing :: Maybe DroppedFile)
...
@@ -114,12 +110,12 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -114,12 +110,12 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
-- tasks' <- T.read tasks
-- tasks' <- T.read tasks
pure $ H.span (dropProps droppedFile droppedFile' isDragOver isDragOver')
pure $ H.span (dropProps droppedFile droppedFile' isDragOver isDragOver')
$ reverseHanded handed
$ reverseHanded handed
'
[ folderIcon { folderOpen, nodeType } []
[ folderIcon { folderOpen, nodeType } []
, chevronIcon { folderOpen, handed, isLeaf, nodeType } []
, chevronIcon { folderOpen, handed, isLeaf, nodeType } []
, nodeLink { frontends
, nodeLink { boxes
, handed
, folderOpen
, folderOpen
, frontends
, id
, id
, isSelected
, isSelected
, name: name' props
, name: name' props
...
@@ -129,10 +125,10 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -129,10 +125,10 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType }
, fileTypeView { dispatch, droppedFile, id, isDragOver, nodeType }
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, H.div {} (map (\t -> asyncProgressBar { asyncTask: t
, barType: Pie
, barType: Pie
, errors
, errors
, nodeId: id
, nodeId: id
, onFinish: onTaskFinish id t
, onFinish: onTaskFinish id t
, session } []
, session } []
) currentTasks'
) currentTasks'
)
)
, if nodeType == GT.NodeUser
, if nodeType == GT.NodeUser
...
@@ -187,9 +183,14 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
...
@@ -187,9 +183,14 @@ nodeMainSpanCpt = here.component "nodeMainSpan" cpt
name' {name: n, nodeType: nt} = if nt == GT.NodeUser then show session else n
name' {name: n, nodeType: nt} = if nt == GT.NodeUser then show session else n
mNodePopupView props'@{ id: i, nodeType: nt, handed: h } opc =
mNodePopupView props'@{ boxes: b, id: i, nodeType: nt } opc =
nodePopupView { dispatch, errors, handed: h, id: i, name: name' props'
nodePopupView { boxes: b
, nodeType: nt, onPopoverClose: opc, session }
, dispatch
, id: i
, name: name' props'
, nodeType: nt
, onPopoverClose: opc
, session }
popOverIcon =
popOverIcon =
H.a { className: "settings fa fa-cog"
H.a { className: "settings fa fa-cog"
...
@@ -234,7 +235,6 @@ type FolderIconProps = (
...
@@ -234,7 +235,6 @@ type FolderIconProps = (
folderIcon :: R2.Component FolderIconProps
folderIcon :: R2.Component FolderIconProps
folderIcon = R.createElement folderIconCpt
folderIcon = R.createElement folderIconCpt
folderIconCpt :: R.Component FolderIconProps
folderIconCpt :: R.Component FolderIconProps
folderIconCpt = here.component "folderIcon" cpt
folderIconCpt = here.component "folderIcon" cpt
where
where
...
@@ -245,27 +245,27 @@ folderIconCpt = here.component "folderIcon" cpt
...
@@ -245,27 +245,27 @@ folderIconCpt = here.component "folderIcon" cpt
type ChevronIconProps = (
type ChevronIconProps = (
folderOpen :: T.Box Boolean
folderOpen :: T.Box Boolean
, handed :: GT.Handed
, handed ::
T.Box
GT.Handed
, isLeaf :: Boolean
, isLeaf :: Boolean
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
)
)
chevronIcon :: R2.Component ChevronIconProps
chevronIcon :: R2.Component ChevronIconProps
chevronIcon = R.createElement chevronIconCpt
chevronIcon = R.createElement chevronIconCpt
chevronIconCpt :: R.Component ChevronIconProps
chevronIconCpt :: R.Component ChevronIconProps
chevronIconCpt = here.component "chevronIcon" cpt
chevronIconCpt = here.component "chevronIcon" cpt
where
where
cpt { folderOpen, handed, isLeaf: true, nodeType } _ = do
cpt { folderOpen, handed, isLeaf: true, nodeType } _ = do
pure $ H.div {} []
pure $ H.div {} []
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do
cpt { folderOpen, handed, isLeaf: false, nodeType } _ = do
handed' <- T.useLive T.unequal handed
open <- T.useLive T.unequal folderOpen
open <- T.useLive T.unequal folderOpen
pure $ H.a { className: "chevron-icon"
pure $ H.a { className: "chevron-icon"
, on: { click: \_ -> T.modify_ not folderOpen }
, on: { click: \_ -> T.modify_ not folderOpen }
}
}
[ H.i { className: if open
[ H.i { className: if open
then "fa fa-chevron-down"
then "fa fa-chevron-down"
else if handed == GT.RightHanded
else if handed
'
== GT.RightHanded
then "fa fa-chevron-right"
then "fa fa-chevron-right"
else "fa fa-chevron-left"
else "fa fa-chevron-left"
} [] ]
} [] ]
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Link.purs
View file @
c10a6d14
...
@@ -48,7 +48,7 @@ linkNode = R.createElement linkNodeCpt
...
@@ -48,7 +48,7 @@ linkNode = R.createElement linkNodeCpt
linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt :: R.Component SubTreeParamsIn
linkNodeCpt = here.component "linkNode" cpt
linkNodeCpt = here.component "linkNode" cpt
where
where
cpt {
dispatch, handed
, id, nodeType, session, subTreeParams } _ = do
cpt {
boxes, dispatch
, id, nodeType, session, subTreeParams } _ = do
action <- T.useBox (LinkNode { nodeType: Nothing, params: Nothing})
action <- T.useBox (LinkNode { nodeType: Nothing, params: Nothing})
action' <- T.useLive T.unequal action
action' <- T.useLive T.unequal action
...
@@ -60,8 +60,8 @@ linkNodeCpt = here.component "linkNode" cpt
...
@@ -60,8 +60,8 @@ linkNodeCpt = here.component "linkNode" cpt
pure $ panel [
pure $ panel [
subTreeView { action
subTreeView { action
, boxes
, dispatch
, dispatch
, handed
, id
, id
, nodeType
, nodeType
, session
, session
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Merge.purs
View file @
c10a6d14
...
@@ -31,7 +31,7 @@ mergeNode = R.createElement mergeNodeCpt
...
@@ -31,7 +31,7 @@ mergeNode = R.createElement mergeNodeCpt
mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt :: R.Component SubTreeParamsIn
mergeNodeCpt = here.component "mergeNode" cpt
mergeNodeCpt = here.component "mergeNode" cpt
where
where
cpt {
dispatch, subTreeParams, id, nodeType, session, handed
} _ = do
cpt {
boxes, dispatch, id, nodeType, session, subTreeParams
} _ = do
action <- T.useBox (MergeNode { params: Nothing })
action <- T.useBox (MergeNode { params: Nothing })
action' <- T.useLive T.unequal action
action' <- T.useLive T.unequal action
...
@@ -46,8 +46,8 @@ mergeNodeCpt = here.component "mergeNode" cpt
...
@@ -46,8 +46,8 @@ mergeNodeCpt = here.component "mergeNode" cpt
pure $ panel
pure $ panel
[ subTreeView { action
[ subTreeView { action
, boxes
, dispatch
, dispatch
, handed
, id
, id
, nodeType
, nodeType
, session
, session
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Move.purs
View file @
c10a6d14
...
@@ -30,7 +30,7 @@ moveNode = R.createElement moveNodeCpt
...
@@ -30,7 +30,7 @@ moveNode = R.createElement moveNodeCpt
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt :: R.Component SubTreeParamsIn
moveNodeCpt = here.component "moveNode" cpt
moveNodeCpt = here.component "moveNode" cpt
where
where
cpt {
dispatch, handed
, id, nodeType, session, subTreeParams } _ = do
cpt {
boxes, dispatch
, id, nodeType, session, subTreeParams } _ = do
action :: T.Box Action <- T.useBox (MoveNode {params: Nothing})
action :: T.Box Action <- T.useBox (MoveNode {params: Nothing})
action' <- T.useLive T.unequal action
action' <- T.useLive T.unequal action
...
@@ -43,11 +43,11 @@ moveNodeCpt = here.component "moveNode" cpt
...
@@ -43,11 +43,11 @@ moveNodeCpt = here.component "moveNode" cpt
pure $
pure $
panel [ subTreeView { action
panel [ subTreeView { action
, dispatch
, boxes
, handed
, dispatch
, id
, id
, nodeType
, nodeType
, session
, session
, subTreeParams
, subTreeParams
} []
} []
] button
] button
src/Gargantext/Components/Forest/Tree/Node/Action/Search.purs
View file @
c10a6d14
...
@@ -5,13 +5,14 @@ import Gargantext.Prelude
...
@@ -5,13 +5,14 @@ import Gargantext.Prelude
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff)
import Effect.Aff (Aff, launchAff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action (Action(..))
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchBar (searchBar)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Forest.Tree.Node.Action.Search.SearchField (defaultSearch)
import Gargantext.Components.Lang (allLangs)
import Gargantext.Components.Lang (allLangs)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (
FrontendError,
ID)
import Gargantext.Types (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 as R
...
@@ -23,8 +24,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search"
...
@@ -23,8 +24,8 @@ here = R2.here "Gargantext.Components.Forest.Tree.Node.Action.Search"
type Props =
type Props =
(
dispatch :: Action -> Aff Unit
(
boxes :: Boxes
,
errors :: T.Box (Array FrontendError)
,
dispatch :: Action -> Aff Unit
, id :: Maybe ID
, id :: Maybe ID
, nodePopup :: Maybe NodePopup
, nodePopup :: Maybe NodePopup
, session :: Session )
, session :: Session )
...
@@ -35,7 +36,7 @@ actionSearch = R.createElement actionSearchCpt
...
@@ -35,7 +36,7 @@ actionSearch = R.createElement actionSearchCpt
actionSearchCpt :: R.Component Props
actionSearchCpt :: R.Component Props
actionSearchCpt = here.component "actionSearch" cpt
actionSearchCpt = here.component "actionSearch" cpt
where
where
cpt {
dispatch, errors
, id, nodePopup, session } _ = do
cpt {
boxes: { errors }, dispatch
, id, nodePopup, session } _ = do
search <- T.useBox $ defaultSearch { node_id = id }
search <- T.useBox $ defaultSearch { node_id = id }
pure $ R.fragment [ H.p { className: "action-search" }
pure $ R.fragment [ H.p { className: "action-search" }
[ H.text $ "Search and create a private "
[ H.text $ "Search and create a private "
...
...
src/Gargantext/Components/Forest/Tree/Node/Action/Share.purs
View file @
c10a6d14
...
@@ -71,7 +71,7 @@ publishNode = R.createElement publishNodeCpt
...
@@ -71,7 +71,7 @@ publishNode = R.createElement publishNodeCpt
publishNodeCpt :: R.Component SubTreeParamsIn
publishNodeCpt :: R.Component SubTreeParamsIn
publishNodeCpt = here.component "publishNode" cpt
publishNodeCpt = here.component "publishNode" cpt
where
where
cpt {
dispatch, handed
, id, nodeType, session, subTreeParams } _ = do
cpt {
boxes, dispatch
, id, nodeType, session, subTreeParams } _ = do
action <- T.useBox (Action.SharePublic { params: Nothing })
action <- T.useBox (Action.SharePublic { params: Nothing })
action' <- T.useLive T.unequal action
action' <- T.useLive T.unequal action
...
@@ -83,8 +83,8 @@ publishNodeCpt = here.component "publishNode" cpt
...
@@ -83,8 +83,8 @@ publishNodeCpt = here.component "publishNode" cpt
pure $ Tools.panel
pure $ Tools.panel
[ subTreeView { action
[ subTreeView { action
, boxes
, dispatch
, dispatch
, handed
, id
, id
, nodeType
, nodeType
, session
, session
...
...
src/Gargantext/Components/Forest/Tree/Node/Box.purs
View file @
c10a6d14
...
@@ -5,6 +5,7 @@ import Gargantext.Prelude
...
@@ -5,6 +5,7 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Add (NodePopup(..), addNodeView)
import Gargantext.Components.Forest.Tree.Node.Action.Contact as Contact
import Gargantext.Components.Forest.Tree.Node.Action.Contact as Contact
...
@@ -102,9 +103,16 @@ nodePopupCpt = here.component "nodePopupView" cpt where
...
@@ -102,9 +103,16 @@ nodePopupCpt = here.component "nodePopupView" cpt where
else []
else []
mPanelAction :: Record NodePopupS -> Record NodePopupProps -> R.Element
mPanelAction :: Record NodePopupS -> Record NodePopupProps -> R.Element
mPanelAction { action: Just action }
mPanelAction { action: Just action }
{ dispatch, errors, id, name, nodeType, session, handed } =
{ boxes, dispatch, id, name, nodeType, session } =
panelAction { action, dispatch, errors, id, name, nodeType, session
panelAction { action
, handed, nodePopup: Just NodePopup }
, boxes
, dispatch
, id
, name
, nodePopup: Just NodePopup
, nodeType
, session
}
mPanelAction { action: Nothing } _ =
mPanelAction { action: Nothing } _ =
H.div { className: "card-footer" }
H.div { className: "card-footer" }
[ H.div {className:"center fa-hand-pointer-o"}
[ H.div {className:"center fa-hand-pointer-o"}
...
@@ -160,15 +168,14 @@ type NodeProps =
...
@@ -160,15 +168,14 @@ type NodeProps =
type PanelActionProps =
type PanelActionProps =
( id :: ID
( action :: NodeAction
, action :: NodeAction
, boxes :: Boxes
, id :: ID
, dispatch :: Action -> Aff Unit
, dispatch :: Action -> Aff Unit
, errors :: T.Box (Array FrontendError)
, name :: Name
, name :: Name
, nodePopup :: Maybe NodePopup
, nodePopup :: Maybe NodePopup
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
, session :: Session
, session :: Session
, handed :: GT.Handed
)
)
panelAction :: R2.Leaf PanelActionProps
panelAction :: R2.Leaf PanelActionProps
...
@@ -186,16 +193,16 @@ panelActionCpt = here.component "panelAction" cpt
...
@@ -186,16 +193,16 @@ panelActionCpt = here.component "panelAction" cpt
cpt {action: Config , dispatch, id, nodeType, session} _ =
cpt {action: Config , dispatch, id, nodeType, session} _ =
pure $ fragmentPT $ "Config " <> show nodeType
pure $ fragmentPT $ "Config " <> show nodeType
-- Functions using SubTree
-- Functions using SubTree
cpt {
action: Merge {subTreeParams}, dispatch, id, nodeType, session, handed
} _ =
cpt {
action: Merge {subTreeParams}, boxes, dispatch, id, nodeType, session
} _ =
pure $ mergeNode {
dispatch, id, nodeType, session, subTreeParams, handed
} []
pure $ mergeNode {
boxes, dispatch, id, nodeType, session, subTreeParams
} []
cpt {action: Move {subTreeParams},
dispatch, id, nodeType, session, handed
} _ =
cpt {action: Move {subTreeParams},
boxes, dispatch, id, nodeType, session
} _ =
pure $ moveNode {
dispatch, id, nodeType, session, subTreeParams, handed
} []
pure $ moveNode {
boxes, dispatch, id, nodeType, session, subTreeParams
} []
cpt {action: Link {subTreeParams},
dispatch, id, nodeType, session, handed
} _ =
cpt {action: Link {subTreeParams},
boxes, dispatch, id, nodeType, session
} _ =
pure $ linkNode {
dispatch, id, nodeType, session, subTreeParams, handed
} []
pure $ linkNode {
boxes, dispatch, id, nodeType, session, subTreeParams
} []
cpt {action : Share, dispatch, id, name } _ = pure $ Share.shareNode { dispatch, id } []
cpt {action : Share, dispatch, id, name } _ = pure $ Share.shareNode { dispatch, id } []
cpt {action : AddingContact, dispatch, id, name } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt {action : AddingContact, dispatch, id, name } _ = pure $ Contact.actionAddContact { dispatch, id } []
cpt {action : Publish {subTreeParams},
dispatch, id, nodeType, session, handed
} _ =
cpt {action : Publish {subTreeParams},
boxes, dispatch, id, nodeType, session
} _ =
pure $ Share.publishNode {
dispatch, handed
, id, nodeType, session, subTreeParams } []
pure $ Share.publishNode {
boxes, dispatch
, id, nodeType, session, subTreeParams } []
cpt props@{action: SearchBox,
error
s, id, session, dispatch, nodePopup} _ =
cpt props@{action: SearchBox,
boxe
s, id, session, dispatch, nodePopup} _ =
pure $ actionSearch {
dispatch, errors
, id: (Just id), nodePopup, session } []
pure $ actionSearch {
boxes, dispatch
, id: (Just id), nodePopup, session } []
cpt _ _ = pure $ H.div {} []
cpt _ _ = pure $ H.div {} []
src/Gargantext/Components/Forest/Tree/Node/Box/Types.purs
View file @
c10a6d14
...
@@ -4,22 +4,21 @@ import DOM.Simple as DOM
...
@@ -4,22 +4,21 @@ import DOM.Simple as DOM
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Action (Action)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction)
import Gargantext.Components.Forest.Tree.Node.Settings (NodeAction)
import Gargantext.Prelude (Unit)
import Gargantext.Prelude (Unit)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (
FrontendError,
ID, Name)
import Gargantext.Types (ID, Name)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Toestand as T
type CommonProps =
type CommonProps =
( dispatch :: Action -> Aff Unit
( dispatch :: Action -> Aff Unit
, session :: Session
, session :: Session
, handed :: GT.Handed
)
)
type NodePopupProps =
type NodePopupProps =
(
errors :: T.Box (Array FrontendError)
(
boxes :: Boxes
, id :: ID
, id :: ID
, name :: Name
, name :: Name
, nodeType :: GT.NodeType
, nodeType :: GT.NodeType
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools.purs
View file @
c10a6d14
module Gargantext.Components.Forest.Tree.Node.Tools where
module Gargantext.Components.Forest.Tree.Node.Tools where
import Gargantext.Prelude
( class Ord, class Read, class Show, Unit
, bind, const, discard, map, not, pure, read, show, when, mempty
, ($), (<), (<<<), (<>), (<$>), (<*>) )
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Maybe (fromMaybe, Maybe(..))
import Data.Nullable (null)
import Data.Nullable (null)
import Data.Set (Set)
import Data.Set (Set)
...
@@ -12,19 +8,20 @@ import Data.String as S
...
@@ -12,19 +8,20 @@ import Data.String as S
import Data.String.CodeUnits as DSCU
import Data.String.CodeUnits as DSCU
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff, launchAff_)
import Effect.Aff (Aff, launchAff, launchAff_)
import Reactix as R
import Gargantext.Components.App.Data (Boxes)
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action (Action, icon, text)
import Gargantext.Components.Forest.Tree.Node.Action (Action, icon, text)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Ends (Frontends, url)
import Gargantext.Ends (Frontends, url)
import Gargantext.Prelude (class Ord, class Read, class Show, Unit, bind, const, discard, map, not, pure, read, show, when, mempty, ($), (<), (<<<), (<>), (<$>), (<*>))
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Sessions (Session, sessionId)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils (toggleSet)
import Gargantext.Utils (toggleSet)
import Gargantext.Utils.Glyphicon (glyphicon)
import Gargantext.Utils.Glyphicon (glyphicon)
import Gargantext.Utils.ReactTooltip as ReactTooltip
import Gargantext.Utils.ReactTooltip as ReactTooltip
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.Tools"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools"
...
@@ -58,7 +55,6 @@ type TextInputBoxProps =
...
@@ -58,7 +55,6 @@ type TextInputBoxProps =
textInputBox :: R2.Component TextInputBoxProps
textInputBox :: R2.Component TextInputBoxProps
textInputBox = R.createElement textInputBoxCpt
textInputBox = R.createElement textInputBoxCpt
textInputBoxCpt :: R.Component TextInputBoxProps
textInputBoxCpt :: R.Component TextInputBoxProps
textInputBoxCpt = here.component "textInputBox" cpt where
textInputBoxCpt = here.component "textInputBox" cpt where
cpt { boxAction, boxName, dispatch, id, isOpen, text } _ =
cpt { boxAction, boxName, dispatch, id, isOpen, text } _ =
...
@@ -258,9 +254,9 @@ tooltipId id = "node-link-" <> show id
...
@@ -258,9 +254,9 @@ tooltipId id = "node-link-" <> show id
-- START node link
-- START node link
type NodeLinkProps = (
type NodeLinkProps = (
frontends :: Frontend
s
boxes :: Boxe
s
, folderOpen :: T.Box Boolean
, folderOpen :: T.Box Boolean
,
handed :: GT.Handed
,
frontends :: Frontends
, id :: Int
, id :: Int
, isSelected :: Boolean
, isSelected :: Boolean
, name :: GT.Name
, name :: GT.Name
...
@@ -270,13 +266,12 @@ type NodeLinkProps = (
...
@@ -270,13 +266,12 @@ type NodeLinkProps = (
nodeLink :: R2.Component NodeLinkProps
nodeLink :: R2.Component NodeLinkProps
nodeLink = R.createElement nodeLinkCpt
nodeLink = R.createElement nodeLinkCpt
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt :: R.Component NodeLinkProps
nodeLinkCpt = here.component "nodeLink" cpt
nodeLinkCpt = here.component "nodeLink" cpt
where
where
cpt { folderOpen
cpt { boxes: { handed }
, folderOpen
, frontends
, frontends
, handed
, id
, id
, isSelected
, isSelected
, name
, name
...
@@ -310,23 +305,23 @@ nodeLinkCpt = here.component "nodeLink" cpt
...
@@ -310,23 +305,23 @@ nodeLinkCpt = here.component "nodeLink" cpt
type NodeTextProps =
type NodeTextProps =
( isSelected :: Boolean
( isSelected :: Boolean
, handed :: GT.Handed
, handed ::
T.Box
GT.Handed
, name :: GT.Name
, name :: GT.Name
)
)
nodeText :: R2.Component NodeTextProps
nodeText :: R2.Component NodeTextProps
nodeText = R.createElement nodeTextCpt
nodeText = R.createElement nodeTextCpt
nodeTextCpt :: R.Component NodeTextProps
nodeTextCpt :: R.Component NodeTextProps
nodeTextCpt = here.component "nodeText" cpt where
nodeTextCpt = here.component "nodeText" cpt where
cpt { isSelected, handed, name } _ =
cpt { isSelected, handed, name } _ = do
handed' <- T.useLive T.unequal handed
pure $ if isSelected then
pure $ if isSelected then
H.u { className }
H.u { className }
[ H.b {}
[ H.b {}
[ H.text ("| " <> name15 name <> " | ") ]
[ H.text ("| " <> name15 name <> " | ") ]
]
]
else
else
GT.flipHanded l r handed where
GT.flipHanded l r handed
'
where
l = H.text "..."
l = H.text "..."
r = H.text (name15 name)
r = H.text (name15 name)
name_ len n =
name_ len n =
...
...
src/Gargantext/Components/Forest/Tree/Node/Tools/SubTree.purs
View file @
c10a6d14
...
@@ -6,12 +6,7 @@ import Data.Array as A
...
@@ -6,12 +6,7 @@ import Data.Array as A
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 React.SyntheticEvent as E
import Gargantext.Components.App.Data (Boxes)
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Gargantext.Components.Forest.Tree.Node.Action (Props, Action, subTreeOut, setTreeOut)
import Gargantext.Components.Forest.Tree.Node.Action (Props, Action, subTreeOut, setTreeOut)
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(..))
...
@@ -22,12 +17,17 @@ import Gargantext.Routes as GR
...
@@ -22,12 +17,17 @@ import Gargantext.Routes as GR
import Gargantext.Sessions (Session(..), get)
import Gargantext.Sessions (Session(..), get)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import React.SyntheticEvent as E
import Reactix as R
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
here :: R2.Here
here :: R2.Here
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.SubTree"
here = R2.here "Gargantext.Components.Forest.Tree.Node.Tools.SubTree"
type SubTreeParamsIn =
type SubTreeParamsIn =
(
handed :: GT.Handed
(
boxes :: Boxes
, subTreeParams :: SubTreeParams
, subTreeParams :: SubTreeParams
| Props
| Props
)
)
...
@@ -44,8 +44,8 @@ subTreeViewCpt :: R.Component SubTreeParamsProps
...
@@ -44,8 +44,8 @@ subTreeViewCpt :: R.Component SubTreeParamsProps
subTreeViewCpt = here.component "subTreeView" cpt
subTreeViewCpt = here.component "subTreeView" cpt
where
where
cpt { action
cpt { action
, boxes
, dispatch
, dispatch
, handed
, id
, id
, nodeType
, nodeType
, session
, session
...
@@ -61,8 +61,8 @@ subTreeViewCpt = here.component "subTreeView" cpt
...
@@ -61,8 +61,8 @@ subTreeViewCpt = here.component "subTreeView" cpt
, path: session
, path: session
, render: \tree ->
, render: \tree ->
subTreeViewLoaded { action
subTreeViewLoaded { action
, boxes
, dispatch
, dispatch
, handed
, id
, id
, nodeType
, nodeType
, session
, session
...
@@ -93,11 +93,12 @@ subTreeViewLoaded = R.createElement subTreeViewLoadedCpt
...
@@ -93,11 +93,12 @@ subTreeViewLoaded = R.createElement subTreeViewLoadedCpt
subTreeViewLoadedCpt :: R.Component CorpusTreeProps
subTreeViewLoadedCpt :: R.Component CorpusTreeProps
subTreeViewLoadedCpt = here.component "subTreeViewLoaded" cpt
subTreeViewLoadedCpt = here.component "subTreeViewLoaded" cpt
where
where
cpt p@{ handed } _ = do
cpt p@{ boxes: { handed } } _ = do
handed' <- T.useLive T.unequal handed
let pRender = Record.merge { render: subTreeTreeView } p
let pRender = Record.merge { render: subTreeTreeView } p
pure $ H.div {className:"tree"}
pure $ H.div {className:"tree"}
[ H.div { className: if handed == GT.RightHanded
[ H.div { className: if handed
'
== GT.RightHanded
then "righthanded"
then "righthanded"
else "lefthanded"
else "lefthanded"
}
}
...
@@ -113,12 +114,13 @@ subTreeTreeView = R2.ntCreateElement subTreeTreeViewCpt
...
@@ -113,12 +114,13 @@ subTreeTreeView = R2.ntCreateElement subTreeTreeViewCpt
subTreeTreeViewCpt :: R2.NTComponent CorpusTreeRenderProps
subTreeTreeViewCpt :: R2.NTComponent CorpusTreeRenderProps
subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where
subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where
cpt (CorpusTreeRenderProps p@{ action
cpt (CorpusTreeRenderProps p@{ action
,
handed
,
boxes: { handed }
, id
, id
, render
, render
, subTreeParams
, subTreeParams
, tree: NTree (LNode { id: targetId, name, nodeType }) ary }) _ = do
, tree: NTree (LNode { id: targetId, name, nodeType }) ary }) _ = do
action' <- T.useLive T.unequal action
action' <- T.useLive T.unequal action
handed' <- T.useLive T.unequal handed
let click e = do
let click e = do
let action'' = if not validNodeType then Nothing else Just $ SubTreeOut { in: id, out: targetId }
let action'' = if not validNodeType then Nothing else Just $ SubTreeOut { in: id, out: targetId }
...
@@ -128,7 +130,7 @@ subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where
...
@@ -128,7 +130,7 @@ subTreeTreeViewCpt = here.ntComponent "subTreeTreeView" cpt where
children = (map (\ctree -> render (CorpusTreeRenderProps (p { tree = ctree })) []) sortedAry) :: Array R.Element
children = (map (\ctree -> render (CorpusTreeRenderProps (p { tree = ctree })) []) sortedAry) :: Array R.Element
pure $ H.div {} $ GT.reverseHanded handed
pure $ H.div {} $ GT.reverseHanded handed
'
[ H.div { className: nodeClass validNodeType }
[ H.div { className: nodeClass validNodeType }
[ H.span { className: "text"
[ H.span { className: "text"
, on: { click } }
, on: { click } }
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
c10a6d14
...
@@ -16,7 +16,9 @@ import Data.Set as Set
...
@@ -16,7 +16,9 @@ import Data.Set as Set
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.GraphExplorer.Legend as Legend
import Gargantext.Components.GraphExplorer.Legend as Legend
import Gargantext.Components.GraphExplorer.Sidebar.Types as GEST
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.Lang (Lang(..))
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.NgramsTable.Core as NTC
...
@@ -43,20 +45,15 @@ here :: R2.Here
...
@@ -43,20 +45,15 @@ here :: R2.Here
here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
here = R2.here "Gargantext.Components.GraphExplorer.Sidebar"
type Common = (
type Common = (
errors :: T.Box (Array FrontendError)
boxes :: Boxes
, graphId :: NodeID
, graphId :: NodeID
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, reloadForest :: T2.ReloadS
, removedNodeIds :: T.Box SigmaxT.NodeIds
, selectedNodeIds :: T.Box SigmaxT.NodeIds
, session :: Session
, session :: Session
)
)
type Props = (
type Props = (
frontends :: Frontends
frontends :: Frontends
, graph :: SigmaxT.SGraph
, graph :: SigmaxT.SGraph
, graphVersion :: T2.ReloadS
, sideTab :: T.Box GET.SideTab
| Common
| Common
)
)
...
@@ -65,7 +62,8 @@ sidebar = R.createElement sidebarCpt
...
@@ -65,7 +62,8 @@ sidebar = R.createElement sidebarCpt
sidebarCpt :: R.Component Props
sidebarCpt :: R.Component Props
sidebarCpt = here.component "sidebar" cpt
sidebarCpt = here.component "sidebar" cpt
where
where
cpt props@{ sideTab } _ = do
cpt props@{ boxes: { sidePanelGraph } } _ = do
{ sideTab } <- GEST.focusedSidePanel sidePanelGraph
sideTab' <- T.useLive T.unequal sideTab
sideTab' <- T.useLive T.unequal sideTab
pure $ RH.div { id: "sp-container" }
pure $ RH.div { id: "sp-container" }
...
@@ -77,7 +75,7 @@ sidebarCpt = here.component "sidebar" cpt
...
@@ -77,7 +75,7 @@ sidebarCpt = here.component "sidebar" cpt
GET.SideTabCommunity -> sideTabCommunity sideTabProps []
GET.SideTabCommunity -> sideTabCommunity sideTabProps []
]
]
where
where
sideTabProps = RX.pick props :: Record
SideTab
Props
sideTabProps = RX.pick props :: Record Props
type SideTabNavProps = (
type SideTabNavProps = (
sideTab :: T.Box GET.SideTab
sideTab :: T.Box GET.SideTab
...
@@ -106,11 +104,9 @@ sideTabNavCpt = here.component "sideTabNav" cpt
...
@@ -106,11 +104,9 @@ sideTabNavCpt = here.component "sideTabNav" cpt
, on: { click: \_ -> T.write_ tab sideTab }
, on: { click: \_ -> T.write_ tab sideTab }
} [ H.text $ show tab ]
} [ H.text $ show tab ]
type SideTabProps = Props
sideTabLegend :: R2.Component Props
sideTabLegend :: R2.Component SideTabProps
sideTabLegend = R.createElement sideTabLegendCpt
sideTabLegend = R.createElement sideTabLegendCpt
sideTabLegendCpt :: R.Component
SideTab
Props
sideTabLegendCpt :: R.Component Props
sideTabLegendCpt = here.component "sideTabLegend" cpt
sideTabLegendCpt = here.component "sideTabLegend" cpt
where
where
cpt { metaData: GET.MetaData { legend } } _ = do
cpt { metaData: GET.MetaData { legend } } _ = do
...
@@ -119,13 +115,14 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt
...
@@ -119,13 +115,14 @@ sideTabLegendCpt = here.component "sideTabLegend" cpt
, documentation EN
, documentation EN
]
]
sideTabData :: R2.Component
SideTab
Props
sideTabData :: R2.Component Props
sideTabData = R.createElement sideTabDataCpt
sideTabData = R.createElement sideTabDataCpt
sideTabDataCpt :: R.Component
SideTab
Props
sideTabDataCpt :: R.Component Props
sideTabDataCpt = here.component "sideTabData" cpt
sideTabDataCpt = here.component "sideTabData" cpt
where
where
cpt props _ = do
cpt props@{ boxes: { sidePanelGraph } } _ = do
selectedNodeIds' <- T.useLive T.unequal props.selectedNodeIds
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ RH.div {}
pure $ RH.div {}
[ selectedNodes (Record.merge { nodesMap: SigmaxT.nodesGraphMap props.graph } props) []
[ selectedNodes (Record.merge { nodesMap: SigmaxT.nodesGraphMap props.graph } props) []
...
@@ -142,18 +139,20 @@ sideTabDataCpt = here.component "sideTabData" cpt
...
@@ -142,18 +139,20 @@ sideTabDataCpt = here.component "sideTabData" cpt
]
]
sideTabCommunity :: R2.Component
SideTab
Props
sideTabCommunity :: R2.Component Props
sideTabCommunity = R.createElement sideTabCommunityCpt
sideTabCommunity = R.createElement sideTabCommunityCpt
sideTabCommunityCpt :: R.Component
SideTab
Props
sideTabCommunityCpt :: R.Component Props
sideTabCommunityCpt = here.component "sideTabCommunity" cpt
sideTabCommunityCpt = here.component "sideTabCommunity" cpt
where
where
cpt props _ = do
cpt props@{ boxes: { sidePanelGraph }
selectedNodeIds' <- T.useLive T.unequal props.selectedNodeIds
, frontends } _ = do
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ RH.div { className: "col-md-12", id: "query" }
pure $ RH.div { className: "col-md-12", id: "query" }
[ selectedNodes (Record.merge { nodesMap: SigmaxT.nodesGraphMap props.graph } props) []
[ selectedNodes (Record.merge { nodesMap: SigmaxT.nodesGraphMap props.graph } props) []
, neighborhood props []
, neighborhood props []
, query { frontends
: props.frontends
, query { frontends
, metaData: props.metaData
, metaData: props.metaData
, nodesMap: SigmaxT.nodesGraphMap props.graph
, nodesMap: SigmaxT.nodesGraphMap props.graph
, searchType: SearchContact
, searchType: SearchContact
...
@@ -177,9 +176,10 @@ selectedNodes = R.createElement selectedNodesCpt
...
@@ -177,9 +176,10 @@ selectedNodes = R.createElement selectedNodesCpt
selectedNodesCpt :: R.Component SelectedNodesProps
selectedNodesCpt :: R.Component SelectedNodesProps
selectedNodesCpt = here.component "selectedNodes" cpt
selectedNodesCpt = here.component "selectedNodes" cpt
where
where
cpt props@{ graph
cpt props@{ boxes: { sidePanelGraph }
, nodesMap
, graph
, selectedNodeIds } _ = do
, nodesMap } _ = do
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ R2.row
pure $ R2.row
...
@@ -219,8 +219,10 @@ neighborhood = R.createElement neighborhoodCpt
...
@@ -219,8 +219,10 @@ neighborhood = R.createElement neighborhoodCpt
neighborhoodCpt :: R.Component Props
neighborhoodCpt :: R.Component Props
neighborhoodCpt = here.component "neighborhood" cpt
neighborhoodCpt = here.component "neighborhood" cpt
where
where
cpt { graph
cpt { boxes: { sidePanelGraph }
, selectedNodeIds } _ = do
, graph
} _ = do
{ selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ RH.div { className: "tab-content", id: "myTabContent" }
pure $ RH.div { className: "tab-content", id: "myTabContent" }
...
@@ -248,27 +250,27 @@ updateTermButton = R.createElement updateTermButtonCpt
...
@@ -248,27 +250,27 @@ updateTermButton = R.createElement updateTermButtonCpt
updateTermButtonCpt :: R.Component UpdateTermButtonProps
updateTermButtonCpt :: R.Component UpdateTermButtonProps
updateTermButtonCpt = here.component "updateTermButton" cpt
updateTermButtonCpt = here.component "updateTermButton" cpt
where
where
cpt { buttonType
cpt { boxes: { errors
, errors
, reloadForest
, sidePanelGraph }
, buttonType
, graphId
, graphId
, metaData
, metaData
, nodesMap
, nodesMap
, reloadForest
, removedNodeIds
, rType
, rType
, selectedNodeIds
, session
, session
, text } _ = do
, text } _ = do
{ removedNodeIds, sideTab, selectedNodeIds } <- GEST.focusedSidePanel sidePanelGraph
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
selectedNodeIds' <- T.useLive T.unequal selectedNodeIds
pure $ if Set.isEmpty selectedNodeIds' then
pure $ if Set.isEmpty selectedNodeIds' then
RH.div {} []
RH.div {} []
else
else
RH.button { className: "btn btn-sm btn-" <> buttonType
RH.button { className: "btn btn-sm btn-" <> buttonType
, on: { click: onClickRemove selectedNodeIds' }
, on: { click: onClickRemove
removedNodeIds selectedNodeIds
selectedNodeIds' }
} [ RH.text text ]
} [ RH.text text ]
where
where
onClickRemove selectedNodeIds' _ = do
onClickRemove
removedNodeIds selectedNodeIds
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 { errors
sendPatches { errors
...
...
src/Gargantext/Components/NgramsTable.purs
View file @
c10a6d14
...
@@ -9,7 +9,7 @@ import Gargantext.Prelude
...
@@ -9,7 +9,7 @@ import Gargantext.Prelude
import Data.Array as A
import Data.Array as A
import Data.Either (Either)
import Data.Either (Either)
import Data.FunctorWithIndex (mapWithIndex)
import Data.FunctorWithIndex (mapWithIndex)
import Data.Lens (
Lens', to, (%~), (.~), (^.), (^?), view
)
import Data.Lens (
to, view, (%~), (.~), (^.), (^?)
)
import Data.Lens.At (at)
import Data.Lens.At (at)
import Data.Lens.Common (_Just)
import Data.Lens.Common (_Just)
import Data.Lens.Fold (folded)
import Data.Lens.Fold (folded)
...
@@ -26,10 +26,10 @@ import Data.Tuple (Tuple(..))
...
@@ -26,10 +26,10 @@ 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 Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.AutoUpdate (autoUpdateElt)
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(..), Version
, 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, rootsOf
, singletonNgramsTablePatch, syncResetButtons, toVersioned)
import Gargantext.Components.NgramsTable.Core (Action(..), CoreAction(..), CoreState, Dispatch, NgramsElement(..), NgramsPatch(..), NgramsTable, NgramsTerm, PageParams, PatchMap(..), Version
ed(..), 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
...
@@ -38,7 +38,7 @@ import Gargantext.Config.REST (RESTError)
...
@@ -38,7 +38,7 @@ 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,
FrontendError,
OrderBy(..), SearchQuery, TabType, TermList(..), TermSize, termLists, termSizes)
import Gargantext.Types (CTabNgramType, 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
...
@@ -248,17 +248,14 @@ tableContainerCpt { dispatch
...
@@ -248,17 +248,14 @@ tableContainerCpt { dispatch
-- NEXT
-- NEXT
type CommonProps = (
type CommonProps =
afterSync :: Unit -> Aff Unit
( afterSync :: Unit -> Aff Unit
, errors :: T.Box (Array FrontendError)
, boxes :: Boxes
, reloadForest :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, tabNgramType :: CTabNgramType
, tabNgramType :: CTabNgramType
, tasks :: T.Box GAT.Storage
, withAutoUpdate :: Boolean
, withAutoUpdate :: Boolean
)
)
type Props =
type Props
NoReload
=
( cacheState :: NT.CacheState
( cacheState :: NT.CacheState
, mTotalRows :: Maybe Int
, mTotalRows :: Maybe Int
, path :: T.Box PageParams
, path :: T.Box PageParams
...
@@ -267,20 +264,23 @@ type Props =
...
@@ -267,20 +264,23 @@ type Props =
| CommonProps
| CommonProps
)
)
loadedNgramsTable :: R2.Component Props
type Props =
( reloadForest :: T2.ReloadS
, reloadRoot :: T2.ReloadS
| PropsNoReload )
loadedNgramsTable :: R2.Component PropsNoReload
loadedNgramsTable = R.createElement loadedNgramsTableCpt
loadedNgramsTable = R.createElement loadedNgramsTableCpt
loadedNgramsTableCpt :: R.Component Props
loadedNgramsTableCpt :: R.Component Props
NoReload
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
loadedNgramsTableCpt = here.component "loadedNgramsTable" cpt where
cpt { afterSync
cpt { afterSync
, boxes: { errors
, tasks }
, cacheState
, cacheState
, errors
, mTotalRows
, mTotalRows
, path
, path
, reloadForest
, reloadRoot
, state
, state
, tabNgramType
, tabNgramType
, tasks
, versioned: Versioned { data: initTable }
, versioned: Versioned { data: initTable }
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
state'@{ ngramsChildren, ngramsLocalPatch, ngramsParent, ngramsSelection } <- T.useLive T.unequal state
state'@{ ngramsChildren, ngramsLocalPatch, ngramsParent, ngramsSelection } <- T.useLive T.unequal state
...
@@ -424,11 +424,9 @@ mkDispatch :: Record MkDispatchProps -> (Action -> Effect Unit)
...
@@ -424,11 +424,9 @@ mkDispatch :: Record MkDispatchProps -> (Action -> Effect Unit)
mkDispatch { filteredRows
mkDispatch { filteredRows
, path
, path
, state
, state
, state': state'@{ ngramsChildren
, state': { ngramsChildren
, ngramsLocalPatch
, ngramsParent
, ngramsParent
, ngramsSelection } } = performAction
, ngramsSelection
, ngramsVersion } } = performAction
where
where
allNgramsSelected = allNgramsSelectedOnFirstPage ngramsSelection filteredRows
allNgramsSelected = allNgramsSelectedOnFirstPage ngramsSelection filteredRows
...
@@ -525,14 +523,11 @@ mainNgramsTableCpt :: R.Component MainNgramsTableProps
...
@@ -525,14 +523,11 @@ mainNgramsTableCpt :: R.Component MainNgramsTableProps
mainNgramsTableCpt = here.component "mainNgramsTable" cpt
mainNgramsTableCpt = here.component "mainNgramsTable" cpt
where
where
cpt { afterSync
cpt { afterSync
, boxes
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadRoot
, tabNgramType
, tabNgramType
, tasks
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
cacheState' <- T.useLive T.unequal cacheState
cacheState' <- T.useLive T.unequal cacheState
path' <- T.useLive T.unequal path
path' <- T.useLive T.unequal path
...
@@ -542,13 +537,10 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -542,13 +537,10 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
case cacheState' of
case cacheState' of
NT.CacheOn -> do
NT.CacheOn -> do
let render versioned = mainNgramsTablePaint { afterSync
let render versioned = mainNgramsTablePaint { afterSync
, boxes
, cacheState: cacheState'
, cacheState: cacheState'
, errors
, path
, path
, reloadForest
, reloadRoot
, tabNgramType
, tabNgramType
, tasks
, versioned
, versioned
, withAutoUpdate } []
, withAutoUpdate } []
useLoaderWithCacheAPI {
useLoaderWithCacheAPI {
...
@@ -562,13 +554,10 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
...
@@ -562,13 +554,10 @@ mainNgramsTableCpt = here.component "mainNgramsTable" cpt
NT.CacheOff -> do
NT.CacheOff -> do
-- path <- R.useState' path
-- path <- R.useState' path
let render versionedWithCount = mainNgramsTablePaintNoCache { afterSync
let render versionedWithCount = mainNgramsTablePaintNoCache { afterSync
, boxes
, cacheState: cacheState'
, cacheState: cacheState'
, errors
, path
, path
, reloadForest
, reloadRoot
, tabNgramType
, tabNgramType
, tasks
, versionedWithCount
, versionedWithCount
, withAutoUpdate } []
, withAutoUpdate } []
useLoader { errorHandler
useLoader { errorHandler
...
@@ -631,27 +620,21 @@ mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
...
@@ -631,27 +620,21 @@ mainNgramsTablePaintCpt :: R.Component MainNgramsTablePaintProps
mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
mainNgramsTablePaintCpt = here.component "mainNgramsTablePaint" cpt
where
where
cpt { afterSync
cpt { afterSync
, boxes
, cacheState
, cacheState
, errors
, path
, path
, reloadForest
, reloadRoot
, tabNgramType
, tabNgramType
, tasks
, versioned
, versioned
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
state <- T.useBox $ initialState versioned
state <- T.useBox $ initialState versioned
pure $ loadedNgramsTable { afterSync
pure $ loadedNgramsTable { afterSync
, boxes
, cacheState
, cacheState
, errors
, mTotalRows: Nothing
, mTotalRows: Nothing
, path
, path
, reloadForest
, reloadRoot
, state
, state
, tabNgramType
, tabNgramType
, tasks
, versioned
, versioned
, withAutoUpdate
, withAutoUpdate
} []
} []
...
@@ -665,38 +648,30 @@ type MainNgramsTablePaintNoCacheProps = (
...
@@ -665,38 +648,30 @@ type MainNgramsTablePaintNoCacheProps = (
mainNgramsTablePaintNoCache :: R2.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCache :: R2.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCache = R.createElement mainNgramsTablePaintNoCacheCpt
mainNgramsTablePaintNoCache = R.createElement mainNgramsTablePaintNoCacheCpt
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt :: R.Component MainNgramsTablePaintNoCacheProps
mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cpt
mainNgramsTablePaintNoCacheCpt = here.component "mainNgramsTablePaintNoCache" cpt
where
where
cpt { afterSync
cpt { afterSync
, boxes
, cacheState
, cacheState
, errors
, path
, path
, reloadForest
, reloadRoot
, tabNgramType
, tabNgramType
, tasks
, versionedWithCount
, versionedWithCount
, withAutoUpdate } _ = do
, withAutoUpdate } _ = do
-- TODO This is lame, make versionedWithCount a proper box?
let count /\ versioned = toVersioned versionedWithCount
let count /\ versioned = toVersioned versionedWithCount
state <- T.useBox $ initialState versioned
state <- T.useBox $ initialState versioned
pure $ loadedNgramsTable {
pure $ loadedNgramsTable { afterSync
afterSync
, boxes
, cacheState
, cacheState
, errors
, mTotalRows: Just count
, mTotalRows: Just count
, path
, path: path
, state
, reloadForest
, tabNgramType
, reloadRoot
, versioned
, state
, withAutoUpdate } []
, tabNgramType
, tasks
, versioned
, withAutoUpdate
} []
type NgramsOcc = { occurrences :: Additive Int, children :: Set NgramsTerm }
type NgramsOcc = { occurrences :: Additive Int, children :: Set NgramsTerm }
...
...
src/Gargantext/Components/Nodes/Annuaire.purs
View file @
c10a6d14
...
@@ -186,7 +186,7 @@ pageCpt = here.component "page" cpt
...
@@ -186,7 +186,7 @@ pageCpt = here.component "page" cpt
rows pagePath' = (row pagePath') <$> Seq.fromFoldable docs
rows pagePath' = (row pagePath') <$> Seq.fromFoldable docs
row { nodeId } contact = { row: contactCells { annuaireId: nodeId, frontends, contact, session }
row { nodeId } contact = { row: contactCells { annuaireId: nodeId, frontends, contact, session }
, delete: false }
, delete: false }
container = TT.defaultContainer
{ title: "Annuaire" }
-- TODO
container = TT.defaultContainer -- TODO
colNames = TT.ColumnName <$> [ "", "First Name", "Last Name", "Company", "Role"]
colNames = TT.ColumnName <$> [ "", "First Name", "Last Name", "Company", "Role"]
wrapColElts = const identity
wrapColElts = const identity
...
...
src/Gargantext/Components/Nodes/Annuaire/Tabs.purs
View file @
c10a6d14
...
@@ -8,7 +8,7 @@ import Data.Maybe (Maybe(..))
...
@@ -8,7 +8,7 @@ import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Aff (Aff)
import Effect.Aff (Aff)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable as NT
...
@@ -19,9 +19,8 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
...
@@ -19,9 +19,8 @@ import Gargantext.Components.Nodes.Texts.Types as TextsT
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends)
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (CTabNgramType(..),
FrontendError, PTabNgramType(..), SidePanelState
, TabSubType(..), TabType(..))
import Gargantext.Types (CTabNgramType(..),
PTabNgramType(..)
, TabSubType(..), TabType(..))
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix as R
import Record as Record
import Record as Record
import Record.Extra as RX
import Record.Extra as RX
...
@@ -51,22 +50,17 @@ modeTabType' Books = CTabAuthors
...
@@ -51,22 +50,17 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps =
type TabsProps =
( cacheState :: T.Box LTypes.CacheState
( boxes :: Boxes
, contactData :: ContactData
, cacheState :: T.Box LTypes.CacheState
, errors :: T.Box (Array FrontendError)
, contactData :: ContactData
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, session :: Session
, reloadRoot :: T2.ReloadS
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, session :: Session
, sidePanel :: T.Box (Maybe (Record TextsT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage
)
)
tabs :: R2.Leaf TabsProps
tabs :: R2.Leaf TabsProps
tabs props = R.createElement tabsCpt props []
tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component TabsProps
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt where
tabsCpt = here.component "tabs" cpt where
cpt props _ = do
cpt props _ = do
...
@@ -74,7 +68,7 @@ tabsCpt = here.component "tabs" cpt where
...
@@ -74,7 +68,7 @@ tabsCpt = here.component "tabs" cpt where
yearFilter <- T.useBox (Nothing :: Maybe Year)
yearFilter <- T.useBox (Nothing :: Maybe Year)
pure $ Tab.tabs { activeTab, tabs: tabs' yearFilter props }
pure $ Tab.tabs { activeTab, tabs: tabs' yearFilter props }
tabs' yearFilter props@{
sidePanel, sidePanelState
} =
tabs' yearFilter props@{
boxes, sidePanel
} =
[ "Documents" /\ docs
[ "Documents" /\ docs
, "Patents" /\ ngramsView (viewProps Patents)
, "Patents" /\ ngramsView (viewProps Patents)
, "Books" /\ ngramsView (viewProps Books)
, "Books" /\ ngramsView (viewProps Books)
...
@@ -84,11 +78,10 @@ tabsCpt = here.component "tabs" cpt where
...
@@ -84,11 +78,10 @@ tabsCpt = here.component "tabs" cpt where
viewProps mode = Record.merge props { defaultListId: props.contactData.defaultListId
viewProps mode = Record.merge props { defaultListId: props.contactData.defaultListId
, mode }
, mode }
totalRecords = 4736 -- TODO lol
totalRecords = 4736 -- TODO lol
docs = DT.docViewLayout (Record.merge {
sidePanel, sidePanelState
} $ Record.merge dtCommon dtExtra)
docs = DT.docViewLayout (Record.merge {
boxes, sidePanel
} $ Record.merge dtCommon dtExtra)
dtCommon = RX.pick props :: Record DTCommon
dtCommon = RX.pick props :: Record DTCommon
dtExtra =
dtExtra =
{ chart: mempty
{ chart: mempty
, errors: props.errors
, listId: props.contactData.defaultListId
, listId: props.contactData.defaultListId
, mCorpusId: Nothing
, mCorpusId: Nothing
, showSearch: true
, showSearch: true
...
@@ -115,7 +108,7 @@ ngramsView :: R2.Leaf NgramsViewTabsProps
...
@@ -115,7 +108,7 @@ 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,
errors,
mode, nodeId, session } _ = do
cpt props@{ defaultListId, mode, nodeId, session } _ = do
path <- T.useBox $
path <- T.useBox $
NTC.initialPageParams session nodeId
NTC.initialPageParams session nodeId
[ defaultListId ] (TabDocument TabDocs)
[ defaultListId ] (TabDocument TabDocs)
...
@@ -125,7 +118,6 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -125,7 +118,6 @@ 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
...
@@ -135,10 +127,8 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -135,10 +127,8 @@ ngramsViewCpt = here.component "ngramsView" cpt where
afterSync _ = pure unit
afterSync _ = pure unit
type NTCommon =
type NTCommon =
( cacheState :: T.Box LTypes.CacheState
( boxes :: Boxes
, defaultListId :: Int
, cacheState :: T.Box LTypes.CacheState
, reloadForest :: T2.ReloadS
, defaultListId :: Int
, reloadRoot :: T2.ReloadS
, session :: Session
, session :: Session
, tasks :: T.Box GAT.Storage
)
)
src/Gargantext/Components/Nodes/Annuaire/User.purs
View file @
c10a6d14
...
@@ -12,22 +12,22 @@ import Data.Maybe (Maybe(..), fromMaybe)
...
@@ -12,22 +12,22 @@ import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Nodes.Annuaire.Tabs as Tabs
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.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.Components.Nodes.Texts.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError)
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, Session, get, put, sessionId)
import Gargantext.Types (
FrontendError, NodeType(..), SidePanelState
)
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 Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Toestand as T
here :: R2.Here
here :: R2.Here
...
@@ -37,7 +37,6 @@ type DisplayProps = ( title :: String )
...
@@ -37,7 +37,6 @@ type DisplayProps = ( title :: String )
display :: R2.Component DisplayProps
display :: R2.Component DisplayProps
display = R.createElement displayCpt
display = R.createElement displayCpt
displayCpt :: R.Component DisplayProps
displayCpt :: R.Component DisplayProps
displayCpt = here.component "display" cpt
displayCpt = here.component "display" cpt
where
where
...
@@ -153,14 +152,9 @@ listElement = H.li { className: "list-group-item justify-content-between" }
...
@@ -153,14 +152,9 @@ listElement = H.li { className: "list-group-item justify-content-between" }
-}
-}
type LayoutNoSessionProps =
type LayoutNoSessionProps =
( errors :: T.Box (Array FrontendError)
( boxes :: Boxes
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, sidePanel :: T.Box (Maybe (Record TT.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage
)
)
type LayoutProps = WithSession LayoutNoSessionProps
type LayoutProps = WithSession LayoutNoSessionProps
...
@@ -177,43 +171,20 @@ userLayout = R.createElement userLayoutCpt
...
@@ -177,43 +171,20 @@ userLayout = R.createElement userLayoutCpt
userLayoutCpt :: R.Component LayoutProps
userLayoutCpt :: R.Component LayoutProps
userLayoutCpt = here.component "userLayout" cpt
userLayoutCpt = here.component "userLayout" cpt
where
where
cpt { errors
cpt props@{ nodeId
, frontends
, session } _ = do
, nodeId
, reloadForest
, reloadRoot
, session
, sidePanel
, sidePanelState
, tasks } _ = do
let sid = sessionId session
let sid = sessionId session
pure $ userLayoutWithKey {
pure $ userLayoutWithKey $ Record.merge props { key: show sid <> "-" <> show nodeId }
errors
, frontends
, key: show sid <> "-" <> show nodeId
, nodeId
, reloadForest
, reloadRoot
, session
, sidePanel
, sidePanelState
, tasks
}
userLayoutWithKey :: R2.Leaf KeyLayoutProps
userLayoutWithKey :: R2.Leaf KeyLayoutProps
userLayoutWithKey props = R.createElement userLayoutWithKeyCpt props []
userLayoutWithKey props = R.createElement userLayoutWithKeyCpt props []
userLayoutWithKeyCpt :: R.Component KeyLayoutProps
userLayoutWithKeyCpt :: R.Component KeyLayoutProps
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
cpt {
errors
cpt {
boxes: boxes@{ sidePanelTexts }
, frontends
, frontends
, nodeId
, nodeId
, reloadForest
, session } _ = do
, reloadRoot
, session
, sidePanel
, sidePanelState
, tasks } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
...
@@ -227,17 +198,13 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
...
@@ -227,17 +198,13 @@ userLayoutWithKeyCpt = here.component "userLayoutWithKey" cpt where
display { title: fromMaybe "no name" name }
display { title: fromMaybe "no name" name }
(contactInfos hyperdata (onUpdateHyperdata reload))
(contactInfos hyperdata (onUpdateHyperdata reload))
, Tabs.tabs {
, Tabs.tabs {
cacheState
boxes
, cacheState
, contactData
, contactData
, errors
, frontends
, frontends
, nodeId
, nodeId
, reloadForest
, reloadRoot
, session
, session
, sidePanel
, sidePanel: sidePanelTexts
, sidePanelState
, tasks
}
}
]
]
}
}
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contact.purs
View file @
c10a6d14
...
@@ -11,22 +11,22 @@ import Data.Maybe (Maybe(..), fromMaybe)
...
@@ -11,22 +11,22 @@ import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (Aff, launchAff_)
import Effect.Aff (Aff, launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
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 (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.Components.Nodes.Texts.Types as TT
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError)
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 (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (
FrontendError, NodeType(..), SidePanelState
)
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 Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Record as Record
import Toestand as T
import Toestand as T
here :: R2.Here
here :: R2.Here
...
@@ -131,24 +131,20 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
...
@@ -131,24 +131,20 @@ contactInfoItemCpt = here.component "contactInfoItem" cpt
let newHyperdata = (L.over cLens (\_ -> R.readRef valueRef) hyperdata) :: HyperdataContact
let newHyperdata = (L.over cLens (\_ -> R.readRef valueRef) hyperdata) :: HyperdataContact
onUpdateHyperdata newHyperdata
onUpdateHyperdata newHyperdata
type BasicProps =
( errors :: T.Box (Array FrontendError)
, frontends :: Frontends
, nodeId :: Int
, sidePanelState :: T.Box SidePanelState
, sidePanel :: T.Box (Maybe (Record TT.SidePanel))
, tasks :: T.Box GAT.Storage
)
type ReloadProps =
type ReloadProps =
(
reloadForest :: T2.ReloadS
(
boxes :: Boxes
,
reloadRoot :: T2.ReloadS
,
frontends :: Frontends
| BasicProps
, nodeId :: Int
)
)
type LayoutProps = ( session :: Session | ReloadProps )
type LayoutProps =
( session :: Session
| ReloadProps )
type KeyLayoutProps = ( key :: String, session :: Session | ReloadProps )
type KeyLayoutProps =
( key :: String
, session :: Session
| ReloadProps )
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff (Either RESTError Int)
saveContactHyperdata :: Session -> Int -> HyperdataContact -> Aff (Either RESTError Int)
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
saveContactHyperdata session id = put session (Routes.NodeAPI Node (Just id) "")
...
@@ -161,46 +157,21 @@ contactLayout :: R2.Component AnnuaireLayoutProps
...
@@ -161,46 +157,21 @@ contactLayout :: R2.Component AnnuaireLayoutProps
contactLayout = R.createElement contactLayoutCpt
contactLayout = R.createElement contactLayoutCpt
contactLayoutCpt :: R.Component AnnuaireLayoutProps
contactLayoutCpt :: R.Component AnnuaireLayoutProps
contactLayoutCpt = here.component "contactLayout" cpt where
contactLayoutCpt = here.component "contactLayout" cpt where
cpt { annuaireId
cpt props@{ nodeId
, errors
, session } _ = do
, frontends
, nodeId
, reloadForest
, reloadRoot
, session
, sidePanel
, sidePanelState
, tasks } _ = do
let key = show (sessionId session) <> "-" <> show nodeId
let key = show (sessionId session) <> "-" <> show nodeId
pure $
pure $
contactLayoutWithKey
contactLayoutWithKey $ Record.merge props { key }
{ annuaireId
, errors
, frontends
, key
, nodeId
, reloadForest
, reloadRoot
, session
, sidePanel
, sidePanelState
, tasks
}
contactLayoutWithKey :: R2.Leaf AnnuaireKeyLayoutProps
contactLayoutWithKey :: R2.Leaf AnnuaireKeyLayoutProps
contactLayoutWithKey props = R.createElement contactLayoutWithKeyCpt props []
contactLayoutWithKey props = R.createElement contactLayoutWithKeyCpt props []
contactLayoutWithKeyCpt :: R.Component AnnuaireKeyLayoutProps
contactLayoutWithKeyCpt :: R.Component AnnuaireKeyLayoutProps
contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
cpt { annuaireId
cpt { annuaireId
,
errors
,
boxes: boxes@{ sidePanelTexts }
, frontends
, frontends
, reloadForest
, reloadRoot
, nodeId
, nodeId
, session
, session } _ = do
, sidePanel
, sidePanelState
, tasks } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
_ <- T.useLive T.unequal reload
_ <- T.useLive T.unequal reload
cacheState <- T.useBox LT.CacheOn
cacheState <- T.useBox LT.CacheOn
...
@@ -212,17 +183,14 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
...
@@ -212,17 +183,14 @@ contactLayoutWithKeyCpt = here.component "contactLayoutWithKey" cpt where
[ display { title: fromMaybe "no name" name }
[ display { title: fromMaybe "no name" name }
(contactInfos hyperdata (onUpdateHyperdata reload))
(contactInfos hyperdata (onUpdateHyperdata reload))
, Tabs.tabs
, Tabs.tabs
{ cacheState
{ boxes
, cacheState
, contactData
, contactData
, errors
, frontends
, frontends
, nodeId
, nodeId
, session
, session
, sidePanel
, sidePanel: sidePanelTexts
, sidePanelState
} ] }
, reloadForest
, reloadRoot
, tasks } ] }
where
where
errorHandler err = here.log2 "[contactLayoutWithKey] RESTError" err
errorHandler err = here.log2 "[contactLayoutWithKey] RESTError" err
onUpdateHyperdata :: T2.ReloadS -> HyperdataContact -> Effect Unit
onUpdateHyperdata :: T2.ReloadS -> HyperdataContact -> Effect Unit
...
...
src/Gargantext/Components/Nodes/Annuaire/User/Contacts/Tabs.purs
View file @
c10a6d14
...
@@ -8,6 +8,7 @@ import Data.Maybe (Maybe(..))
...
@@ -8,6 +8,7 @@ import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable as DT
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.DocsTable.Types (Year)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable as NT
...
@@ -49,17 +50,13 @@ modeTabType' Books = CTabAuthors
...
@@ -49,17 +50,13 @@ modeTabType' Books = CTabAuthors
modeTabType' Communication = CTabAuthors
modeTabType' Communication = CTabAuthors
type TabsProps = (
type TabsProps = (
cacheState :: T.Box LTypes.CacheState
boxes :: Boxes
, contactData :: ContactData'
, cacheState :: T.Box LTypes.CacheState
, errors :: T.Box (Array FrontendError)
, contactData :: ContactData'
, frontends :: Frontends
, frontends :: Frontends
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, session :: Session
, reloadRoot :: T2.ReloadS
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
, session :: Session
, sidePanel :: T.Box (Maybe (Record TTypes.SidePanel))
, sidePanelState :: T.Box SidePanelState
, tasks :: T.Box GAT.Storage
)
)
tabs :: R2.Leaf TabsProps
tabs :: R2.Leaf TabsProps
...
@@ -67,17 +64,13 @@ tabs props = R.createElement tabsCpt props []
...
@@ -67,17 +64,13 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component TabsProps
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt
tabsCpt = here.component "tabs" cpt
where
where
cpt { cacheState
cpt { boxes
, cacheState
, contactData: {defaultListId}
, contactData: {defaultListId}
, errors
, frontends
, frontends
, nodeId
, nodeId
, reloadRoot
, reloadForest
, session
, session
, sidePanel
, sidePanel
, sidePanelState
, tasks
} _ = do
} _ = do
activeTab <- T.useBox 0
activeTab <- T.useBox 0
yearFilter <- T.useBox (Nothing :: Maybe Year)
yearFilter <- T.useBox (Nothing :: Maybe Year)
...
@@ -92,42 +85,33 @@ tabsCpt = here.component "tabs" cpt
...
@@ -92,42 +85,33 @@ tabsCpt = here.component "tabs" cpt
, "Trash" /\ docs -- TODO pass-in trash mode
, "Trash" /\ docs -- TODO pass-in trash mode
]
]
where
where
patentsView = { cacheState
patentsView = { boxes
, cacheState
, defaultListId
, defaultListId
, errors
, mode: Patents
, mode: Patents
, nodeId
, nodeId
, reloadForest
, reloadRoot
, session
, session
, tasks
}
}
booksView = { cacheState
booksView = { boxes
, cacheState
, defaultListId
, defaultListId
, errors
, mode: Books
, mode: Books
, nodeId
, nodeId
, reloadForest
, reloadRoot
, session
, session
, tasks
}
}
commView = { cacheState
commView = { boxes
, cacheState
, defaultListId
, defaultListId
, errors
, mode: Communication
, mode: Communication
, nodeId
, nodeId
, reloadForest
, reloadRoot
, session
, session
, tasks
}
}
chart = mempty
chart = mempty
totalRecords = 4736 -- TODO
totalRecords = 4736 -- TODO
docs = DT.docViewLayout
docs = DT.docViewLayout
{ cacheState
{ boxes
, cacheState
, chart
, chart
, errors
, frontends
, frontends
, listId: defaultListId
, listId: defaultListId
, mCorpusId: Nothing
, mCorpusId: Nothing
...
@@ -135,7 +119,6 @@ tabsCpt = here.component "tabs" cpt
...
@@ -135,7 +119,6 @@ tabsCpt = here.component "tabs" cpt
, session
, session
, showSearch: true
, showSearch: true
, sidePanel
, sidePanel
, sidePanelState
, tabType: TabPairing TabDocs
, tabType: TabPairing TabDocs
, totalRecords
, totalRecords
, yearFilter
, yearFilter
...
@@ -143,15 +126,12 @@ tabsCpt = here.component "tabs" cpt
...
@@ -143,15 +126,12 @@ tabsCpt = here.component "tabs" cpt
type NgramsViewTabsProps = (
type NgramsViewTabsProps = (
cacheState :: T.Box LTypes.CacheState
boxes :: Boxes
, 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
, reloadRoot :: T2.ReloadS
, session :: Session
, session :: Session
, tasks :: T.Box GAT.Storage
)
)
ngramsView :: R2.Component NgramsViewTabsProps
ngramsView :: R2.Component NgramsViewTabsProps
...
@@ -160,29 +140,23 @@ ngramsView = R.createElement ngramsViewCpt
...
@@ -160,29 +140,23 @@ ngramsView = R.createElement ngramsViewCpt
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt :: R.Component NgramsViewTabsProps
ngramsViewCpt = here.component "ngramsView" cpt
ngramsViewCpt = here.component "ngramsView" cpt
where
where
cpt { cacheState
cpt { boxes
, cacheState
, defaultListId
, defaultListId
, errors
, reloadForest
, reloadRoot
, mode
, mode
, nodeId
, nodeId
, session
, session } _ = do
, tasks } _ = do
path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
path <- T.useBox $ NTC.initialPageParams session nodeId [defaultListId] (TabDocument TabDocs)
pure $ NT.mainNgramsTable {
pure $ NT.mainNgramsTable {
afterSync: \_ -> pure unit
afterSync: \_ -> pure unit
, boxes
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadRoot
, session
, session
, tabNgramType
, tabNgramType
, tabType
, tabType
, tasks
, withAutoUpdate: false
, withAutoUpdate: false
} []
} []
where
where
...
...
src/Gargantext/Components/Nodes/Corpus.purs
View file @
c10a6d14
module Gargantext.Components.Nodes.Corpus where
module Gargantext.Components.Nodes.Corpus where
import DOM.Simple.Console (log2)
import Data.Array as A
import Data.Array as A
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Eq.Generic (genericEq)
import Data.Eq.Generic (genericEq)
...
@@ -12,20 +11,20 @@ import Effect (Effect)
...
@@ -12,20 +11,20 @@ import Effect (Effect)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.CodeEditor as CE
import Gargantext.Components.FolderView as FV
import Gargantext.Components.FolderView as FV
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.InputWithEnter (inputWithEnter)
import Gargantext.Components.Node (NodePoly(..), HyperdataList)
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, FTFieldList(..), FTFieldWithIndex, FTFieldsWithIndex(..), Field(..), FieldType(..), Hash, Index, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Components.Nodes.Types (FTField, FTFieldList(..), FTFieldWithIndex, FTFieldsWithIndex(..), Field(..), FieldType(..), Hash, Index, defaultField, defaultHaskell', defaultJSON', defaultMarkdown', defaultPython')
import Gargantext.Config.REST (RESTError)
import Gargantext.Config.REST (RESTError
(..)
)
import Gargantext.Data.Array as GDA
import Gargantext.Data.Array as GDA
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>))
import Gargantext.Prelude (class Eq, class Show, Unit, bind, discard, pure, show, unit, ($), (+), (-), (<), (<$>), (<<<), (<>), (==), (>))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Routes (SessionRoute(Children, NodeAPI))
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Sessions (Session, get, put, sessionId)
import Gargantext.Types (AffETableResult,
FrontendError,
NodeType(..))
import Gargantext.Types (AffETableResult, NodeType(..))
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Crypto as Crypto
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Gargantext.Utils.Toestand as T2
...
@@ -38,28 +37,24 @@ here :: R2.Here
...
@@ -38,28 +37,24 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus"
here = R2.here "Gargantext.Components.Nodes.Corpus"
type Props =
type Props =
(
errors :: T.Box (Array FrontendError)
(
boxes :: Boxes
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, session :: Session )
, session :: Session
, tasks :: T.Box GAT.Storage )
corpusLayout :: R2.Leaf Props
corpusLayout :: R2.Leaf Props
corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayout props = R.createElement corpusLayoutCpt props []
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt :: R.Component Props
corpusLayoutCpt = here.component "corpusLayout" cpt where
corpusLayoutCpt = here.component "corpusLayout" cpt where
cpt {
errors, nodeId, session, tasks, reloadForest
} _ = do
cpt {
boxes, nodeId, session
} _ = do
pure $ corpusLayoutMain {
errors, key, nodeId, session, tasks, reloadForest
}
pure $ corpusLayoutMain {
boxes, key, nodeId, session
}
where
where
key = show (sessionId session) <> "-" <> show nodeId
key = show (sessionId session) <> "-" <> show nodeId
type KeyProps =
type KeyProps =
(
errors :: T.Box (Array FrontendError)
(
boxes :: Boxes
, key :: String
, key :: String
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, session :: Session
, session :: Session
, tasks :: T.Box GAT.Storage
)
)
corpusLayoutMain :: R2.Leaf KeyProps
corpusLayoutMain :: R2.Leaf KeyProps
...
@@ -67,7 +62,7 @@ corpusLayoutMain props = R.createElement corpusLayoutMainCpt props []
...
@@ -67,7 +62,7 @@ corpusLayoutMain props = R.createElement corpusLayoutMainCpt props []
corpusLayoutMainCpt :: R.Component KeyProps
corpusLayoutMainCpt :: R.Component KeyProps
corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
where
where
cpt {
errors, nodeId, key, session, tasks, reloadForest
} _ = do
cpt {
boxes, key, nodeId, session
} _ = do
viewType <- T.useBox Folders
viewType <- T.useBox Folders
pure $ H.div {} [
pure $ H.div {} [
...
@@ -77,32 +72,34 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
...
@@ -77,32 +72,34 @@ corpusLayoutMainCpt = here.component "corpusLayoutMain" cpt
, H.div { className: "col-1" } [ FV.homeButton ]
, H.div { className: "col-1" } [ FV.homeButton ]
]
]
]
]
, H.div {} [corpusLayoutSelection {
errors, state: viewType, key, session, nodeId, tasks, reloadForest
}]
, H.div {} [corpusLayoutSelection {
boxes, key, session, state: viewType, nodeId
}]
]
]
type SelectionProps =
type SelectionProps =
(
errors :: T.Box (Array FrontendError)
(
boxes :: Boxes
, nodeId :: Int
, nodeId :: Int
, key :: String
, key :: String
, session :: Session
, session :: Session
, state :: T.Box ViewType
, state :: T.Box ViewType
, tasks :: T.Box GAT.Storage
, reloadForest :: T2.ReloadS
)
)
corpusLayoutSelection :: R2.Leaf SelectionProps
corpusLayoutSelection :: R2.Leaf SelectionProps
corpusLayoutSelection props = R.createElement corpusLayoutSelectionCpt props []
corpusLayoutSelection props = R.createElement corpusLayoutSelectionCpt props []
corpusLayoutSelectionCpt :: R.Component SelectionProps
corpusLayoutSelectionCpt :: R.Component SelectionProps
corpusLayoutSelectionCpt = here.component "corpusLayoutSelection" cpt where
corpusLayoutSelectionCpt = here.component "corpusLayoutSelection" cpt where
cpt {
errors, nodeId, session, key, state, tasks, reloadForest
} _ = do
cpt {
boxes, key, nodeId, session, state
} _ = do
state' <- T.useLive T.unequal state
state' <- T.useLive T.unequal state
viewType <- T.read state
viewType <- T.read state
pure $ renderContent viewType nodeId session key
tasks reloadForest error
s
pure $ renderContent viewType nodeId session key
boxe
s
renderContent Folders nodeId session key tasks reloadForest errors =
renderContent Folders nodeId session _ boxes =
FV.folderView { errors, nodeId, session, backFolder: true, tasks, reloadForest }
FV.folderView { backFolder: true
renderContent Code nodeId session key tasks _ _ = corpusLayoutWithKey { key, nodeId, session }
, boxes
, nodeId
, session
}
renderContent Code nodeId session key _ = corpusLayoutWithKey { key, nodeId, session }
type CorpusKeyProps =
type CorpusKeyProps =
( nodeId :: Int
( nodeId :: Int
...
@@ -184,7 +181,7 @@ corpusLayoutViewCpt = here.component "corpusLayoutView" cpt
...
@@ -184,7 +181,7 @@ corpusLayoutViewCpt = here.component "corpusLayoutView" cpt
, session }
, session }
liftEffect $ do
liftEffect $ do
_ <- case res of
_ <- case res of
Left err -> log2 "[corpusLayoutView] onClickSave RESTError" err
Left err ->
here.
log2 "[corpusLayoutView] onClickSave RESTError" err
_ -> pure unit
_ -> pure unit
T2.reload reload
T2.reload reload
...
@@ -357,7 +354,6 @@ type RenameableTextProps =
...
@@ -357,7 +354,6 @@ type RenameableTextProps =
renameableText :: Record RenameableTextProps -> R.Element
renameableText :: Record RenameableTextProps -> R.Element
renameableText props = R.createElement renameableTextCpt props []
renameableText props = R.createElement renameableTextCpt props []
renameableTextCpt :: R.Component RenameableTextProps
renameableTextCpt :: R.Component RenameableTextProps
renameableTextCpt = here.component "renameableTextCpt" cpt
renameableTextCpt = here.component "renameableTextCpt" cpt
where
where
...
@@ -400,7 +396,6 @@ renameableTextCpt = here.component "renameableTextCpt" cpt
...
@@ -400,7 +396,6 @@ renameableTextCpt = here.component "renameableTextCpt" cpt
fieldCodeEditor :: Record FieldCodeEditorProps -> R.Element
fieldCodeEditor :: Record FieldCodeEditorProps -> R.Element
fieldCodeEditor props = R.createElement fieldCodeEditorCpt props []
fieldCodeEditor props = R.createElement fieldCodeEditorCpt props []
fieldCodeEditorCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorCpt :: R.Component FieldCodeEditorProps
fieldCodeEditorCpt = here.component "fieldCodeEditorCpt" cpt
fieldCodeEditorCpt = here.component "fieldCodeEditorCpt" cpt
where
where
...
@@ -447,12 +442,12 @@ changeCode onc (JSON j@{desc}) CE.Python c = onc $ Python $ defaultPython' { pyt
...
@@ -447,12 +442,12 @@ changeCode onc (JSON j@{desc}) CE.Python c = onc $ Python $ defaultPython' { pyt
toCode = R2.stringify (JSON.writeImpl j) 2
toCode = R2.stringify (JSON.writeImpl j) 2
changeCode onc _ CE.JSON c = do
changeCode onc _ CE.JSON c = do
case JSON.readJSON c of
case JSON.readJSON c of
Left err -> log2 "[fieldCodeEditor'] cannot parse json" c
Left err ->
here.
log2 "[fieldCodeEditor'] cannot parse json" c
Right j' -> onc $ JSON j'
Right j' -> onc $ JSON j'
-- case jsonParser c of
-- case jsonParser c of
-- Left err -> log2 "[fieldCodeEditor'] cannot parse json" c
-- Left err ->
here.
log2 "[fieldCodeEditor'] cannot parse json" c
-- Right j' -> case decodeJson j' of
-- Right j' -> case decodeJson j' of
-- Left err -> log2 "[fieldCodeEditor'] cannot decode json" j'
-- Left err ->
here.
log2 "[fieldCodeEditor'] cannot decode json" j'
-- Right j'' -> onc $ JSON j''
-- Right j'' -> onc $ JSON j''
changeCode onc (JSON j) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text = text }
changeCode onc (JSON j) CE.Markdown _ = onc $ Markdown $ defaultMarkdown' { text = text }
where
where
...
@@ -500,7 +495,7 @@ loadCorpus {nodeId, session} = do
...
@@ -500,7 +495,7 @@ loadCorpus {nodeId, session} = do
Just (NodePoly { id: defaultListId }) ->
Just (NodePoly { id: defaultListId }) ->
pure $ Right { corpusId, corpusNode, defaultListId }
pure $ Right { corpusId, corpusNode, defaultListId }
Nothing ->
Nothing ->
throwError $ e
rror "Missing default list"
pure $ Left $ CustomE
rror "Missing default list"
-- (NodePoly {parentId: corpusId} :: NodePoly {}) <- get session nodePolyRoute
-- (NodePoly {parentId: corpusId} :: NodePoly {}) <- get session nodePolyRoute
-- corpusNode <- get session $ corpusNodeRoute corpusId ""
-- corpusNode <- get session $ corpusNodeRoute corpusId ""
...
@@ -570,7 +565,6 @@ type ViewTypeSelectorProps =
...
@@ -570,7 +565,6 @@ type ViewTypeSelectorProps =
viewTypeSelector :: Record ViewTypeSelectorProps -> R.Element
viewTypeSelector :: Record ViewTypeSelectorProps -> R.Element
viewTypeSelector p = R.createElement viewTypeSelectorCpt p []
viewTypeSelector p = R.createElement viewTypeSelectorCpt p []
viewTypeSelectorCpt :: R.Component ViewTypeSelectorProps
viewTypeSelectorCpt :: R.Component ViewTypeSelectorProps
viewTypeSelectorCpt = here.component "viewTypeSelector" cpt
viewTypeSelectorCpt = here.component "viewTypeSelector" cpt
where
where
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Common.purs
View file @
c10a6d14
...
@@ -35,13 +35,20 @@ metricsLoadView p = R.createElement metricsLoadViewCpt p []
...
@@ -35,13 +35,20 @@ metricsLoadView p = R.createElement metricsLoadViewCpt p []
metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt :: forall a. Eq a => R.Component (MetricsLoadViewProps a)
metricsLoadViewCpt = here.component "metricsLoadView" cpt
metricsLoadViewCpt = here.component "metricsLoadView" cpt
where
where
cpt { errors, getMetrics, loaded, onClick, onInit, path, reload, session } _ = do
cpt { boxes: boxes@{ errors }
, getMetrics
, loaded
, onClick
, onInit
, path
, reload
, session } _ = do
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
useLoader { errorHandler
useLoader { errorHandler
, loader: getMetrics session
, loader: getMetrics session
, path: reload' /\ path
, path: reload' /\ path
, render: \l -> loaded {
error
s, path, reload, session, onClick, onInit } l }
, render: \l -> loaded {
boxe
s, path, reload, session, onClick, onInit } l }
where
where
errorHandler error = do
errorHandler error = do
T.modify_ (A.cons $ FRESTError { error }) errors
T.modify_ (A.cons $ FRESTError { error }) errors
...
@@ -64,7 +71,7 @@ metricsWithCacheLoadViewCpt :: forall res ret.
...
@@ -64,7 +71,7 @@ metricsWithCacheLoadViewCpt :: forall res ret.
R.Component (MetricsWithCacheLoadViewProps res ret)
R.Component (MetricsWithCacheLoadViewProps res ret)
metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
where
where
cpt {
error
s
cpt {
boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded
, loaded
...
@@ -76,9 +83,9 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
...
@@ -76,9 +83,9 @@ metricsWithCacheLoadViewCpt = here.component "metricsWithCacheLoadView" cpt
, onInit } _ = do
, onInit } _ = do
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
useLoaderWithCacheAPI {
cacheEndpoint: (getMetricsHash session)
useLoaderWithCacheAPI {
boxes
,
errors
,
cacheEndpoint: (getMetricsHash session)
, handleResponse
, handleResponse
, mkRequest
, mkRequest
, path: (reload' /\ path)
, path: (reload' /\ path)
, renderer: loaded {
error
s, path, reload, session, onClick, onInit } }
, renderer: loaded {
boxe
s, path, reload, session, onClick, onInit } }
src/Gargantext/Components/Nodes/Corpus/Chart/Histo.purs
View file @
c10a6d14
...
@@ -98,11 +98,11 @@ histo props = R.createElement histoCpt props []
...
@@ -98,11 +98,11 @@ histo props = R.createElement histoCpt props []
histoCpt :: R.Component Props
histoCpt :: R.Component Props
histoCpt = here.component "histo" cpt
histoCpt = here.component "histo" cpt
where
where
cpt {
error
s, path, session, onClick, onInit } _ = do
cpt {
boxe
s, path, session, onClick, onInit } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView
{
pure $ metricsWithCacheLoadView
error
s
{ boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded
, loaded
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Metrics.purs
View file @
c10a6d14
...
@@ -113,11 +113,11 @@ metrics props = R.createElement metricsCpt props []
...
@@ -113,11 +113,11 @@ metrics props = R.createElement metricsCpt props []
metricsCpt :: R.Component Props
metricsCpt :: R.Component Props
metricsCpt = here.component "etrics" cpt
metricsCpt = here.component "etrics" cpt
where
where
cpt {
error
s, onClick, onInit, path, session } _ = do
cpt {
boxe
s, onClick, onInit, path, session } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
pure $ metricsWithCacheLoadView {
error
s
boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded
, loaded
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Pie.purs
View file @
c10a6d14
...
@@ -106,11 +106,11 @@ pie props = R.createElement pieCpt props []
...
@@ -106,11 +106,11 @@ pie props = R.createElement pieCpt props []
pieCpt :: R.Component Props
pieCpt :: R.Component Props
pieCpt = here.component "pie" cpt
pieCpt = here.component "pie" cpt
where
where
cpt {
error
s, path, session, onClick, onInit } _ = do
cpt {
boxe
s, path, session, onClick, onInit } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView
{
pure $ metricsWithCacheLoadView
error
s
{ boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded: loadedPie
, loaded: loadedPie
...
@@ -136,11 +136,11 @@ bar props = R.createElement barCpt props []
...
@@ -136,11 +136,11 @@ bar props = R.createElement barCpt props []
barCpt :: R.Component Props
barCpt :: R.Component Props
barCpt = here.component "bar" cpt
barCpt = here.component "bar" cpt
where
where
cpt {
error
s, path, session, onClick, onInit} _ = do
cpt {
boxe
s, path, session, onClick, onInit} _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView {
pure $ metricsWithCacheLoadView {
error
s
boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded: loadedBar
, loaded: loadedBar
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Predefined.purs
View file @
c10a6d14
...
@@ -7,17 +7,17 @@ import Data.Maybe (Maybe(..), fromMaybe)
...
@@ -7,17 +7,17 @@ import Data.Maybe (Maybe(..), fromMaybe)
import Data.Ord.Generic (genericCompare)
import Data.Ord.Generic (genericCompare)
import Data.Show.Generic (genericShow)
import Data.Show.Generic (genericShow)
import Effect (Effect)
import Effect (Effect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Histo (histo)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie)
import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
import Gargantext.Types (
FrontendError,
Mode(..), NodeID, TabSubType(..), TabType(..), modeTabType)
import Gargantext.Types (Mode(..), NodeID, TabSubType(..), TabType(..), modeTabType)
import Reactix as R
import Reactix as R
import Simple.JSON as JSON
import Simple.JSON as JSON
import Simple.JSON.Generics as JSONG
import Simple.JSON.Generics as JSONG
import Toestand as T
data PredefinedChart =
data PredefinedChart =
CDocsHistogram
CDocsHistogram
...
@@ -55,9 +55,9 @@ allPredefinedCharts =
...
@@ -55,9 +55,9 @@ allPredefinedCharts =
type Params =
type Params =
( corpusId :: NodeID
( boxes :: Boxes
, corpusId :: NodeID
-- optinal params
-- optinal params
, errors :: T.Box (Array FrontendError)
, limit :: Maybe Int
, limit :: Maybe Int
, listId :: Maybe Int
, listId :: Maybe Int
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onClick :: Maybe (MouseEvent -> Effect Unit)
...
@@ -66,40 +66,40 @@ type Params =
...
@@ -66,40 +66,40 @@ type Params =
)
)
render :: PredefinedChart -> Record Params -> R.Element
render :: PredefinedChart -> Record Params -> R.Element
render CDocsHistogram {
corpusId, errors
, listId, session, onClick, onInit } =
render CDocsHistogram {
boxes, corpusId
, listId, session, onClick, onInit } =
histo {
error
s, path, session, onClick, onInit }
histo {
boxe
s, path, session, onClick, onInit }
where
where
path = { corpusId
path = { corpusId
, listId: fromMaybe 0 listId
, listId: fromMaybe 0 listId
, limit: Nothing
, limit: Nothing
, tabType: TabCorpus TabDocs
, tabType: TabCorpus TabDocs
}
}
render CAuthorsPie {
corpusId, errors
, listId, session, onClick, onInit } =
render CAuthorsPie {
boxes, corpusId
, listId, session, onClick, onInit } =
pie {
error
s, path, session, onClick, onInit }
pie {
boxe
s, path, session, onClick, onInit }
where
where
path = { corpusId
path = { corpusId
, listId: fromMaybe 0 listId
, listId: fromMaybe 0 listId
, limit: Nothing
, limit: Nothing
, tabType: TabCorpus (TabNgramType $ modeTabType Authors)
, tabType: TabCorpus (TabNgramType $ modeTabType Authors)
}
}
render CInstitutesTree {
corpusId, errors
, limit, listId, session, onClick, onInit } =
render CInstitutesTree {
boxes, corpusId
, limit, listId, session, onClick, onInit } =
tree {
error
s, path, session, onClick, onInit }
tree {
boxe
s, path, session, onClick, onInit }
where
where
path = { corpusId
path = { corpusId
, limit
, limit
, listId: fromMaybe 0 listId
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Institutes)
, tabType: TabCorpus (TabNgramType $ modeTabType Institutes)
}
}
render CTermsMetrics {
corpusId, errors
, limit, listId, session, onClick, onInit } =
render CTermsMetrics {
boxes, corpusId
, limit, listId, session, onClick, onInit } =
metrics {
error
s, path, session, onClick, onInit }
metrics {
boxe
s, path, session, onClick, onInit }
where
where
path = { corpusId
path = { corpusId
, limit
, limit
, listId: fromMaybe 0 listId
, listId: fromMaybe 0 listId
, tabType: TabCorpus (TabNgramType $ modeTabType Terms)
, tabType: TabCorpus (TabNgramType $ modeTabType Terms)
}
}
render CSourcesBar {
corpusId, errors
, limit, listId, session, onClick, onInit } =
render CSourcesBar {
boxes, corpusId
, limit, listId, session, onClick, onInit } =
metrics {
error
s, path, session, onClick, onInit }
metrics {
boxe
s, path, session, onClick, onInit }
where
where
path = { corpusId
path = { corpusId
, limit
, limit
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Tree.purs
View file @
c10a6d14
...
@@ -57,7 +57,7 @@ scatterOptions { onClick, onInit } nodes = Options
...
@@ -57,7 +57,7 @@ scatterOptions { onClick, onInit } nodes = Options
}
}
getMetricsHash :: Session -> ReloadPath -> Aff (Either RESTError String)
getMetricsHash :: Session -> ReloadPath -> Aff (Either RESTError String)
getMetricsHash session (_ /\ { corpusId, li
mit, li
stId, 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
mListId = if listId == 0 then Nothing else (Just listId)
mListId = if listId == 0 then Nothing else (Just listId)
...
@@ -71,18 +71,18 @@ handleResponse :: HashedResponse Metrics -> Loaded
...
@@ -71,18 +71,18 @@ handleResponse :: HashedResponse Metrics -> Loaded
handleResponse (HashedResponse { value: Metrics ms }) = ms."data"
handleResponse (HashedResponse { value: Metrics ms }) = ms."data"
mkRequest :: Session -> ReloadPath -> GUC.Request
mkRequest :: Session -> ReloadPath -> GUC.Request
mkRequest session (_ /\ path
@{ corpusId, limit, listId, tabType }
) = GUC.makeGetRequest session $ chartUrl path
mkRequest session (_ /\ path) = GUC.makeGetRequest session $ chartUrl path
tree :: Record Props -> R.Element
tree :: Record Props -> R.Element
tree props = R.createElement treeCpt props []
tree props = R.createElement treeCpt props []
treeCpt :: R.Component Props
treeCpt :: R.Component Props
treeCpt = here.component "tree" cpt
treeCpt = here.component "tree" cpt
where
where
cpt {
error
s, path, session, onClick, onInit } _ = do
cpt {
boxe
s, path, session, onClick, onInit } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
pure $ metricsWithCacheLoadView
{
pure $ metricsWithCacheLoadView
error
s
{ boxe
s
, getMetricsHash
, getMetricsHash
, handleResponse
, handleResponse
, loaded
, loaded
...
@@ -95,7 +95,7 @@ treeCpt = here.component "tree" cpt
...
@@ -95,7 +95,7 @@ treeCpt = here.component "tree" cpt
}
}
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded :: Record MetricsProps -> Loaded -> R.Element
loaded p
@{ path, reload, session }
loaded' =
loaded p loaded' =
H.div {} [
H.div {} [
{- U.reloadButton reload
{- U.reloadButton reload
, U.chartUpdateButton { chartType: ChartTree, path, reload, session }
, U.chartUpdateButton { chartType: ChartTree, path, reload, session }
...
...
src/Gargantext/Components/Nodes/Corpus/Chart/Types.purs
View file @
c10a6d14
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
...
@@ -3,6 +3,7 @@ module Gargantext.Components.Nodes.Corpus.Chart.Types where
import Data.Maybe (Maybe)
import Data.Maybe (Maybe)
import Data.Tuple (Tuple)
import Data.Tuple (Tuple)
import Effect (Effect)
import Effect (Effect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Components.Charts.Options.Type (EChartsInstance, MouseEvent)
import Gargantext.Prelude (Unit)
import Gargantext.Prelude (Unit)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
...
@@ -18,7 +19,7 @@ type Path = (
...
@@ -18,7 +19,7 @@ type Path = (
)
)
type Props = (
type Props = (
errors :: T.Box (Array FrontendError)
boxes :: Boxes
, path :: Record Path
, path :: Record Path
, session :: Session
, session :: Session
, onClick :: Maybe (MouseEvent -> Effect Unit)
, onClick :: Maybe (MouseEvent -> Effect Unit)
...
...
src/Gargantext/Components/Nodes/Corpus/Dashboard.purs
View file @
c10a6d14
...
@@ -7,6 +7,7 @@ import Data.Maybe (Maybe(..), fromMaybe)
...
@@ -7,6 +7,7 @@ import Data.Maybe (Maybe(..), fromMaybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.Nodes.Corpus (fieldsCodeEditor)
import Gargantext.Components.Nodes.Corpus (fieldsCodeEditor)
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Corpus.Chart.Predefined as P
import Gargantext.Components.Nodes.Dashboard.Types as DT
import Gargantext.Components.Nodes.Dashboard.Types as DT
...
@@ -26,7 +27,7 @@ here :: R2.Here
...
@@ -26,7 +27,7 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard"
here = R2.here "Gargantext.Components.Nodes.Corpus.Dashboard"
type Props =
type Props =
(
errors :: T.Box (Array FrontendError)
(
boxes :: Boxes
, nodeId :: NodeID
, nodeId :: NodeID
, session :: Session )
, session :: Session )
...
@@ -49,7 +50,7 @@ dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt
...
@@ -49,7 +50,7 @@ dashboardLayoutWithKey = R.createElement dashboardLayoutWithKeyCpt
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt :: R.Component KeyProps
dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
where
where
cpt {
error
s, nodeId, session } _ = do
cpt {
boxe
s, nodeId, session } _ = do
reload <- T.useBox T2.newReload
reload <- T.useBox T2.newReload
reload' <- T.useLive T.unequal reload
reload' <- T.useLive T.unequal reload
...
@@ -58,10 +59,10 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
...
@@ -58,10 +59,10 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
, path: { nodeId, reload: reload', session }
, path: { nodeId, reload: reload', session }
, render: \(DT.DashboardData { hyperdata: DT.Hyperdata h, parentId }) -> do
, render: \(DT.DashboardData { hyperdata: DT.Hyperdata h, parentId }) -> do
let { charts, fields } = h
let { charts, fields } = h
dashboardLayoutLoaded { charts
dashboardLayoutLoaded { boxes
, charts
, corpusId: parentId
, corpusId: parentId
, defaultListId: 0
, defaultListId: 0
, errors
, fields
, fields
, nodeId
, nodeId
, onChange: onChange nodeId reload (DT.Hyperdata h)
, onChange: onChange nodeId reload (DT.Hyperdata h)
...
@@ -82,13 +83,13 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
...
@@ -82,13 +83,13 @@ dashboardLayoutWithKeyCpt = here.component "dashboardLayoutWithKey" cpt
T2.reload reload
T2.reload reload
type LoadedProps =
type LoadedProps =
( charts :: Array P.PredefinedChart
( boxes :: Boxes
, charts :: Array P.PredefinedChart
, corpusId :: NodeID
, corpusId :: NodeID
, defaultListId :: Int
, defaultListId :: Int
, errors :: T.Box (Array FrontendError)
, fields :: FTFieldList
, fields :: FTFieldList
, onChange :: { charts :: Array P.PredefinedChart
, onChange :: { charts :: Array P.PredefinedChart
, fields :: FTFieldList } -> Effect Unit
, fields :: FTFieldList } -> Effect Unit
, nodeId :: NodeID
, nodeId :: NodeID
, session :: Session
, session :: Session
)
)
...
@@ -98,7 +99,14 @@ dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
...
@@ -98,7 +99,14 @@ dashboardLayoutLoaded = R.createElement dashboardLayoutLoadedCpt
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt :: R.Component LoadedProps
dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
where
where
cpt { charts, corpusId, defaultListId, errors, fields, nodeId, onChange, session } _ = do
cpt { boxes
, charts
, corpusId
, defaultListId
, fields
, nodeId
, onChange
, session } _ = do
pure $ H.div {}
pure $ H.div {}
[ dashboardCodeEditor { fields
[ dashboardCodeEditor { fields
, nodeId
, nodeId
...
@@ -122,10 +130,10 @@ dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
...
@@ -122,10 +130,10 @@ dashboardLayoutLoadedCpt = here.component "dashboardLayoutLoaded" cpt
, fields }
, fields }
chartsEls = A.mapWithIndex chartIdx charts
chartsEls = A.mapWithIndex chartIdx charts
chartIdx idx chart =
chartIdx idx chart =
renderChart { chart
renderChart { boxes
, chart
, corpusId
, corpusId
, defaultListId
, defaultListId
, errors
, onChange: onChangeChart
, onChange: onChangeChart
, onRemove
, onRemove
, session } []
, session } []
...
@@ -199,10 +207,10 @@ dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
...
@@ -199,10 +207,10 @@ dashboardCodeEditorCpt = here.component "dashboardCodeEditor" cpt
List.snoc fs $ { idx: List.length fs, ftField: defaultField }) fieldsS
List.snoc fs $ { idx: List.length fs, ftField: defaultField }) fieldsS
type PredefinedChartProps =
type PredefinedChartProps =
( chart :: P.PredefinedChart
( boxes :: Boxes
, chart :: P.PredefinedChart
, corpusId :: NodeID
, corpusId :: NodeID
, defaultListId :: Int
, defaultListId :: Int
, errors :: T.Box (Array FrontendError)
, onChange :: P.PredefinedChart -> Effect Unit
, onChange :: P.PredefinedChart -> Effect Unit
, onRemove :: Unit -> Effect Unit
, onRemove :: Unit -> Effect Unit
, session :: Session
, session :: Session
...
@@ -213,7 +221,13 @@ renderChart = R.createElement renderChartCpt
...
@@ -213,7 +221,13 @@ renderChart = R.createElement renderChartCpt
renderChartCpt :: R.Component PredefinedChartProps
renderChartCpt :: R.Component PredefinedChartProps
renderChartCpt = here.component "renderChart" cpt
renderChartCpt = here.component "renderChart" cpt
where
where
cpt { chart, corpusId, defaultListId, errors, onChange, onRemove, session } _ = do
cpt { boxes
, chart
, corpusId
, defaultListId
, onChange
, onRemove
, session } _ = do
pure $ H.div { className: "row chart card" }
pure $ H.div { className: "row chart card" }
[ H.div { className: "card-header" }
[ H.div { className: "card-header" }
[ H.div { className: "row" }
[ H.div { className: "row" }
...
@@ -243,13 +257,13 @@ renderChartCpt = here.component "renderChart" cpt
...
@@ -243,13 +257,13 @@ renderChartCpt = here.component "renderChart" cpt
where
where
value = R.unsafeEventValue e
value = R.unsafeEventValue e
onRemoveClick _ = onRemove unit
onRemoveClick _ = onRemove unit
params = {
corpusId
params = {
boxes
,
errors
,
corpusId
, limit: Just 1000
, limit: Just 1000
, listId: Just defaultListId
, listId: Just defaultListId
, session
, onClick: Nothing
, onClick: Nothing
, onInit: Nothing
, onInit: Nothing
, session
}
}
-- aSchool school = H.div {className: "col-md-4 content"} [ chart $ focus school ]
-- aSchool school = H.div {className: "col-md-4 content"} [ chart $ focus school ]
...
...
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
View file @
c10a6d14
...
@@ -45,4 +45,4 @@ tab frontends session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, lis
...
@@ -45,4 +45,4 @@ tab frontends session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, lis
where
where
dvProps = {frontends, session, nodeId, listId, query, chart, totalRecords: 0, container}
dvProps = {frontends, session, nodeId, listId, query, chart, totalRecords: 0, container}
chart = mempty
chart = mempty
container = Table.graphContainer
{title: corpusLabel}
container = Table.graphContainer
src/Gargantext/Components/Nodes/Home.purs
View file @
c10a6d14
...
@@ -2,11 +2,10 @@ module Gargantext.Components.Nodes.Home where
...
@@ -2,11 +2,10 @@ module Gargantext.Components.Nodes.Home where
import Gargantext.Prelude
import Gargantext.Prelude
import Control.Bind ((=<<))
import Data.Maybe (Maybe(..))
import Data.Maybe (Maybe(..))
import Data.Newtype (class Newtype)
import Data.Newtype (class Newtype)
import Effect (Effect)
import Effect (Effect)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.Data.Landing (BlockText(..), BlockTexts(..), Button(..), LandingData(..))
import Gargantext.Components.FolderView as FV
import Gargantext.Components.FolderView as FV
import Gargantext.Components.Lang (LandingLang(..))
import Gargantext.Components.Lang (LandingLang(..))
...
@@ -19,9 +18,7 @@ import Gargantext.License (license)
...
@@ -19,9 +18,7 @@ import Gargantext.License (license)
import Gargantext.Sessions (Sessions)
import Gargantext.Sessions (Sessions)
import Gargantext.Sessions as Sessions
import Gargantext.Sessions as Sessions
import Gargantext.Sessions.Types (Session(..))
import Gargantext.Sessions.Types (Session(..))
import Gargantext.Types (FrontendError)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Routing.Hash (setHash)
import Routing.Hash (setHash)
...
@@ -55,24 +52,20 @@ langLandingData LL_EN = En.landingData
...
@@ -55,24 +52,20 @@ langLandingData LL_EN = En.landingData
------------------------------------------------------------------------
------------------------------------------------------------------------
type HomeProps s l =
type HomeProps =
( backend :: T.Box (Maybe Backend)
( boxes :: Boxes
, errors :: T.Box (Array FrontendError)
, lang :: LandingLang
, lang :: LandingLang
, sessions :: s
, showLogin :: l
, tasks :: T.Box GAT.Storage
, reloadForest :: T.Box T2.Reload
)
)
homeLayout :: forall s l. T.Read s Sessions => T.ReadWrite l Boolean
homeLayout :: R2.Leaf HomeProps
=> R2.Leaf (HomeProps s l)
homeLayout props = R.createElement homeLayoutCpt props []
homeLayout props = R.createElement homeLayoutCpt props []
homeLayoutCpt :: forall s l. T.Read s Sessions => T.ReadWrite l Boolean
homeLayoutCpt :: R.Component HomeProps
=> R.Component (HomeProps s l)
homeLayoutCpt = here.component "homeLayout" cpt
homeLayoutCpt = here.component "homeLayout" cpt
where
where
cpt { backend, errors, lang, sessions, showLogin, tasks, reloadForest} _ = do
cpt { boxes: boxes@{ backend
, sessions
, showLogin }
, lang } _ = do
backend' <- T.useLive T.unequal backend
backend' <- T.useLive T.unequal backend
sessions' <- T.useLive T.unequal sessions
sessions' <- T.useLive T.unequal sessions
let landingData = langLandingData lang
let landingData = langLandingData lang
...
@@ -81,7 +74,7 @@ homeLayoutCpt = here.component "homeLayout" cpt
...
@@ -81,7 +74,7 @@ homeLayoutCpt = here.component "homeLayout" cpt
[ H.div { className: "home-title container1" }
[ H.div { className: "home-title container1" }
[ jumboTitle landingData ]
[ jumboTitle landingData ]
, H.div { className: "home-research-form container1" } [] -- TODO
, H.div { className: "home-research-form container1" } [] -- TODO
, joinButtonOrTutorial
errors tasks reloadForest
sessions' (click backend')
, joinButtonOrTutorial
boxes
sessions' (click backend')
, H.div { className: "home-public container1" }
, H.div { className: "home-public container1" }
[ renderPublic { }
[ renderPublic { }
, H.div { className:"col-12 d-flex justify-content-center" }
, H.div { className:"col-12 d-flex justify-content-center" }
...
@@ -102,16 +95,14 @@ homeLayoutCpt = here.component "homeLayout" cpt
...
@@ -102,16 +95,14 @@ homeLayoutCpt = here.component "homeLayout" cpt
T.write_ true showLogin
T.write_ true showLogin
Just _ -> T.write_ true showLogin
Just _ -> T.write_ true showLogin
joinButtonOrTutorial :: forall e. T.Box (Array FrontendError)
joinButtonOrTutorial :: forall e. Boxes
-> T.Box GAT.Storage
-> T2.ReloadS
-> Sessions
-> Sessions
-> (e -> Effect Unit)
-> (e -> Effect Unit)
-> R.Element
-> R.Element
joinButtonOrTutorial
errors tasks reloadForest
sessions click =
joinButtonOrTutorial
boxes
sessions click =
if Sessions.null sessions
if Sessions.null sessions
then joinButton click
then joinButton click
else tutorial {
errors, tasks, reloadForest
, sessions: Sessions.unSessions sessions }
else tutorial {
boxes
, sessions: Sessions.unSessions sessions }
joinButton :: forall e. (e -> Effect Unit) -> R.Element
joinButton :: forall e. (e -> Effect Unit) -> R.Element
joinButton click =
joinButton click =
...
@@ -158,16 +149,15 @@ summary =
...
@@ -158,16 +149,15 @@ summary =
toSummary (Tuto x) = H.li {} [ H.a {href: "#" <> x.id} [ H.text x.title ]]
toSummary (Tuto x) = H.li {} [ H.a {href: "#" <> x.id} [ H.text x.title ]]
type TutorialProps =
type TutorialProps =
( errors :: T.Box (Array FrontendError)
( boxes :: Boxes
, sessions :: Array Session
, sessions :: Array Session )
, tasks :: T.Box GAT.Storage
, reloadForest :: T.Box T2.Reload )
tutorial :: R2.Leaf TutorialProps
tutorial :: R2.Leaf TutorialProps
tutorial props = R.createElement tutorialCpt props []
tutorial props = R.createElement tutorialCpt props []
tutorialCpt :: R.Component TutorialProps
tutorialCpt :: R.Component TutorialProps
tutorialCpt = here.component "tutorial" cpt where
tutorialCpt = here.component "tutorial" cpt where
cpt { errors, sessions, tasks, reloadForest } _ = do
cpt { boxes
, sessions } _ = do
let folders = makeFolders sessions
let folders = makeFolders sessions
pure $ H.div { className: "mx-auto container" }
pure $ H.div { className: "mx-auto container" }
...
@@ -193,7 +183,7 @@ tutorialCpt = here.component "tutorial" cpt where
...
@@ -193,7 +183,7 @@ tutorialCpt = here.component "tutorial" cpt where
sessionToFolder session@(Session {treeId, username, backend: (Backend {name})}) =
sessionToFolder session@(Session {treeId, username, backend: (Backend {name})}) =
H.span { className: "folder" } [
H.span { className: "folder" } [
H.div { className: "d-flex justify-content-center" } [ H.text (username <> "@" <> name) ]
H.div { className: "d-flex justify-content-center" } [ H.text (username <> "@" <> name) ]
, H.div {} [ FV.folderView {
errors, session, tasks, reloadForest, nodeId: treeId, backFolder: false
} ] ]
, H.div {} [ FV.folderView {
backFolder: false, boxes, nodeId: treeId, session
} ] ]
startTutos :: Array Tuto
startTutos :: Array Tuto
startTutos =
startTutos =
...
...
src/Gargantext/Components/Nodes/Lists.purs
View file @
c10a6d14
...
@@ -2,23 +2,20 @@ module Gargantext.Components.Nodes.Lists where
...
@@ -2,23 +2,20 @@ module Gargantext.Components.Nodes.Lists where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Maybe (Maybe)
import Effect (Effect)
import Effect (Effect)
import Effect.Aff (launchAff_)
import Effect.Aff (launchAff_)
import Gargantext.
AsyncTasks as GAT
import Gargantext.
Components.App.Data (Boxes)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.NgramsTable.Loader (clearCache)
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus (loadCorpusWithChild)
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Corpus.Types (getCorpusInfo, CorpusInfo(..), Hyperdata(..))
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Tabs as Tabs
import Gargantext.Components.Nodes.Lists.Types (CacheState(..)
, SidePanel
)
import Gargantext.Components.Nodes.Lists.Types (CacheState(..))
import Gargantext.Components.Table as Table
import Gargantext.Components.Table as Table
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState)
import Gargantext.Sessions (WithSession, WithSessionContext, Session, sessionId, getCacheState, setCacheState)
import Gargantext.Types (FrontendError)
import Gargantext.Types as GT
import Gargantext.Types as GT
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Toestand as T2
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
...
@@ -29,15 +26,9 @@ here = R2.here "Gargantext.Components.Nodes.Lists"
...
@@ -29,15 +26,9 @@ here = R2.here "Gargantext.Components.Nodes.Lists"
--------------------------------------------------------
--------------------------------------------------------
type CommonPropsNoSession =
type CommonPropsNoSession =
( errors :: T.Box (Array FrontendError)
( boxes :: Boxes
, nodeId :: Int
, nodeId :: Int
, reloadForest :: T2.ReloadS
, sessionUpdate :: Session -> Effect Unit
, reloadMainPage :: T2.ReloadS
, reloadRoot :: T2.ReloadS
, sessionUpdate :: Session -> Effect Unit
, sidePanel :: T.Box (Maybe (Record SidePanel))
, sidePanelState :: T.Box GT.SidePanelState
, tasks :: T.Box GAT.Storage
)
)
type Props = WithSession CommonPropsNoSession
type Props = WithSession CommonPropsNoSession
...
@@ -48,27 +39,24 @@ type WithTreeProps = ( handed :: GT.Handed | Props )
...
@@ -48,27 +39,24 @@ type WithTreeProps = ( handed :: GT.Handed | Props )
listsLayout :: R2.Component Props
listsLayout :: R2.Component Props
listsLayout = R.createElement listsLayoutCpt
listsLayout = R.createElement listsLayoutCpt
listsLayoutCpt :: R.Component Props
listsLayoutCpt :: R.Component Props
listsLayoutCpt = here.component "listsLayout" cpt where
listsLayoutCpt = here.component "listsLayout" cpt where
cpt props@{ nodeId, session } _ = do
cpt props@{ nodeId, session } _ = do
let sid = sessionId session
let sid = sessionId session
pure $ listsLayoutWithKey (Record.merge props { key: show sid <> "-" <> show nodeId }) []
pure $ listsLayoutWithKey (Record.merge props { key: show sid <> "-" <> show nodeId }) []
type KeyProps = ( key :: String | Props )
type KeyProps =
( key :: String
| Props )
listsLayoutWithKey :: R2.Component KeyProps
listsLayoutWithKey :: R2.Component KeyProps
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKey = R.createElement listsLayoutWithKeyCpt
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt :: R.Component KeyProps
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
cpt {
errors
cpt {
boxes: boxes@{ reloadMainPage }
, nodeId
, nodeId
, reloadForest
, reloadMainPage
, reloadRoot
, session
, session
, sessionUpdate
, sessionUpdate } _ = do
, tasks } _ = do
activeTab <- T.useBox 0
activeTab <- T.useBox 0
_reloadMainPage' <- T.useLive T.unequal reloadMainPage
_reloadMainPage' <- T.useLive T.unequal reloadMainPage
...
@@ -98,15 +86,12 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
...
@@ -98,15 +86,12 @@ listsLayoutWithKeyCpt = here.component "listsLayoutWithKey" cpt where
, user: authors } []
, user: authors } []
, Tabs.tabs {
, Tabs.tabs {
activeTab
activeTab
, boxes
, cacheState
, cacheState
, corpusData
, corpusData
, corpusId
, corpusId
, errors
, key: "listsLayoutWithKey-tabs-" <> (show cacheState')
, key: "listsLayoutWithKey-tabs-" <> (show cacheState')
, reloadForest
, reloadRoot
, session
, session
, tasks
}
}
] }
] }
where
where
...
@@ -122,7 +107,6 @@ type SidePanelProps =
...
@@ -122,7 +107,6 @@ type SidePanelProps =
sidePanel :: R2.Component SidePanelProps
sidePanel :: R2.Component SidePanelProps
sidePanel = R.createElement sidePanelCpt
sidePanel = R.createElement sidePanelCpt
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt :: R.Component SidePanelProps
sidePanelCpt = here.component "sidePanel" cpt
sidePanelCpt = here.component "sidePanel" cpt
where
where
...
@@ -151,7 +135,6 @@ type SidePanelDocView = ( session :: Session )
...
@@ -151,7 +135,6 @@ type SidePanelDocView = ( session :: Session )
sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView :: R2.Component SidePanelDocView
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocView = R.createElement sidePanelDocViewCpt
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt :: R.Component SidePanelDocView
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt where
sidePanelDocViewCpt = here.component "sidePanelDocView" cpt where
cpt { } _ = do
cpt { } _ = do
...
...
src/Gargantext/Components/Nodes/Lists/Tabs.purs
View file @
c10a6d14
module Gargantext.Components.Nodes.Lists.Tabs where
module Gargantext.Components.Nodes.Lists.Tabs where
import Gargantext.Components.Nodes.Lists.Types
import Data.Array as A
import Data.Array as A
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Maybe (Maybe(..), fromMaybe)
import Data.Tuple.Nested ((/\))
import Data.Tuple.Nested ((/\))
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Gargantext.AsyncTasks as GAT
import Gargantext.AsyncTasks as GAT
import Gargantext.Components.App.Data (Boxes)
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable as NT
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.NgramsTable.Core as NTC
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
import Gargantext.Components.Nodes.Corpus.Chart.Metrics (metrics)
...
@@ -12,7 +15,6 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
...
@@ -12,7 +15,6 @@ import Gargantext.Components.Nodes.Corpus.Chart.Pie (pie, bar)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Tree (tree)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Chart.Utils (mNgramsTypeFromTabType)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Corpus.Types (CorpusData)
import Gargantext.Components.Nodes.Lists.Types
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Gargantext.Prelude (bind, pure, unit, ($), (<>))
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
...
@@ -29,22 +31,18 @@ here :: R2.Here
...
@@ -29,22 +31,18 @@ here :: R2.Here
here = R2.here "Gargantext.Components.Nodes.Lists.Tabs"
here = R2.here "Gargantext.Components.Nodes.Lists.Tabs"
type Props = (
type Props = (
activeTab :: T.Box Int
activeTab :: T.Box Int
, cacheState :: T.Box CacheState
, boxes :: Boxes
, corpusData :: CorpusData
, cacheState :: T.Box CacheState
, corpusId :: Int
, corpusData :: CorpusData
, errors :: T.Box (Array FrontendError)
, corpusId :: Int
, reloadForest :: T2.ReloadS
, session :: Session
, reloadRoot :: T2.ReloadS
, session :: Session
, tasks :: T.Box GAT.Storage
)
)
type PropsWithKey = ( key :: String | Props )
type PropsWithKey = ( key :: String | Props )
tabs :: Record PropsWithKey -> R.Element
tabs :: Record PropsWithKey -> R.Element
tabs props = R.createElement tabsCpt props []
tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component PropsWithKey
tabsCpt :: R.Component PropsWithKey
tabsCpt = here.component "tabs" cpt where
tabsCpt = here.component "tabs" cpt where
cpt props@{ activeTab } _ = do
cpt props@{ activeTab } _ = do
...
@@ -64,15 +62,12 @@ ngramsView :: R2.Component NgramsViewProps
...
@@ -64,15 +62,12 @@ ngramsView :: R2.Component NgramsViewProps
ngramsView = R.createElement ngramsViewCpt
ngramsView = R.createElement ngramsViewCpt
ngramsViewCpt :: R.Component NgramsViewProps
ngramsViewCpt :: R.Component NgramsViewProps
ngramsViewCpt = here.component "ngramsView" cpt where
ngramsViewCpt = here.component "ngramsView" cpt where
cpt props@{ cacheState
cpt props@{ boxes
, cacheState
, corpusData: { defaultListId }
, corpusData: { defaultListId }
, corpusId
, corpusId
, errors
, reloadForest
, reloadRoot
, mode
, mode
, session
, session } _ = do
, tasks } _ = do
chartsReload <- T.useBox T2.newReload
chartsReload <- T.useBox T2.newReload
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
path <- T.useBox $ NTC.initialPageParams props.session initialPath.corpusId [initialPath.listId] initialPath.tabType
...
@@ -93,16 +88,13 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -93,16 +88,13 @@ ngramsViewCpt = here.component "ngramsView" cpt where
pure $ R.fragment
pure $ R.fragment
( charts chartParams tabNgramType
( charts chartParams tabNgramType
<> [ NT.mainNgramsTable { afterSync: afterSync chartsReload
<> [ NT.mainNgramsTable { afterSync: afterSync chartsReload
, boxes
, cacheState
, cacheState
, defaultListId
, defaultListId
, errors
, path
, path
, reloadForest
, reloadRoot
, session
, session
, tabNgramType
, tabNgramType
, tabType
, tabType
, tasks
, withAutoUpdate: false
, withAutoUpdate: false
} []
} []
]
]
...
@@ -160,7 +152,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
...
@@ -160,7 +152,7 @@ ngramsViewCpt = here.component "ngramsView" cpt where
]
]
charts params _ = [ chart params mode ]
charts params _ = [ chart params mode ]
chart path Authors = pie {
error
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Authors = pie {
boxe
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Institutes = tree {
error
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Institutes = tree {
boxe
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Sources = bar {
error
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Sources = bar {
boxe
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Terms = metrics {
error
s, path, session, onClick: Nothing, onInit: Nothing }
chart path Terms = metrics {
boxe
s, path, session, onClick: Nothing, onInit: Nothing }
src/Gargantext/Components/Nodes/Texts.purs
View file @
c10a6d14
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Router.purs
View file @
c10a6d14
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/Tab.purs
View file @
c10a6d14
...
@@ -21,27 +21,27 @@ type TabsProps = (
...
@@ -21,27 +21,27 @@ type TabsProps = (
tabs :: R2.Leaf TabsProps
tabs :: R2.Leaf TabsProps
tabs props = R.createElement tabsCpt props []
tabs props = R.createElement tabsCpt props []
-- this is actually just the list of tabs, not the tab contents itself
-- this is actually just the list of tabs, not the tab contents itself
tabsCpt :: R.Component TabsProps
tabsCpt :: R.Component TabsProps
tabsCpt = here.component "tabs" cpt where
tabsCpt = here.component "tabs" cpt where
cpt props@{ activeTab, tabs } _ = do
cpt { activeTab
, tabs: tabs' } _ = do
activeTab' <- T.useLive T.unequal activeTab
activeTab' <- T.useLive T.unequal activeTab
pure $ H.div {}
pure $ H.div {}
[ H.nav {}
[ H.nav {}
[ H.br {}
[ H.br {}
, H.div { className: "nav nav-tabs", title: "Search result" }
, H.div { className: "nav nav-tabs", title: "Search result" }
(mapWithIndex (button activeTab activeTab') tabs)
(mapWithIndex (button activeTab activeTab') tabs
'
)
]
]
, H.div { className: "tab-content" }
, H.div { className: "tab-content" }
(mapWithIndex (item activeTab') tabs)
(mapWithIndex (item activeTab') tabs
'
)
]
]
button activeTab selected index (name /\ _) =
button activeTab selected index (name /\ _) =
H.a { className, on: { click } } [ H.text name ] where
H.a { className, on: { click } } [ H.text name ] where
eq = index == selected
eq = index == selected
className = "nav-item nav-link" <> (if eq then " active" else "")
className = "nav-item nav-link" <> (if eq then " active" else "")
click
e
= T.write_ index activeTab
click
_
= T.write_ index activeTab
item selected index (_ /\ cpt') = tab { selected, index } [ cpt' ]
item selected index (_ /\ cpt') = tab { selected, index } [ cpt' ]
-- TODO: document what these are (selection, item indices)
-- TODO: document what these are (selection, item indices)
...
...
src/Gargantext/Components/Table.purs
View file @
c10a6d14
...
@@ -164,8 +164,8 @@ filterRows { params: { limit, offset, orderBy } } rs = newRs
...
@@ -164,8 +164,8 @@ filterRows { params: { limit, offset, orderBy } } rs = newRs
where
where
newRs = Seq.take limit $ Seq.drop offset $ rs
newRs = Seq.take limit $ Seq.drop offset $ rs
defaultContainer ::
{title :: String} ->
Record TableContainerProps -> R.Element
defaultContainer :: Record TableContainerProps -> R.Element
defaultContainer
{title}
props = R.fragment $ props.syncResetButton <> controls
defaultContainer props = R.fragment $ props.syncResetButton <> controls
where
where
controls = [ R2.row
controls = [ R2.row
[ H.div {className: "col-md-4"} [ props.pageSizeDescription ]
[ H.div {className: "col-md-4"} [ props.pageSizeDescription ]
...
@@ -181,8 +181,8 @@ defaultContainer {title} props = R.fragment $ props.syncResetButton <> controls
...
@@ -181,8 +181,8 @@ defaultContainer {title} props = R.fragment $ props.syncResetButton <> controls
]
]
-- TODO: this needs to be in Gargantext.Pages.Corpus.Graph.Tabs
-- TODO: this needs to be in Gargantext.Pages.Corpus.Graph.Tabs
graphContainer ::
{title :: String} ->
Record TableContainerProps -> R.Element
graphContainer :: Record TableContainerProps -> R.Element
graphContainer
{title}
props =
graphContainer props =
-- TODO title in tabs name (above)
-- TODO title in tabs name (above)
H.table {className: "table"}
H.table {className: "table"}
[ H.thead {className: ""} [ props.tableHead ]
[ H.thead {className: ""} [ props.tableHead ]
...
...
src/Gargantext/Components/TopBar.purs
View file @
c10a6d14
...
@@ -3,28 +3,27 @@ module Gargantext.Components.TopBar where
...
@@ -3,28 +3,27 @@ module Gargantext.Components.TopBar where
import Gargantext.Prelude
import Gargantext.Prelude
import Data.Foldable (intercalate)
import Data.Foldable (intercalate)
import Reactix as R
import Gargantext.Components.App.Data (Boxes)
import Reactix.DOM.HTML as H
import Toestand as T
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.GraphExplorer.ToggleButton as Toggle
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Components.Themes (themeSwitcher, defaultTheme, allThemes)
import Gargantext.Types (
FrontendError(..),
Handed(..), reverseHanded)
import Gargantext.Types (Handed(..), reverseHanded)
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.TopBar"
here = R2.here "Gargantext.Components.TopBar"
type TopBarProps =
type TopBarProps =
( handed :: T.Box Handed
( boxes :: Boxes )
, showTree :: T.Box Boolean )
topBar :: R2.Component TopBarProps
topBar :: R2.Component TopBarProps
topBar = R.createElement topBarCpt
topBar = R.createElement topBarCpt
topBarCpt :: R.Component TopBarProps
topBarCpt :: R.Component TopBarProps
topBarCpt = here.component "topBar" cpt
topBarCpt = here.component "topBar" cpt
where
where
cpt {
handed, showTree
} children = do
cpt {
boxes: { handed, showTree }
} children = do
handed' <- T.useLive T.unequal handed
handed' <- T.useLive T.unequal handed
pure $ H.div { className: "navbar navbar-expand-lg navbar-dark bg-dark"
pure $ H.div { className: "navbar navbar-expand-lg navbar-dark bg-dark"
...
...
src/Gargantext/Config/REST.purs
View file @
c10a6d14
...
@@ -28,17 +28,19 @@ type Token = String
...
@@ -28,17 +28,19 @@ type Token = String
data RESTError =
data RESTError =
SendResponseError Affjax.Error
SendResponseError Affjax.Error
| ReadJSONError Foreign.MultipleErrors
| ReadJSONError Foreign.MultipleErrors
| CustomError String
derive instance Generic RESTError _
derive instance Generic RESTError _
instance Show RESTError where
instance Show RESTError where
show (SendResponseError e) = "SendResponseError " <> showError e
show (SendResponseError e) = "SendResponseError " <> showError e
where
where
showError (RequestContentError e') = "(RequestContentError " <> show e' <> ")"
showError (RequestContentError e')
= "(RequestContentError " <> show e' <> ")"
showError (ResponseBodyError fe rf) = "(ResponseBodyError " <> show fe <> " (rf)" -- <> show rf <> ")"
showError (ResponseBodyError fe rf) = "(ResponseBodyError " <> show fe <> " (rf)" -- <> show rf <> ")"
showError (TimeoutError) = "(TimeoutError)"
showError (TimeoutError) = "(TimeoutError)"
showError (RequestFailedError) = "(RequestFailedError)"
showError (RequestFailedError) = "(RequestFailedError)"
showError (XHROtherError e') = "(XHROtherError " <> show e' <> ")"
showError (XHROtherError e') = "(XHROtherError " <> show e' <> ")"
show (ReadJSONError e) = "ReadJSONError " <> show e
show (ReadJSONError e) = "ReadJSONError " <> show e
show (CustomError s) = "CustomError " <> s
instance Eq RESTError where
instance Eq RESTError where
-- this is crude but we need it only because of useLoader
-- this is crude but we need it only because of useLoader
eq _ _ = false
eq _ _ = false
...
...
src/Gargantext/Hooks/Loader.purs
View file @
c10a6d14
...
@@ -11,6 +11,7 @@ import Effect (Effect)
...
@@ -11,6 +11,7 @@ import Effect (Effect)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Aff (Aff, launchAff_, throwError)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Exception (error)
import Effect.Exception (error)
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)
import Gargantext.Config.Utils (handleRESTError)
import Gargantext.Config.Utils (handleRESTError)
...
@@ -20,6 +21,7 @@ import Gargantext.Utils.Crypto (Hash)
...
@@ -20,6 +21,7 @@ import Gargantext.Utils.Crypto (Hash)
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
import Reactix as R
import Reactix as R
import Simple.JSON as JSON
import Simple.JSON as JSON
import Toestand (Box)
import Toestand as T
import Toestand as T
here :: R2.Here
here :: R2.Here
...
@@ -97,9 +99,9 @@ derive instance Newtype (HashedResponse a) _
...
@@ -97,9 +99,9 @@ derive instance Newtype (HashedResponse a) _
derive newtype instance JSON.ReadForeign a => JSON.ReadForeign (HashedResponse a)
derive newtype instance JSON.ReadForeign a => JSON.ReadForeign (HashedResponse a)
derive newtype instance JSON.WriteForeign a => JSON.WriteForeign (HashedResponse a)
derive newtype instance JSON.WriteForeign a => JSON.WriteForeign (HashedResponse a)
type LoaderWithCacheAPIProps path res ret =
(
type LoaderWithCacheAPIProps path res ret =
cacheEndpoint :: path -> Aff (Either RESTError Hash)
( boxes :: Boxes
,
errors :: T.Box (Array FrontendError
)
,
cacheEndpoint :: path -> Aff (Either RESTError Hash
)
, handleResponse :: HashedResponse res -> ret
, handleResponse :: HashedResponse res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
, path :: path
, path :: path
...
@@ -110,12 +112,17 @@ useLoaderWithCacheAPI :: forall path res ret.
...
@@ -110,12 +112,17 @@ useLoaderWithCacheAPI :: forall path res ret.
Eq ret => Eq path => JSON.ReadForeign res =>
Eq ret => Eq path => JSON.ReadForeign res =>
Record (LoaderWithCacheAPIProps path res ret)
Record (LoaderWithCacheAPIProps path res ret)
-> R.Hooks R.Element
-> R.Hooks R.Element
useLoaderWithCacheAPI { cacheEndpoint, errors, handleResponse, mkRequest, path, renderer } = do
useLoaderWithCacheAPI { boxes
, cacheEndpoint
, handleResponse
, mkRequest
, path
, renderer } = do
state <- T.useBox Nothing
state <- T.useBox Nothing
state' <- T.useLive T.unequal state
state' <- T.useLive T.unequal state
useCachedAPILoaderEffect {
cacheEndpoint
useCachedAPILoaderEffect {
boxes
,
errors
,
cacheEndpoint
, handleResponse
, handleResponse
, mkRequest
, mkRequest
, path
, path
...
@@ -123,8 +130,8 @@ useLoaderWithCacheAPI { cacheEndpoint, errors, handleResponse, mkRequest, path,
...
@@ -123,8 +130,8 @@ useLoaderWithCacheAPI { cacheEndpoint, errors, handleResponse, mkRequest, path,
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 Hash)
boxes :: Boxes
,
errors :: T.Box (Array FrontendError
)
,
cacheEndpoint :: path -> Aff (Either RESTError Hash
)
, handleResponse :: HashedResponse res -> ret
, handleResponse :: HashedResponse res -> ret
, mkRequest :: path -> GUC.Request
, mkRequest :: path -> GUC.Request
, path :: path
, path :: path
...
@@ -135,8 +142,8 @@ useCachedAPILoaderEffect :: forall path res ret.
...
@@ -135,8 +142,8 @@ useCachedAPILoaderEffect :: forall path res ret.
Eq ret => Eq path => JSON.ReadForeign res =>
Eq ret => Eq path => JSON.ReadForeign res =>
Record (LoaderWithCacheAPIEffectProps path res ret)
Record (LoaderWithCacheAPIEffectProps path res ret)
-> R.Hooks Unit
-> R.Hooks Unit
useCachedAPILoaderEffect {
cacheEndpoint
useCachedAPILoaderEffect {
boxes: { errors }
,
errors
,
cacheEndpoint
, handleResponse
, handleResponse
, mkRequest
, mkRequest
, path
, path
...
...
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