Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
purescript-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
purescript-gargantext
Commits
98a290ef
Commit
98a290ef
authored
Nov 22, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE] fix conflicts.
parents
f38aaa7d
8e2f29ac
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
89 additions
and
54 deletions
+89
-54
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+22
-17
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+12
-4
Controls.purs
src/Gargantext/Components/GraphExplorer/Controls.purs
+3
-10
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+11
-7
ToggleButton.purs
src/Gargantext/Components/GraphExplorer/ToggleButton.purs
+24
-8
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+5
-0
Tabs.purs
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
+12
-6
Sigmax.purs
src/Gargantext/Hooks/Sigmax.purs
+0
-2
No files found.
src/Gargantext/Components/FacetsTable.purs
View file @
98a290ef
...
@@ -20,11 +20,12 @@ import Effect.Aff (Aff, launchAff_)
...
@@ -20,11 +20,12 @@ import Effect.Aff (Aff, launchAff_)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
------------------------------------------------------------------------
------------------------------------------------------------------------
import Gargantext.Ends (url)
import Gargantext.Ends (url
, Frontends
)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Components.DocsTable (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.DocsTable (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Routes (SessionRoute(Search,NodeAPI))
import Gargantext.Routes (SessionRoute(Search, NodeAPI), AppRoute(CorpusDocument))
import Gargantext.Routes as Routes
import Gargantext.Sessions (Session, sessionId, post, deleteWithBody)
import Gargantext.Sessions (Session, sessionId, post, deleteWithBody)
import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..))
import Gargantext.Types (NodeType(..), OrderBy(..), NodePath(..))
import Gargantext.Utils (toggleSet)
import Gargantext.Utils (toggleSet)
...
@@ -55,13 +56,14 @@ instance decodeSearchResults :: DecodeJson SearchResults where
...
@@ -55,13 +56,14 @@ instance decodeSearchResults :: DecodeJson SearchResults where
pure $ SearchResults {results}
pure $ SearchResults {results}
type Props =
type Props =
( nodeId :: Int
( chart :: R.Element
, container :: Record T.TableContainerProps -> R.Element
, frontends :: Frontends
, listId :: Int
, listId :: Int
, nodeId :: Int
, query :: TextQuery
, query :: TextQuery
, totalRecords :: Int
, chart :: R.Element
, container :: Record T.TableContainerProps -> R.Element
, session :: Session
, session :: Session
, totalRecords :: Int
)
)
-- | Tracks the ids of documents to delete and that have been deleted
-- | Tracks the ids of documents to delete and that have been deleted
...
@@ -165,14 +167,14 @@ docView props = R.createElement docViewCpt props []
...
@@ -165,14 +167,14 @@ docView props = R.createElement docViewCpt props []
docViewCpt :: R.Component Props
docViewCpt :: R.Component Props
docViewCpt = R.hooksComponent "G.C.FacetsTable.DocView" cpt
docViewCpt = R.hooksComponent "G.C.FacetsTable.DocView" cpt
where
where
cpt {session, nodeId, listId, query, totalRecords, chart, container} _ = do
cpt {
frontends,
session, nodeId, listId, query, totalRecords, chart, container} _ = do
deletions <- R.useState' initialDeletions
deletions <- R.useState' initialDeletions
path <- R.useState' $ initialPagePath {nodeId, listId, query, session}
path <- R.useState' $ initialPagePath {nodeId, listId, query, session}
pure $ H.div { className: "container1" }
pure $ H.div { className: "container1" }
[ H.div { className: "row" }
[ H.div { className: "row" }
[ chart
[ chart
, H.div { className: "col-md-12" }
, H.div { className: "col-md-12" }
[ pageLayout { deletions, totalRecords, container, session, path } ]
[ pageLayout { deletions,
frontends,
totalRecords, container, session, path } ]
, H.div { className: "col-md-12" }
, H.div { className: "col-md-12" }
[ H.button { style: buttonStyle, on: { click: trashClick deletions } }
[ H.button { style: buttonStyle, on: { click: trashClick deletions } }
[ H.i { className: "glyphitem glyphicon glyphicon-trash"
[ H.i { className: "glyphitem glyphicon glyphicon-trash"
...
@@ -208,7 +210,7 @@ docViewGraph props = R.createElement docViewCpt props []
...
@@ -208,7 +210,7 @@ docViewGraph props = R.createElement docViewCpt props []
docViewGraphCpt :: R.Component Props
docViewGraphCpt :: R.Component Props
docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
where
where
cpt {session, nodeId, listId, query, totalRecords, chart, container} _ = do
cpt {
frontends,
session, nodeId, listId, query, totalRecords, chart, container} _ = do
deletions <- R.useState' initialDeletions
deletions <- R.useState' initialDeletions
let buttonStyle = { backgroundColor: "peru", padding : "9px"
let buttonStyle = { backgroundColor: "peru", padding : "9px"
, color : "white", border : "white", float: "right"}
, color : "white", border : "white", float: "right"}
...
@@ -222,7 +224,7 @@ docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
...
@@ -222,7 +224,7 @@ docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
[ H.div { className: "row" }
[ H.div { className: "row" }
[ chart
[ chart
, H.div { className: "col-md-12" }
, H.div { className: "col-md-12" }
[ pageLayout { totalRecords, deletions, container, session, path }
[ pageLayout {
frontends,
totalRecords, deletions, container, session, path }
, H.button { style: buttonStyle, on: { click: performClick } }
, H.button { style: buttonStyle, on: { click: performClick } }
[ H.i { className: "glyphitem glyphicon glyphicon-trash"
[ H.i { className: "glyphitem glyphicon glyphicon-trash"
, style: { marginRight : "9px" } } []
, style: { marginRight : "9px" } } []
...
@@ -253,7 +255,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do
...
@@ -253,7 +255,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do
convOrderBy _ = DateAsc -- TODO
convOrderBy _ = DateAsc -- TODO
type PageLayoutProps =
type PageLayoutProps =
( totalRecords :: Int
( frontends :: Frontends
, totalRecords :: Int
, deletions :: R.State Deletions
, deletions :: R.State Deletions
, container :: Record T.TableContainerProps -> R.Element
, container :: Record T.TableContainerProps -> R.Element
, session :: Session
, session :: Session
...
@@ -269,9 +272,9 @@ pageLayout props = R.createElement pageLayoutCpt props []
...
@@ -269,9 +272,9 @@ pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = R.hooksComponent "G.C.FacetsTable.PageLayout" cpt
pageLayoutCpt = R.hooksComponent "G.C.FacetsTable.PageLayout" cpt
where
where
cpt {totalRecords, deletions, container, session, path} _ = do
cpt {
frontends,
totalRecords, deletions, container, session, path} _ = do
useLoader (fst path) loadPage $ \documents ->
useLoader (fst path) loadPage $ \documents ->
page {totalRecords, deletions, container, session, path, documents}
page {
frontends,
totalRecords, deletions, container, session, path, documents}
page :: Record PageProps -> R.Element
page :: Record PageProps -> R.Element
page props = R.createElement pageCpt props []
page props = R.createElement pageCpt props []
...
@@ -279,8 +282,8 @@ page props = R.createElement pageCpt props []
...
@@ -279,8 +282,8 @@ page props = R.createElement pageCpt props []
pageCpt :: R.Component PageProps
pageCpt :: R.Component PageProps
pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
where
where
cpt {totalRecords, container, deletions, documents, session, path: path@({nodeId, listId, query} /\ setPath)} _ = do
cpt {
frontends,
totalRecords, container, deletions, documents, session, path: path@({nodeId, listId, query} /\ setPath)} _ = do
T.table { rows, container, colNames, totalRecords, params, wrapColElts
}
T.table { rows, container, colNames, totalRecords, params, wrapColElts}
where
where
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
params = (fst path).params /\ setParams
params = (fst path).params /\ setParams
...
@@ -295,14 +298,16 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
...
@@ -295,14 +298,16 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
| id > 1 = H.a { href, target: "blank" } [ H.text label ]
| id > 1 = H.a { href, target: "blank" } [ H.text label ]
where href = url session $ NodePath (sessionId session) NodeContact (Just id)
where href = url session $ NodePath (sessionId session) NodeContact (Just id)
| otherwise = H.text label
| otherwise = H.text label
documentUrl id =
url frontends $ Routes.CorpusDocument (sessionId session) nodeId listId id
comma = H.span {} [ H.text ", " ]
comma = H.span {} [ H.text ", " ]
rows = row <$> filter (not <<< isDeleted) documents
rows = row <$> filter (not <<< isDeleted) documents
row dv@(DocumentsView {id,score,title,source,date, authors,pairs,delete,category}) =
row dv@(DocumentsView {id,score,title,source,date, authors,pairs,delete,category}) =
{ row:
{ row:
[ H.
a { className: gi category, on: {click: markClick} } [
]
[ H.
div {} [ H.a { className: gi category, on: {click: markClick} } []
]
-- TODO show date: Year-Month-Day only
-- TODO show date: Year-Month-Day only
, maybeStricken delete [ H.text date ]
, maybeStricken delete [ H.text date ]
, maybeStricken delete [ H.
text title
]
, maybeStricken delete [ H.
a {target: "_blank", href: documentUrl id} [ H.text title ]
]
, maybeStricken delete [ H.text source ]
, maybeStricken delete [ H.text source ]
, maybeStricken delete [ H.text authors ]
, maybeStricken delete [ H.text authors ]
-- , maybeStricken $ intercalate [comma] (pairUrl <$> pairs)
-- , maybeStricken $ intercalate [comma] (pairUrl <$> pairs)
...
...
src/Gargantext/Components/GraphExplorer.purs
View file @
98a290ef
...
@@ -75,6 +75,12 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -75,6 +75,12 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
showLogin <- snd <$> R.useState' true
showLogin <- snd <$> R.useState' true
selectedNodeIds <- R.useState' $ Set.empty
selectedNodeIds <- R.useState' $ Set.empty
R.useEffect' $ do
if fst controls.showSidePanel == GET.InitialClosed && (not Set.isEmpty $ fst selectedNodeIds) then
snd controls.showSidePanel $ \_ -> GET.Opened
else
pure unit
pure $
pure $
RH.div
RH.div
{ id: "graph-explorer" }
{ id: "graph-explorer" }
...
@@ -90,7 +96,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -90,7 +96,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
, row [ tree {mCurrentRoute, treeId} controls showLogin
, row [ tree {mCurrentRoute, treeId} controls showLogin
, RH.div { ref: graphRef, id: "graph-view", className: "col-md-12", style: {height: "95%"} } [] -- graph container
, RH.div { ref: graphRef, id: "graph-view", className: "col-md-12", style: {height: "95%"} } [] -- graph container
, mGraph graphRef controls.sigmaRef {graphId, graph, selectedNodeIds}
, mGraph graphRef controls.sigmaRef {graphId, graph, selectedNodeIds}
, mSidebar graph mMetaData {session, selectedNodeIds, showSidePanel: fst controls.showSidePanel}
, mSidebar graph mMetaData {
frontends,
session, selectedNodeIds, showSidePanel: fst controls.showSidePanel}
]
]
, row [
, row [
]
]
...
@@ -124,14 +130,16 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -124,14 +130,16 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
mSidebar :: Maybe Graph.Graph
mSidebar :: Maybe Graph.Graph
-> Maybe GET.MetaData
-> Maybe GET.MetaData
-> { showSidePanel :: Boolean
-> { frontends :: Frontends
, showSidePanel :: GET.SidePanelState
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, session :: Session }
, session :: Session }
-> R.Element
-> R.Element
mSidebar Nothing _ _ = RH.div {} []
mSidebar Nothing _ _ = RH.div {} []
mSidebar _ Nothing _ = RH.div {} []
mSidebar _ Nothing _ = RH.div {} []
mSidebar (Just graph) (Just metaData) {session, selectedNodeIds, showSidePanel} =
mSidebar (Just graph) (Just metaData) {frontends, session, selectedNodeIds, showSidePanel} =
Sidebar.sidebar { graph
Sidebar.sidebar { frontends
, graph
, metaData
, metaData
, session
, session
, selectedNodeIds
, selectedNodeIds
...
...
src/Gargantext/Components/GraphExplorer/Controls.purs
View file @
98a290ef
...
@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.Controls
...
@@ -6,7 +6,6 @@ module Gargantext.Components.GraphExplorer.Controls
, controlsCpt
, controlsCpt
, getShowTree, setShowTree
, getShowTree, setShowTree
, getShowControls, setShowControls
, getShowControls, setShowControls
, getShowSidePanel, setShowSidePanel
, getCursorSize, setCursorSize
, getCursorSize, setCursorSize
, getMultiNodeSelect, setMultiNodeSelect
, getMultiNodeSelect, setMultiNodeSelect
) where
) where
...
@@ -25,17 +24,17 @@ import Gargantext.Components.GraphExplorer.Button (centerButton)
...
@@ -25,17 +24,17 @@ import Gargantext.Components.GraphExplorer.Button (centerButton)
import Gargantext.Components.GraphExplorer.RangeControl (edgeSizeControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.RangeControl (edgeSizeControl, nodeSizeControl)
import Gargantext.Components.GraphExplorer.SlideButton (cursorSizeButton, labelSizeButton)
import Gargantext.Components.GraphExplorer.SlideButton (cursorSizeButton, labelSizeButton)
import Gargantext.Components.GraphExplorer.ToggleButton (edgesToggleButton, pauseForceAtlasButton)
import Gargantext.Components.GraphExplorer.ToggleButton (edgesToggleButton, pauseForceAtlasButton)
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Range as Range
import Gargantext.Utils.Reactix as R2
import Gargantext.Utils.Reactix as R2
type Controls =
type Controls =
( cursorSize :: R.State Number
( cursorSize :: R.State Number
, multiNodeSelect :: R.Ref Boolean
, multiNodeSelect :: R.Ref Boolean
, showControls :: R.State Boolean
, showControls :: R.State Boolean
, showSidePanel :: R.State
Boolean
, showSidePanel :: R.State
GET.SidePanelState
, showTree :: R.State Boolean
, showTree :: R.State Boolean
, sigmaRef :: R.Ref Sigmax.Sigma
, sigmaRef :: R.Ref Sigmax.Sigma
)
)
...
@@ -125,7 +124,7 @@ useGraphControls = do
...
@@ -125,7 +124,7 @@ useGraphControls = do
cursorSize <- R.useState' 10.0
cursorSize <- R.useState' 10.0
multiNodeSelect <- R.useRef false
multiNodeSelect <- R.useRef false
showControls <- R.useState' false
showControls <- R.useState' false
showSidePanel <- R.useState'
false
showSidePanel <- R.useState'
GET.InitialClosed
showTree <- R.useState' false
showTree <- R.useState' false
sigma <- Sigmax.initSigma
sigma <- Sigmax.initSigma
sigmaRef <- R.useRef sigma
sigmaRef <- R.useRef sigma
...
@@ -141,9 +140,6 @@ useGraphControls = do
...
@@ -141,9 +140,6 @@ useGraphControls = do
getShowControls :: Record Controls -> Boolean
getShowControls :: Record Controls -> Boolean
getShowControls { showControls: ( should /\ _ ) } = should
getShowControls { showControls: ( should /\ _ ) } = should
getShowSidePanel :: Record Controls -> Boolean
getShowSidePanel { showSidePanel: ( should /\ _ ) } = should
getShowTree :: Record Controls -> Boolean
getShowTree :: Record Controls -> Boolean
getShowTree { showTree: ( should /\ _ ) } = should
getShowTree { showTree: ( should /\ _ ) } = should
...
@@ -156,9 +152,6 @@ getMultiNodeSelect { multiNodeSelect } = R.readRef multiNodeSelect
...
@@ -156,9 +152,6 @@ getMultiNodeSelect { multiNodeSelect } = R.readRef multiNodeSelect
setShowControls :: Record Controls -> Boolean -> Effect Unit
setShowControls :: Record Controls -> Boolean -> Effect Unit
setShowControls { showControls: ( _ /\ set ) } v = set $ const v
setShowControls { showControls: ( _ /\ set ) } v = set $ const v
setShowSidePanel :: Record Controls -> Boolean -> Effect Unit
setShowSidePanel { showSidePanel: ( _ /\ set ) } v = set $ const v
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree :: Record Controls -> Boolean -> Effect Unit
setShowTree { showTree: ( _ /\ set ) } v = set $ not <<< const v
setShowTree { showTree: ( _ /\ set ) } v = set $ not <<< const v
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
98a290ef
...
@@ -15,15 +15,17 @@ import Gargantext.Components.RandomText (words)
...
@@ -15,15 +15,17 @@ import Gargantext.Components.RandomText (words)
import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT
import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT
import Gargantext.Components.Graph as Graph
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
type Props =
type Props =
( graph :: Graph.Graph
( frontends :: Frontends
, graph :: Graph.Graph
, metaData :: GET.MetaData
, metaData :: GET.MetaData
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, session :: Session
, session :: Session
, showSidePanel ::
Boolean
, showSidePanel ::
GET.SidePanelState
)
)
sidebar :: Record Props -> R.Element
sidebar :: Record Props -> R.Element
...
@@ -32,7 +34,9 @@ sidebar props = R.createElement sidebarCpt props []
...
@@ -32,7 +34,9 @@ sidebar props = R.createElement sidebarCpt props []
sidebarCpt :: R.Component Props
sidebarCpt :: R.Component Props
sidebarCpt = R.hooksComponent "Sidebar" cpt
sidebarCpt = R.hooksComponent "Sidebar" cpt
where
where
cpt {showSidePanel: false} _children = do
cpt {showSidePanel: GET.Closed} _children = do
pure $ RH.div {} []
cpt {showSidePanel: GET.InitialClosed} _children = do
pure $ RH.div {} []
pure $ RH.div {} []
cpt props _children = do
cpt props _children = do
let nodesMap = SigmaxTypes.nodesMap props.graph
let nodesMap = SigmaxTypes.nodesMap props.graph
...
@@ -64,7 +68,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
...
@@ -64,7 +68,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
]
]
, RH.div { className: "col-md-12", id: "query" }
, RH.div { className: "col-md-12", id: "query" }
[
[
query props.metaData props.session nodesMap props.selectedNodeIds
query props.
frontends props.
metaData props.session nodesMap props.selectedNodeIds
]
]
]
]
]
]
...
@@ -89,13 +93,13 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
...
@@ -89,13 +93,13 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
, "complex systems"
, "complex systems"
, "wireless communications" ]
, "wireless communications" ]
query _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query _ _ _
_
(selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query
frontends
(GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query' (head metaData.corpusId)
query' (head metaData.corpusId)
where
where
query' Nothing = RH.div {} []
query' Nothing = RH.div {} []
query' (Just corpusId) =
query' (Just corpusId) =
GT.tabs {session, query: q <$> Set.toUnfoldable selectedNodeIds, sides: [side corpusId]}
GT.tabs {
frontends,
session, query: q <$> Set.toUnfoldable selectedNodeIds, sides: [side corpusId]}
q id = case Map.lookup id nodesMap of
q id = case Map.lookup id nodesMap of
Nothing -> []
Nothing -> []
Just n -> words n.label
Just n -> words n.label
...
...
src/Gargantext/Components/GraphExplorer/ToggleButton.purs
View file @
98a290ef
...
@@ -16,6 +16,7 @@ import Effect (Effect)
...
@@ -16,6 +16,7 @@ import Effect (Effect)
import Reactix as R
import Reactix as R
import Reactix.DOM.HTML as H
import Reactix.DOM.HTML as H
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax as Sigmax
import Gargantext.Hooks.Sigmax.Sigma as Sigma
import Gargantext.Hooks.Sigmax.Sigma as Sigma
...
@@ -87,11 +88,26 @@ treeToggleButton state =
...
@@ -87,11 +88,26 @@ treeToggleButton state =
, onClick: \_ -> snd state not
, onClick: \_ -> snd state not
}
}
sidebarToggleButton :: R.State Boolean -> R.Element
sidebarToggleButton :: R.State GET.SidePanelState -> R.Element
sidebarToggleButton state =
sidebarToggleButton (state /\ setState) = R.createElement el {} []
toggleButton {
where
state: state
el = R.hooksComponent "SidebarToggleButton" cpt
, onMessage: "Hide Sidebar"
cpt {} _ = do
, offMessage: "Show Sidebar"
pure $
, onClick: \_ -> snd state not
H.span {}
}
[
H.button
{ className: "btn btn-primary", on: {click: onClick} }
[ H.text (text onMessage offMessage state) ]
]
onMessage = "Hide Sidebar"
offMessage = "Show Sidebar"
text on _off GET.Opened = on
text _on off GET.InitialClosed = off
text _on off GET.Closed = off
onClick = \_ -> do
setState $ \s -> case s of
GET.InitialClosed -> GET.Opened
GET.Closed -> GET.Opened
GET.Opened -> GET.Closed
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
98a290ef
...
@@ -184,3 +184,8 @@ defaultPalette = ["#5fa571","#ab9ba2","#da876d","#bdd3ff","#b399df","#ffdfed","#
...
@@ -184,3 +184,8 @@ defaultPalette = ["#5fa571","#ab9ba2","#da876d","#bdd3ff","#b399df","#ffdfed","#
intColor :: Int -> String
intColor :: Int -> String
intColor i = unsafePartial $ fromJust $ defaultPalette !! (i `mod` length defaultPalette)
intColor i = unsafePartial $ fromJust $ defaultPalette !! (i `mod` length defaultPalette)
data SidePanelState = InitialClosed | Opened | Closed
derive instance eqSidePanelState :: Eq SidePanelState
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
View file @
98a290ef
...
@@ -8,9 +8,15 @@ import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
...
@@ -8,9 +8,15 @@ import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
import Gargantext.Components.FacetsTable (TextQuery, docView)
import Gargantext.Components.FacetsTable (TextQuery, docView)
import Gargantext.Components.Table as T
import Gargantext.Components.Table as T
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends)
import Gargantext.Sessions (Session)
import Gargantext.Sessions (Session)
type Props = ( session :: Session, query :: TextQuery, sides :: Array GraphSideCorpus )
type Props = (
frontends :: Frontends
, query :: TextQuery
, session :: Session
, sides :: Array GraphSideCorpus
)
tabs :: Record Props -> R.Element
tabs :: Record Props -> R.Element
tabs props = R.createElement tabsCpt props []
tabs props = R.createElement tabsCpt props []
...
@@ -19,17 +25,17 @@ tabs props = R.createElement tabsCpt props []
...
@@ -19,17 +25,17 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component Props
tabsCpt :: R.Component Props
tabsCpt = R.hooksComponent "G.P.Corpus.Graph.Tabs.tabs" cpt
tabsCpt = R.hooksComponent "G.P.Corpus.Graph.Tabs.tabs" cpt
where
where
cpt {
session, query
, sides} _ = do
cpt {
frontends, query, session
, sides} _ = do
active <- R.useState' 0
active <- R.useState' 0
pure $ Tab.tabs {tabs: tabs', selected: fst active}
pure $ Tab.tabs {tabs: tabs', selected: fst active}
where
where
tabs' = fromFoldable $ tab session query <$> sides
tabs' = fromFoldable $ tab
frontends
session query <$> sides
tab :: Session -> TextQuery -> GraphSideCorpus -> Tuple String R.Element
tab ::
Frontends ->
Session -> TextQuery -> GraphSideCorpus -> Tuple String R.Element
tab session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) =
tab
frontends
session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) =
Tuple corpusLabel (docView dvProps)
Tuple corpusLabel (docView dvProps)
where
where
dvProps = {session, nodeId, listId, query, chart, totalRecords: 4736, container}
dvProps = {
frontends,
session, nodeId, listId, query, chart, totalRecords: 4736, container}
-- TODO totalRecords: probably need to insert a corpusLoader.
-- TODO totalRecords: probably need to insert a corpusLoader.
chart = mempty
chart = mempty
container = T.graphContainer {title: corpusLabel}
container = T.graphContainer {title: corpusLabel}
...
...
src/Gargantext/Hooks/Sigmax.purs
View file @
98a290ef
...
@@ -157,7 +157,6 @@ setEdges sigma val = do
...
@@ -157,7 +157,6 @@ setEdges sigma val = do
markSelectedNodes :: Sigma.Sigma -> SelectedNodeIds -> NodesMap -> Effect Unit
markSelectedNodes :: Sigma.Sigma -> SelectedNodeIds -> NodesMap -> Effect Unit
markSelectedNodes sigma selectedNodeIds graphNodes = do
markSelectedNodes sigma selectedNodeIds graphNodes = do
log2 "[markSelectedNodes] selectedNodeIds" selectedNodeIds
Sigma.forEachNode sigma \n -> do
Sigma.forEachNode sigma \n -> do
case Map.lookup n.id graphNodes of
case Map.lookup n.id graphNodes of
Nothing -> error $ "Node id " <> n.id <> " not found in graphNodes map"
Nothing -> error $ "Node id " <> n.id <> " not found in graphNodes map"
...
@@ -176,7 +175,6 @@ bindSelectedNodesClick :: R.Ref Sigma -> R.State SelectedNodeIds -> Effect Unit
...
@@ -176,7 +175,6 @@ bindSelectedNodesClick :: R.Ref Sigma -> R.State SelectedNodeIds -> Effect Unit
bindSelectedNodesClick sigmaRef (_ /\ setSelectedNodeIds) =
bindSelectedNodesClick sigmaRef (_ /\ setSelectedNodeIds) =
dependOnSigma (R.readRef sigmaRef) "[graphCpt] no sigma" $ \sigma ->
dependOnSigma (R.readRef sigmaRef) "[graphCpt] no sigma" $ \sigma ->
Sigma.bindClickNode sigma $ \node -> do
Sigma.bindClickNode sigma $ \node -> do
log2 "[graphCpt] clickNode" node
setSelectedNodeIds \nids ->
setSelectedNodeIds \nids ->
if Set.member node.id nids then
if Set.member node.id nids then
Set.delete node.id nids
Set.delete node.id nids
...
...
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