Commit 1403e8a0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[Type] NodePoly escaping from Corpus.

parent e68a4d62
...@@ -15,6 +15,7 @@ import Thermite ( Render, Spec, PerformAction, focus, hide ...@@ -15,6 +15,7 @@ import Thermite ( Render, Spec, PerformAction, focus, hide
, defaultPerformAction, simpleSpec, modifyState) , defaultPerformAction, simpleSpec, modifyState)
-------------------------------------------------------- --------------------------------------------------------
import Gargantext.Prelude import Gargantext.Prelude
import Gargantext.Components.Node (NodePoly(..))
import Gargantext.Config (toUrl, NodeType(..), End(..)) import Gargantext.Config (toUrl, NodeType(..), End(..))
import Gargantext.Config.REST (get) import Gargantext.Config.REST (get)
--------------------------------------------------------- ---------------------------------------------------------
...@@ -99,15 +100,6 @@ _tabAction = prism TabViewA \ action -> ...@@ -99,15 +100,6 @@ _tabAction = prism TabViewA \ action ->
_-> Left action _-> Left action
------------------------------------------------------------------------ ------------------------------------------------------------------------
newtype NodePoly a = NodePoly { id :: Int
, typename :: Int
, userId :: Int
, parentId :: Int
, name :: String
, date :: String
, hyperdata :: a
}
newtype CorpusInfo = CorpusInfo { title :: String newtype CorpusInfo = CorpusInfo { title :: String
, desc :: String , desc :: String
, query :: String , query :: String
...@@ -141,30 +133,6 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where ...@@ -141,30 +133,6 @@ instance decodeCorpusInfo :: DecodeJson CorpusInfo where
chart <- obj .? "chart" chart <- obj .? "chart"
pure $ CorpusInfo {title, desc, query, authors, chart} pure $ CorpusInfo {title, desc, query, authors, chart}
instance decodeNode :: (DecodeJson a) => DecodeJson (NodePoly a) where
decodeJson json = do
obj <- decodeJson json
id <- obj .? "id"
typename <- obj .? "typename"
userId <- obj .? "userId"
parentId <- obj .? "parentId"
name <- obj .? "name"
date <- obj .? "date"
hyperdata <- obj .? "hyperdata"
hyperdata' <- decodeJson hyperdata
pure $ NodePoly { id : id
, typename : typename
, userId : userId
, parentId : parentId
, name : name
, date : date
, hyperdata: hyperdata'
}
------------------------------------------------------------------------ ------------------------------------------------------------------------
layout :: Spec State {} Action layout :: Spec State {} Action
layout = corpusSpec <> facets layout = corpusSpec <> facets
......
...@@ -19,21 +19,16 @@ initialState = ...@@ -19,21 +19,16 @@ initialState =
inputValue : "" inputValue : ""
} }
data Action data Action
= ChangeString String = Load Int
| ChangeAnotherString String | ChangeString String
| SetInput String | SetInput String
performAction :: PerformAction State {} Action performAction :: PerformAction State {} Action
performAction (ChangeString ps) _ _ = pure unit performAction (ChangeString ps) _ _ = pure unit
performAction (Load n) _ _ = pure unit
performAction (ChangeAnotherString ps) _ _ = pure unit performAction (SetInput ps) _ _ = void <$> modifyState $ _ { inputValue = ps }
performAction (SetInput ps) _ _ = void do
modifyState $ _ { inputValue = ps }
docview :: Spec State {} Action docview :: Spec State {} Action
...@@ -55,11 +50,6 @@ docview = simpleSpec performAction render ...@@ -55,11 +50,6 @@ docview = simpleSpec performAction render
, onChange (\e -> dispatch (ChangeString $ (unsafeCoerce e).target.value)) , onChange (\e -> dispatch (ChangeString $ (unsafeCoerce e).target.value))
] $ map optps aryPS ] $ map optps aryPS
] ]
, div [ className "col-md-12 form-control input-group mb-3"]
[ select [ className "form-control custom-select"
, onChange (\e -> dispatch (ChangeAnotherString $ (unsafeCoerce e).target.value)) ]
$ map optps aryPS1
]
] ]
, div [className "row", style { marginTop : "35px"}] , div [className "row", style { marginTop : "35px"}]
[ [
...@@ -158,7 +148,7 @@ docview = simpleSpec performAction render ...@@ -158,7 +148,7 @@ docview = simpleSpec performAction render
] ]
aryPS :: Array String aryPS :: Array String
aryPS = ["STOPLIST", "MAINLIST", "MAPLIST"] aryPS = ["Map", "Main", "Stop"]
aryPS1 :: Array String aryPS1 :: Array String
aryPS1 = ["Nothing Selected","STOPLIST", "MAINLIST", "MAPLIST"] aryPS1 = ["Nothing Selected","STOPLIST", "MAINLIST", "MAPLIST"]
......
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