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
Show 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_)
import Reactix as R
import Reactix.DOM.HTML as H
------------------------------------------------------------------------
import Gargantext.Ends (url)
import Gargantext.Ends (url
, Frontends
)
import Gargantext.Hooks.Loader (useLoader)
import Gargantext.Components.Search.Types (Category(..), CategoryQuery(..), favCategory, decodeCategory, putCategories)
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.Types (NodeType(..), OrderBy(..), NodePath(..))
import Gargantext.Utils (toggleSet)
...
...
@@ -55,13 +56,14 @@ instance decodeSearchResults :: DecodeJson SearchResults where
pure $ SearchResults {results}
type Props =
( nodeId :: Int
( chart :: R.Element
, container :: Record T.TableContainerProps -> R.Element
, frontends :: Frontends
, listId :: Int
, nodeId :: Int
, query :: TextQuery
, totalRecords :: Int
, chart :: R.Element
, container :: Record T.TableContainerProps -> R.Element
, session :: Session
, totalRecords :: Int
)
-- | Tracks the ids of documents to delete and that have been deleted
...
...
@@ -165,14 +167,14 @@ docView props = R.createElement docViewCpt props []
docViewCpt :: R.Component Props
docViewCpt = R.hooksComponent "G.C.FacetsTable.DocView" cpt
where
cpt {session, nodeId, listId, query, totalRecords, chart, container} _ = do
cpt {
frontends,
session, nodeId, listId, query, totalRecords, chart, container} _ = do
deletions <- R.useState' initialDeletions
path <- R.useState' $ initialPagePath {nodeId, listId, query, session}
pure $ H.div { className: "container1" }
[ H.div { className: "row" }
[ chart
, 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.button { style: buttonStyle, on: { click: trashClick deletions } }
[ H.i { className: "glyphitem glyphicon glyphicon-trash"
...
...
@@ -208,7 +210,7 @@ docViewGraph props = R.createElement docViewCpt props []
docViewGraphCpt :: R.Component Props
docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
where
cpt {session, nodeId, listId, query, totalRecords, chart, container} _ = do
cpt {
frontends,
session, nodeId, listId, query, totalRecords, chart, container} _ = do
deletions <- R.useState' initialDeletions
let buttonStyle = { backgroundColor: "peru", padding : "9px"
, color : "white", border : "white", float: "right"}
...
...
@@ -222,7 +224,7 @@ docViewGraphCpt = R.hooksComponent "FacetsDocViewGraph" cpt
[ H.div { className: "row" }
[ chart
, 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.i { className: "glyphitem glyphicon glyphicon-trash"
, style: { marginRight : "9px" } } []
...
...
@@ -253,7 +255,8 @@ loadPage {session, nodeId, listId, query, params: {limit, offset, orderBy}} = do
convOrderBy _ = DateAsc -- TODO
type PageLayoutProps =
( totalRecords :: Int
( frontends :: Frontends
, totalRecords :: Int
, deletions :: R.State Deletions
, container :: Record T.TableContainerProps -> R.Element
, session :: Session
...
...
@@ -269,9 +272,9 @@ pageLayout props = R.createElement pageLayoutCpt props []
pageLayoutCpt :: R.Component PageLayoutProps
pageLayoutCpt = R.hooksComponent "G.C.FacetsTable.PageLayout" cpt
where
cpt {totalRecords, deletions, container, session, path} _ = do
cpt {
frontends,
totalRecords, deletions, container, session, path} _ = do
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 props = R.createElement pageCpt props []
...
...
@@ -279,7 +282,7 @@ page props = R.createElement pageCpt props []
pageCpt :: R.Component PageProps
pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
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 }
where
setParams f = setPath $ \p@{params: ps} -> p {params = f ps}
...
...
@@ -294,14 +297,16 @@ pageCpt = R.staticComponent "G.C.FacetsTable.Page" cpt
| id > 1 = H.a { href, target: "blank" } [ H.text label ]
where href = url session $ NodePath (sessionId session) NodeContact (Just id)
| otherwise = H.text label
documentUrl id =
url frontends $ Routes.CorpusDocument (sessionId session) nodeId listId id
comma = H.span {} [ H.text ", " ]
rows = row <$> filter (not <<< isDeleted) documents
row dv@(DocumentsView {id,score,title,source,date, authors,pairs,delete,category}) =
{ 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
, 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 authors ]
-- , 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
, row [ tree {mCurrentRoute, treeId} controls showLogin
, RH.div { ref: graphRef, id: "graph-view", className: "col-md-12", style: {height: "95%"} } [] -- graph container
, 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 [
]
...
...
@@ -131,14 +131,16 @@ explorerCpt = R.hooksComponent "G.C.GraphExplorer.explorer" cpt
mSidebar :: Maybe Graph.Graph
-> Maybe GET.MetaData
-> { showSidePanel :: GET.SidePanelState
-> { frontends :: Frontends
, showSidePanel :: GET.SidePanelState
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, session :: Session }
-> R.Element
mSidebar Nothing _ _ = RH.div {} []
mSidebar _ Nothing _ = RH.div {} []
mSidebar (Just graph) (Just metaData) {session, selectedNodeIds, showSidePanel} =
Sidebar.sidebar { graph
mSidebar (Just graph) (Just metaData) {frontends, session, selectedNodeIds, showSidePanel} =
Sidebar.sidebar { frontends
, graph
, metaData
, session
, selectedNodeIds
...
...
src/Gargantext/Components/GraphExplorer/Sidebar.purs
View file @
8e2f29ac
...
...
@@ -15,11 +15,13 @@ import Gargantext.Components.RandomText (words)
import Gargantext.Components.Nodes.Corpus.Graph.Tabs as GT
import Gargantext.Components.Graph as Graph
import Gargantext.Components.GraphExplorer.Types as GET
import Gargantext.Ends (Frontends)
import Gargantext.Hooks.Sigmax.Types as SigmaxTypes
import Gargantext.Sessions (Session)
type Props =
( graph :: Graph.Graph
( frontends :: Frontends
, graph :: Graph.Graph
, metaData :: GET.MetaData
, selectedNodeIds :: R.State SigmaxTypes.SelectedNodeIds
, session :: Session
...
...
@@ -66,7 +68,7 @@ sidebarCpt = R.hooksComponent "Sidebar" cpt
]
, 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
, "complex systems"
, "wireless communications" ]
query _ _ _ (selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query (GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query _ _ _
_
(selectedNodeIds /\ _) | Set.isEmpty selectedNodeIds = RH.div {} []
query
frontends
(GET.MetaData metaData) session nodesMap (selectedNodeIds /\ _) =
query' (head metaData.corpusId)
where
query' Nothing = RH.div {} []
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
Nothing -> []
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(..))
import Gargantext.Components.FacetsTable (TextQuery, docView)
import Gargantext.Components.Table as T
import Gargantext.Components.Tab as Tab
import Gargantext.Ends (Frontends)
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 props = R.createElement tabsCpt props []
...
...
@@ -19,17 +25,17 @@ tabs props = R.createElement tabsCpt props []
tabsCpt :: R.Component Props
tabsCpt = R.hooksComponent "G.P.Corpus.Graph.Tabs.tabs" cpt
where
cpt {
session, query
, sides} _ = do
cpt {
frontends, query, session
, sides} _ = do
active <- R.useState' 0
pure $ Tab.tabs {tabs: tabs', selected: fst active}
where
tabs' = fromFoldable $ tab session query <$> sides
tabs' = fromFoldable $ tab
frontends
session query <$> sides
tab :: Session -> TextQuery -> GraphSideCorpus -> Tuple String R.Element
tab session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) =
tab ::
Frontends ->
Session -> TextQuery -> GraphSideCorpus -> Tuple String R.Element
tab
frontends
session query (GraphSideCorpus {corpusId: nodeId, corpusLabel, listId}) =
Tuple corpusLabel (docView dvProps)
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.
chart = mempty
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