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
Christian Merten
purescript-gargantext
Commits
34d8fef7
Unverified
Commit
34d8fef7
authored
Dec 13, 2018
by
Nicolas Pouillard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[GRAPH] Duplicate DocsTable as FacetsTable
parent
e592afb1
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
408 additions
and
18 deletions
+408
-18
DocsTable.purs
src/Gargantext/Components/DocsTable.purs
+1
-0
FacetsTable.purs
src/Gargantext/Components/FacetsTable.purs
+374
-0
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+5
-2
Config.purs
src/Gargantext/Config.purs
+14
-7
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+5
-1
Tabs.purs
src/Gargantext/Pages/Corpus/Graph/Tabs.purs
+9
-8
No files found.
src/Gargantext/Components/DocsTable.purs
View file @
34d8fef7
-- TODO: this module should be replaced by FacetsTable
module Gargantext.Components.DocsTable where
module Gargantext.Components.DocsTable where
import Affjax (defaultRequest, request)
import Affjax (defaultRequest, request)
...
...
src/Gargantext/Components/FacetsTable.purs
0 → 100644
View file @
34d8fef7
This diff is collapsed.
Click to expand it.
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
34d8fef7
...
@@ -51,8 +51,11 @@ instance decodeJsonGraphData :: DecodeJson GraphData where
...
@@ -51,8 +51,11 @@ instance decodeJsonGraphData :: DecodeJson GraphData where
nodes <- obj .? "nodes"
nodes <- obj .? "nodes"
edges <- obj .? "edges"
edges <- obj .? "edges"
-- TODO: sides
-- TODO: sides
-- sides <- obj .? "corpusId"
metadata <- obj .? "metadata"
pure $ GraphData { nodes, edges, sides: [GraphSideCorpus { corpusId: 1004223, corpusLabel: "Patents" }, GraphSideCorpus { corpusId: 998770, corpusLabel: "Books" }] }
corpusIds <- metadata .? "corpusId"
let side x = GraphSideCorpus { corpusId: x, corpusLabel: "Patents" }
let sides = side <$> corpusIds
pure $ GraphData { nodes, edges, sides }
instance decodeJsonNode :: DecodeJson Node where
instance decodeJsonNode :: DecodeJson Node where
decodeJson json = do
decodeJson json = do
...
...
src/Gargantext/Config.purs
View file @
34d8fef7
...
@@ -108,6 +108,9 @@ limitUrl l = "&limit=" <> show l
...
@@ -108,6 +108,9 @@ limitUrl l = "&limit=" <> show l
offsetUrl :: Offset -> UrlPath
offsetUrl :: Offset -> UrlPath
offsetUrl o = "&offset=" <> show o
offsetUrl o = "&offset=" <> show o
orderUrl :: forall a. Show a => Maybe a -> UrlPath
orderUrl = maybe "" (\x -> "&order=" <> show x)
tabTypeNgrams :: TabType -> UrlPath
tabTypeNgrams :: TabType -> UrlPath
tabTypeNgrams (TabCorpus t) = "listGet?ngramsType=" <> show t
tabTypeNgrams (TabCorpus t) = "listGet?ngramsType=" <> show t
tabTypeNgrams (TabPairing t) = "listGet?ngramsType=" <> show t -- TODO
tabTypeNgrams (TabPairing t) = "listGet?ngramsType=" <> show t -- TODO
...
@@ -115,14 +118,10 @@ tabTypeNgrams (TabPairing t) = "listGet?ngramsType=" <> show t -- TODO
...
@@ -115,14 +118,10 @@ tabTypeNgrams (TabPairing t) = "listGet?ngramsType=" <> show t -- TODO
pathUrl :: Config -> Path -> Maybe Id -> UrlPath
pathUrl :: Config -> Path -> Maybe Id -> UrlPath
pathUrl c (Tab t o l s) i =
pathUrl c (Tab t o l s) i =
pathUrl c (NodeAPI Node) i <>
pathUrl c (NodeAPI Node) i <>
"/" <> tabTypeDocs t <> offsetUrl o <> limitUrl l <> os
"/" <> tabTypeDocs t <> offsetUrl o <> limitUrl l <> orderUrl s
where
os = maybe "" (\x -> "&order=" <> show x) s
pathUrl c (Children n o l s) i =
pathUrl c (Children n o l s) i =
pathUrl c (NodeAPI Node) i <>
pathUrl c (NodeAPI Node) i <>
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> os
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
where
os = maybe "" (\x -> "&order=" <> show x) s
pathUrl c (Ngrams t o l listid) i =
pathUrl c (Ngrams t o l listid) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgrams t
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgrams t
<> offsetUrl o <> limitUrl l <> listid'
<> offsetUrl o <> limitUrl l <> listid'
...
@@ -131,7 +130,9 @@ pathUrl c (Ngrams t o l listid) i =
...
@@ -131,7 +130,9 @@ pathUrl c (Ngrams t o l listid) i =
pathUrl c Auth Nothing = c.prePath <> "auth"
pathUrl c Auth Nothing = c.prePath <> "auth"
pathUrl c Auth (Just _) = "impossible" -- TODO better types
pathUrl c Auth (Just _) = "impossible" -- TODO better types
pathUrl c (NodeAPI nt) i = c.prePath <> nodeTypeUrl nt <> (maybe "" (\i' -> "/" <> show i') i)
pathUrl c (NodeAPI nt) i = c.prePath <> nodeTypeUrl nt <> (maybe "" (\i' -> "/" <> show i') i)
pathUrl c (Search {limit,offset,orderBy}) _TODO =
c.prePath <> "search/?dummy=dummy"
<> offsetUrl offset <> limitUrl limit <> orderUrl orderBy
------------------------------------------------------------
------------------------------------------------------------
...
@@ -190,6 +191,12 @@ data Path
...
@@ -190,6 +191,12 @@ data Path
| Children NodeType Offset Limit (Maybe OrderBy)
| Children NodeType Offset Limit (Maybe OrderBy)
| Ngrams TabType Offset Limit (Maybe TermList)
| Ngrams TabType Offset Limit (Maybe TermList)
| NodeAPI NodeType
| NodeAPI NodeType
| Search { {-id :: Int
, query :: Array String
,-} limit :: Limit
, offset :: Offset
, orderBy :: Maybe OrderBy
}
data End = Back | Front
data End = Back | Front
type Id = Int
type Id = Int
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
34d8fef7
...
@@ -23,6 +23,7 @@ import Effect.Aff (Aff, attempt)
...
@@ -23,6 +23,7 @@ import Effect.Aff (Aff, attempt)
import Effect.Aff.Class (liftAff)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
import Effect.Class (liftEffect)
import Effect.Console (log)
import Effect.Console (log)
import Gargantext.Components.RandomText (words)
import Gargantext.Components.GraphExplorer.Sigmajs (Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings)
import Gargantext.Components.GraphExplorer.Sigmajs (Color(Color), SigmaEasing, SigmaGraphData(SigmaGraphData), SigmaNode, SigmaSettings, canvas, edgeShape, edgeShapes, forceAtlas2, sStyle, sigma, sigmaEasing, sigmaEdge, sigmaEnableWebGL, sigmaNode, sigmaSettings)
import Gargantext.Components.GraphExplorer.Types (Cluster(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.GraphExplorer.Types (Cluster(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
...
@@ -561,7 +562,10 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
...
@@ -561,7 +562,10 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
, div []
, div []
[ p [] []
[ p [] []
, div [className "col-md-12"]
, div [className "col-md-12"]
[ GT.tabsElt {sides}
[ case st.selectedNode of
Just (SelectedNode {label}) ->
GT.tabsElt {query: words label, sides}
Nothing -> p [] []
, p [] []
, p [] []
]
]
]
]
...
...
src/Gargantext/Pages/Corpus/Graph/Tabs.purs
View file @
34d8fef7
...
@@ -6,37 +6,38 @@ import Data.List (fromFoldable)
...
@@ -6,37 +6,38 @@ import Data.List (fromFoldable)
import Data.Tuple (Tuple(..))
import Data.Tuple (Tuple(..))
import Gargantext.Config (TabType(..), TabSubType(..))
import Gargantext.Config (TabType(..), TabSubType(..))
import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
import Gargantext.Components.GraphExplorer.Types (GraphSideCorpus(..))
import Gargantext.Components.
DocsTable as D
T
import Gargantext.Components.
FacetsTable as F
T
import Gargantext.Components.Tab as Tab
import Gargantext.Components.Tab as Tab
import React (ReactElement, ReactClass, Children, createElement)
import React (ReactElement, ReactClass, Children, createElement)
import Thermite ( Spec, PerformAction, Render, _performAction, _render
import Thermite ( Spec, PerformAction, Render, _performAction, _render
, hideState, noState, cmapProps, simpleSpec, createClass
, hideState, noState, cmapProps, simpleSpec, createClass
)
)
type Props = { sides :: Array GraphSideCorpus }
type Props = {
query :: Array String,
sides :: Array GraphSideCorpus }
tabsElt :: Props -> ReactElement
tabsElt :: Props -> ReactElement
tabsElt props = createElement tabsClass props []
tabsElt props = createElement tabsClass props []
-- TODO no need for Children here
-- TODO no need for Children here
tabsClass :: ReactClass { sides :: Array GraphSideCorpus, children :: Children }
tabsClass :: ReactClass {
query :: Array String,
sides :: Array GraphSideCorpus, children :: Children }
tabsClass = createClass "GraphTabs" pureTabs (const {})
tabsClass = createClass "GraphTabs" pureTabs (const {})
pureTabs :: Spec {} Props Void
pureTabs :: Spec {} Props Void
pureTabs = hideState (const {activeTab: 0}) statefulTabs
pureTabs = hideState (const {activeTab: 0}) statefulTabs
tab :: forall props state. GraphSideCorpus -> Tuple String (Spec state props Tab.Action)
tab :: forall props state.
Array String ->
GraphSideCorpus -> Tuple String (Spec state props Tab.Action)
tab (GraphSideCorpus {corpusId: nodeId, corpusLabel}) =
tab
query
(GraphSideCorpus {corpusId: nodeId, corpusLabel}) =
Tuple corpusLabel $
Tuple corpusLabel $
cmapProps (const {nodeId,
chart, tabType: TabCorpus TabDocs
, totalRecords: 4736}) $
cmapProps (const {nodeId,
query, chart
, totalRecords: 4736}) $
noState
D
T.docViewSpec
noState
F
T.docViewSpec
where
where
-- TODO totalRecords: probably need to insert a corpusLoader.
-- TODO totalRecords: probably need to insert a corpusLoader.
chart = mempty
chart = mempty
statefulTabs :: Spec Tab.State Props Tab.Action
statefulTabs :: Spec Tab.State Props Tab.Action
statefulTabs =
statefulTabs =
withProps (\{sides} -> Tab.tabs identity identity $ fromFoldable $ tab <$> sides)
withProps (\{query, sides} ->
Tab.tabs identity identity $ fromFoldable $ tab query <$> sides)
-- TODO move to Thermite
-- TODO move to Thermite
-- | This function captures the props of the `Spec` as a function argument.
-- | This function captures the props of the `Spec` as a function argument.
...
...
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