Commit d1e913f4 authored by Sudhir Kumar's avatar Sudhir Kumar

Graph frontend Integration is done

parent 942d054b
...@@ -39,18 +39,18 @@ derive instance newtypeGraphData :: Newtype GraphData _ ...@@ -39,18 +39,18 @@ derive instance newtypeGraphData :: Newtype GraphData _
instance decodeJsonGraphData :: DecodeJson GraphData where instance decodeJsonGraphData :: DecodeJson GraphData where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
nodes <- obj .? "graph_nodes" nodes <- obj .? "nodes"
edges <- obj .? "graph_edges" edges <- obj .? "edges"
pure $ GraphData { nodes, edges } pure $ GraphData { nodes, edges }
instance decodeJsonNode :: DecodeJson Node where instance decodeJsonNode :: DecodeJson Node where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
id_ <- obj .? "node_id" id_ <- obj .? "id"
type_ <- obj .? "node_type" type_ <- obj .? "type"
label <- obj .? "node_label" label <- obj .? "label"
size <- obj .? "node_size" size <- obj .? "size"
attributes <- obj .? "node_attributes" attributes <- obj .? "attributes"
pure $ Node { id_, type_, size, label, attributes } pure $ Node { id_, type_, size, label, attributes }
instance decodeJsonCluster :: DecodeJson Cluster where instance decodeJsonCluster :: DecodeJson Cluster where
...@@ -62,10 +62,10 @@ instance decodeJsonCluster :: DecodeJson Cluster where ...@@ -62,10 +62,10 @@ instance decodeJsonCluster :: DecodeJson Cluster where
instance decodeJsonEdge :: DecodeJson Edge where instance decodeJsonEdge :: DecodeJson Edge where
decodeJson json = do decodeJson json = do
obj <- decodeJson json obj <- decodeJson json
id_ <- obj .? "edge_id" id_ <- obj .? "id"
source <- obj .? "edge_source" source <- obj .? "source"
target <- obj .? "edge_target" target <- obj .? "target"
weight <- obj .? "edge_weight" weight <- obj .? "weight"
pure $ Edge { id_, source, target, weight } pure $ Edge { id_, source, target, weight }
newtype Legend = Legend {id_ ::Int , label :: String} newtype Legend = Legend {id_ ::Int , label :: String}
......
...@@ -95,18 +95,7 @@ convert (GraphData r) = SigmaGraphData { nodes, edges} ...@@ -95,18 +95,7 @@ convert (GraphData r) = SigmaGraphData { nodes, edges}
render :: Render State {} Action render :: Render State {} Action
render d p (State s) c = render d p (State s) c =
[ select [ onChange $ \e -> d $ LoadGraph (unsafeCoerce e).target.value, value s.filePath] [
[ option [value ""] [text ""]
, option [value "example_01_clean.json"] [text "example_01_clean.json"]
, option [value "example_01_conditional.json"] [text "example_01_conditional.json"]
, option [value "example_01_distributional.json"] [text "example_01_distributional.json"]
, option [value "example_02.json"] [text "example_02.json"]
, option [value "example_02_clean.json"] [text "example_02_clean.json"]
, option [value "example_03.json"] [text "example_03.json"]
, option [value "example_03_clean.json"] [text "example_03_clean.json"]
, option [value "imtNew.json"] [text "imtNew.json"]
-- , option [value "exemplePhyloBipartite.gexf"] [text "exemplePhyloBipartite.gexf"]
]
] ]
<> <>
case s.sigmaGraphData of case s.sigmaGraphData of
...@@ -279,7 +268,7 @@ specOld = simpleSpec performAction render' ...@@ -279,7 +268,7 @@ specOld = simpleSpec performAction render'
render' :: Render State {} Action render' :: Render State {} Action
render' d _ (State st) _ = render' d _ (State st) _ =
[ div [className "row"] [ [ div [className "row"] [
div [className "col-md-12", style {marginTop : "21px", marginBottom : "21px"}] div [className "col-md-12", style {marginTop : "34px", marginBottom : "21px"}]
[ menu [_id "toolbar"] [ menu [_id "toolbar"]
[ ul' [ ul'
[ [
...@@ -349,20 +338,7 @@ specOld = simpleSpec performAction render' ...@@ -349,20 +338,7 @@ specOld = simpleSpec performAction render'
, div [className "row"] , div [className "row"]
[ div [className "col-md-9"] [ div [className "col-md-9"]
[ div [style {border : "1px black solid", height: "90%"}] $ [ div [style {border : "1px black solid", height: "90%"}] $
[ select [ onChange $ \e -> d $ LoadGraph (unsafeCoerce e).target.value [
, value st.filePath
]
[ option [value ""] [text ""]
, option [value "example_01_clean.json"] [text "example_01_clean.json"]
, option [value "example_01_conditional.json"] [text "example_01_conditional.json"]
, option [value "example_01_distributional.json"] [text "example_01_distributional.json"]
, option [value "example_02.json"] [text "example_02.json"]
, option [value "example_02_clean.json"] [text "example_02_clean.json"]
, option [value "example_03.json"] [text "example_03.json"]
, option [value "example_03_clean.json"] [text "example_03_clean.json"]
, option [value "imtNew.json"] [text "imtNew.json"]
-- , option [value "exemplePhyloBipartite.gexf"] [text "exemplePhyloBipartite.gexf"]
]
] ]
<> <>
case st.sigmaGraphData of case st.sigmaGraphData of
......
...@@ -55,9 +55,9 @@ dispatchAction dispatcher _ (Document n) = do ...@@ -55,9 +55,9 @@ dispatchAction dispatcher _ (Document n) = do
dispatcher $ SetRoute $ Document n dispatcher $ SetRoute $ Document n
dispatcher $ DocumentViewA $ Document.Load n dispatcher $ DocumentViewA $ Document.Load n
dispatchAction dispatcher _ PGraphExplorer = do dispatchAction dispatcher _ (PGraphExplorer nid) = do
dispatcher $ SetRoute PGraphExplorer dispatcher $ SetRoute $ PGraphExplorer nid
dispatcher $ GraphExplorerA $ GE.LoadGraph 2 dispatcher $ GraphExplorerA $ GE.LoadGraph nid
--dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json" --dispatcher $ GraphExplorerA $ GE.LoadGraph "imtNew.json"
dispatchAction dispatcher _ NGramsTable = do dispatchAction dispatcher _ NGramsTable = do
......
...@@ -59,7 +59,7 @@ pagesComponent s = case s.currentRoute of ...@@ -59,7 +59,7 @@ pagesComponent s = case s.currentRoute of
selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus selectSpec AddCorpus = layout0 $ focus _addCorpusState _addCorpusAction AC.layoutAddcorpus
selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec selectSpec SearchView = layout0 $ focus _searchState _searchAction S.searchSpec
selectSpec (Document i) = layout0 $ focus _documentViewState _documentViewAction Annotation.docview selectSpec (Document i) = layout0 $ focus _documentViewState _documentViewAction Annotation.docview
selectSpec PGraphExplorer = focus _graphExplorerState _graphExplorerAction GE.specOld selectSpec (PGraphExplorer i) = focus _graphExplorerState _graphExplorerAction GE.specOld
selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard selectSpec Dashboard = layout0 $ noState Dsh.layoutDashboard
selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout selectSpec (Annuaire i) = layout0 $ cmapProps (const {annuaireId: i}) $ noState A.layout
......
...@@ -20,7 +20,7 @@ data Routes ...@@ -20,7 +20,7 @@ data Routes
| Corpus Int | Corpus Int
| AddCorpus | AddCorpus
| Document Int | Document Int
| PGraphExplorer | PGraphExplorer Int
| NGramsTable | NGramsTable
| Dashboard | Dashboard
| Annuaire Int | Annuaire Int
...@@ -36,7 +36,7 @@ routing = ...@@ -36,7 +36,7 @@ routing =
<|> NGramsTable <$ route "ngrams" <|> NGramsTable <$ route "ngrams"
<|> Document <$> (route "document" *> int) <|> Document <$> (route "document" *> int)
<|> Dashboard <$ route "dashboard" <|> Dashboard <$ route "dashboard"
<|> PGraphExplorer <$ route "graph" <|> PGraphExplorer <$> (route "graph" *> int )
<|> Annuaire <$> (route "annuaire" *> int) <|> Annuaire <$> (route "annuaire" *> int)
<|> UserPage <$> (route "user" *> int) <|> UserPage <$> (route "user" *> int)
<|> Home <$ lit "" <|> Home <$ lit ""
...@@ -58,7 +58,7 @@ instance showRoutes :: Show Routes where ...@@ -58,7 +58,7 @@ instance showRoutes :: Show Routes where
show (Annuaire i) = "Annuaire" <> show i show (Annuaire i) = "Annuaire" <> show i
show (Folder i) = "Folder" <> show i show (Folder i) = "Folder" <> show i
show Dashboard = "Dashboard" show Dashboard = "Dashboard"
show PGraphExplorer = "graphExplorer" show (PGraphExplorer i) = "graphExplorer" <> show i
show Home = "Home" show Home = "Home"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment