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
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
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
nodes <- obj .? "nodes"
edges <- obj .? "edges"
-- TODO: sides
-- sides <- obj .? "corpusId"
pure $ GraphData { nodes, edges, sides: [GraphSideCorpus { corpusId: 1004223, corpusLabel: "Patents" }, GraphSideCorpus { corpusId: 998770, corpusLabel: "Books" }] }
metadata <- obj .? "metadata"
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
decodeJson json = do
...
...
src/Gargantext/Config.purs
View file @
34d8fef7
...
...
@@ -108,6 +108,9 @@ limitUrl l = "&limit=" <> show l
offsetUrl :: Offset -> UrlPath
offsetUrl o = "&offset=" <> show o
orderUrl :: forall a. Show a => Maybe a -> UrlPath
orderUrl = maybe "" (\x -> "&order=" <> show x)
tabTypeNgrams :: TabType -> UrlPath
tabTypeNgrams (TabCorpus t) = "listGet?ngramsType=" <> show t
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 c (Tab t o l s) i =
pathUrl c (NodeAPI Node) i <>
"/" <> tabTypeDocs t <> offsetUrl o <> limitUrl l <> os
where
os = maybe "" (\x -> "&order=" <> show x) s
"/" <> tabTypeDocs t <> offsetUrl o <> limitUrl l <> orderUrl s
pathUrl c (Children n o l s) i =
pathUrl c (NodeAPI Node) i <>
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> os
where
os = maybe "" (\x -> "&order=" <> show x) s
"/" <> "children?type=" <> show n <> offsetUrl o <> limitUrl l <> orderUrl s
pathUrl c (Ngrams t o l listid) i =
pathUrl c (NodeAPI Node) i <> "/" <> tabTypeNgrams t
<> offsetUrl o <> limitUrl l <> listid'
...
...
@@ -131,7 +130,9 @@ pathUrl c (Ngrams t o l listid) i =
pathUrl c Auth Nothing = c.prePath <> "auth"
pathUrl c Auth (Just _) = "impossible" -- TODO better types
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
| Children NodeType Offset Limit (Maybe OrderBy)
| Ngrams TabType Offset Limit (Maybe TermList)
| NodeAPI NodeType
| Search { {-id :: Int
, query :: Array String
,-} limit :: Limit
, offset :: Offset
, orderBy :: Maybe OrderBy
}
data End = Back | Front
type Id = Int
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
34d8fef7
...
...
@@ -23,6 +23,7 @@ import Effect.Aff (Aff, attempt)
import Effect.Aff.Class (liftAff)
import Effect.Class (liftEffect)
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.Types (Cluster(..), Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
...
...
@@ -561,7 +562,10 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
, div []
[ p [] []
, div [className "col-md-12"]
[ GT.tabsElt {sides}
[ case st.selectedNode of
Just (SelectedNode {label}) ->
GT.tabsElt {query: words label, sides}
Nothing -> p [] []
, p [] []
]
]
...
...
src/Gargantext/Pages/Corpus/Graph/Tabs.purs
View file @
34d8fef7
...
...
@@ -6,37 +6,38 @@ import Data.List (fromFoldable)
import Data.Tuple (Tuple(..))
import Gargantext.Config (TabType(..), TabSubType(..))
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 React (ReactElement, ReactClass, Children, createElement)
import Thermite ( Spec, PerformAction, Render, _performAction, _render
, hideState, noState, cmapProps, simpleSpec, createClass
)
type Props = { sides :: Array GraphSideCorpus }
type Props = {
query :: Array String,
sides :: Array GraphSideCorpus }
tabsElt :: Props -> ReactElement
tabsElt props = createElement tabsClass props []
-- 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 {})
pureTabs :: Spec {} Props Void
pureTabs = hideState (const {activeTab: 0}) statefulTabs
tab :: forall props state. GraphSideCorpus -> Tuple String (Spec state props Tab.Action)
tab (GraphSideCorpus {corpusId: nodeId, corpusLabel}) =
tab :: forall props state.
Array String ->
GraphSideCorpus -> Tuple String (Spec state props Tab.Action)
tab
query
(GraphSideCorpus {corpusId: nodeId, corpusLabel}) =
Tuple corpusLabel $
cmapProps (const {nodeId,
chart, tabType: TabCorpus TabDocs
, totalRecords: 4736}) $
noState
D
T.docViewSpec
cmapProps (const {nodeId,
query, chart
, totalRecords: 4736}) $
noState
F
T.docViewSpec
where
-- TODO totalRecords: probably need to insert a corpusLoader.
chart = mempty
statefulTabs :: Spec Tab.State Props Tab.Action
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
-- | 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