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
8f8915c3
Commit
8f8915c3
authored
Dec 19, 2018
by
Sudhir Kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph Title and Footer is fixed
parent
d1e88966
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
9 deletions
+47
-9
Types.purs
src/Gargantext/Components/GraphExplorer/Types.purs
+30
-2
Graph.purs
src/Gargantext/Pages/Corpus/Graph.purs
+16
-6
Specs.purs
src/Gargantext/Pages/Layout/Specs.purs
+1
-1
No files found.
src/Gargantext/Components/GraphExplorer/Types.purs
View file @
8f8915c3
...
...
@@ -5,7 +5,7 @@ import Prelude
import Data.Argonaut (class DecodeJson, decodeJson, (.?))
import Data.Array (concat, fromFoldable, group, sort, take)
import Data.Newtype (class Newtype)
import Data.Maybe (Maybe(..), maybe)
newtype Node = Node
{ id_ :: String
, size :: Int
...
...
@@ -41,10 +41,19 @@ newtype GraphData = GraphData
{ nodes :: Array Node
, edges :: Array Edge
, sides :: Array GraphSideCorpus
, metaData :: Maybe MetaData
}
derive instance newtypeGraphData :: Newtype GraphData _
newtype MetaData = MetaData
{
title :: String
, legend :: Array Legend
, corpusId :: Array Int
}
instance decodeJsonGraphData :: DecodeJson GraphData where
decodeJson json = do
obj <- decodeJson json
...
...
@@ -53,9 +62,10 @@ instance decodeJsonGraphData :: DecodeJson GraphData where
-- TODO: sides
metadata <- obj .? "metadata"
corpusIds <- metadata .? "corpusId"
metaData <- obj .? "metadata"
let side x = GraphSideCorpus { corpusId: x, corpusLabel: "Pubs / Patents" }
let sides = side <$> corpusIds
pure $ GraphData { nodes, edges, sides }
pure $ GraphData { nodes, edges, sides
, metaData
}
instance decodeJsonNode :: DecodeJson Node where
decodeJson json = do
...
...
@@ -67,6 +77,24 @@ instance decodeJsonNode :: DecodeJson Node where
attributes <- obj .? "attributes"
pure $ Node { id_, type_, size, label, attributes }
instance decodeJsonMetaData :: DecodeJson MetaData where
decodeJson json = do
obj <- decodeJson json
title <- obj .? "title"
legend <- obj .? "legend"
corpusId <- obj .? "corpusId"
pure $ MetaData { title, legend, corpusId }
instance decodeJsonLegend :: DecodeJson Legend where
decodeJson json = do
obj <- decodeJson json
id_ <- obj .? "id"
label <- obj .? "label"
pure $ Legend { id_, label }
instance decodeJsonCluster :: DecodeJson Cluster where
decodeJson json = do
obj <- decodeJson json
...
...
src/Gargantext/Pages/Corpus/Graph.purs
View file @
8f8915c3
...
...
@@ -25,7 +25,7 @@ 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.GraphExplorer.Types (Cluster(..),
MetaData(..),
Edge(..), GraphData(..), Legend(..), Node(..), getLegendData)
import Gargantext.Components.Login.Types (AuthData(..), TreeId)
import Gargantext.Components.Tree as Tree
import Gargantext.Config as Config
...
...
@@ -35,7 +35,7 @@ import Gargantext.Utils (getter)
import Math (cos, sin)
import Partial.Unsafe (unsafePartial)
import React (ReactElement)
import React.DOM (a, br', button, div, form', input, li, li', menu, option, p, select, span, text, ul, ul')
import React.DOM (a, br',
h2,
button, div, form', input, li, li', menu, option, p, select, span, text, ul, ul')
import React.DOM.Props (_id, _type, checked, className, href, name, onChange, onClick, placeholder, style, title, value)
import Thermite (PerformAction, Render, Spec, _render,cmapProps, createClass, defaultPerformAction, defaultRender, modifyState, noState, simpleSpec, withState)
import Unsafe.Coerce (unsafeCoerce)
...
...
@@ -84,7 +84,7 @@ newtype NodeResults = NodeResults
initialState :: State
initialState = State
{ graphData : GraphData {nodes: [], edges: [], sides: []}
{ graphData : GraphData {nodes: [], edges: [], sides: []
, metaData : Just $ MetaData{title : "", legend : [], corpusId : []}
}
, filePath : ""
, sigmaGraphData : Nothing
, legendData : []
...
...
@@ -323,7 +323,7 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
where
treespec = over _render \frender d p (State s) c ->
[ div [ className "col-md-1", _id "graph-tree", style {marginTop:"1
04
px"}] $
[ div [ className "col-md-1", _id "graph-tree", style {marginTop:"1
51
px"}] $
[
button [className "btn btn-primary" , onClick \_ -> d ToggleTree]
[text $ if s.showTree then "Hide Tree" else "Show Tree"]
...
...
@@ -345,9 +345,19 @@ specOld = fold [treespec treeSpec, graphspec $ simpleSpec performAction render']
Just treeId ->
(cmapProps (const {root: treeId}) (noState Tree.treeview))
render' :: Render State {} Action
render' d _ (State st@{graphData: GraphData {sides}}) _ =
render' d _ (State st@{graphData: GraphData {sides
,metaData
}}) _ =
[ div [className "container-fluid", style {"padding-top" : "100px"}]
[ div [className "row", style {"padding-bottom" : "10px"}]
[ div [ className "row"]
[ h2 [ style {textAlign : "center", position : "relative", top: "-38px"}]
[-- : MetaData {title}
case metaData of
Just( MetaData {title }) ->
text $ "Graph " <> title
Nothing ->
text "Title"
]
]
, div [className "row", style {"padding-bottom" : "10px", marginTop : "-24px"}]
[
div [className "col-md-4"]
[
...
...
src/Gargantext/Pages/Layout/Specs.purs
View file @
8f8915c3
...
...
@@ -356,7 +356,7 @@ layoutFooter :: Spec AppState {} Action
layoutFooter = simpleSpec performAction render
where
render :: Render AppState {} Action
render dispatch _ state _ = [div [ className "container
1
" ] [ hr', footerLegalInfo']]
render dispatch _ state _ = [div [ className "container" ] [ hr', footerLegalInfo']]
where
footerLegalInfo' = footer [] [ p [] [ text "Gargantext "
, span [className "glyphicon glyphicon-registration-mark" ] []
...
...
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