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
8e2f29ac
Commit
8e2f29ac
authored
Nov 22, 2019
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Graph][FacetsTable] add document link to facets table title
parent
4a79d427
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
31 deletions
+46
-31
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+21
-16
GraphExplorer.purs
src/Gargantext/Components/GraphExplorer.purs
+6
-4
Sidebar.purs
src/Gargantext/Components/GraphExplorer/Sidebar.purs
+7
-5
Tabs.purs
src/Gargantext/Components/Nodes/Corpus/Graph/Tabs.purs
+12
-6
No files found.
src/Gargantext/Components/FacetsTable.purs
View file @
8e2f29ac
...
@@ -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.Search.Types (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
import Gargantext.Components.Search.Types (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,7 +282,7 @@ page props = R.createElement pageCpt props []
...
@@ -279,7 +282,7 @@ 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 }
T.table { rows, container, colNames, totalRecords, params }
where
where
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
...
@@ -294,14 +297,16 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
...
@@ -294,14 +297,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 @
8e2f29ac
...
@@ -97,7 +97,7 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -97,7 +97,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 [
]
]
...
@@ -131,14 +131,16 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
...
@@ -131,14 +131,16 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
mSidebar :: Maybe Graph.Graph
mSidebar :: Maybe Graph.Graph
-> Maybe GET.MetaData
-> Maybe GET.MetaData
-> { showSidePanel :: GET.SidePanelState
-> { 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/Sidebar.purs
View file @
8e2f29ac
...
@@ -15,11 +15,13 @@ import Gargantext.Components.RandomText (words)
...
@@ -15,11 +15,13 @@ 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
...
@@ -66,7 +68,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
...
@@ -66,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
]
]
]
]
]
]
...
@@ -91,13 +93,13 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
...
@@ -91,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/Nodes/Corpus/Graph/Tabs.purs
View file @
8e2f29ac
...
@@ -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}
...
...
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