Commit 771e7ec0 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FEAT] Connecting Phylo 1 click with Frontend

parent 0afcba5e
...@@ -13,7 +13,7 @@ import Gargantext.Components.Bootstrap.Types (ComponentStatus(..)) ...@@ -13,7 +13,7 @@ import Gargantext.Components.Bootstrap.Types (ComponentStatus(..))
import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..)) import Gargantext.Components.Forest.Tree.Node.Action.Types (Action(..))
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, submitButton, panel) import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, submitButton, panel)
import Gargantext.Components.PhyloExplorer.API as Phylo import Gargantext.Components.PhyloExplorer.API as Phylo
import Gargantext.Components.PhyloExplorer.ConfigForm as PhyloForm import Gargantext.Components.PhyloExplorer.Config.ConfigForm as PhyloForm
import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook
import Gargantext.Config.REST (RESTError, AffRESTError) import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Routes as GR import Gargantext.Routes as GR
...@@ -119,12 +119,12 @@ updateGraphCpt = here.component "updateGraph" cpt where ...@@ -119,12 +119,12 @@ updateGraphCpt = here.component "updateGraph" cpt where
, callback: \val -> T.write_ val methodGraphNodeType1 , callback: \val -> T.write_ val methodGraphNodeType1
, print: show } [] , print: show } []
--}
, H.text "Ngrams ?" , H.text "Ngrams ?"
, formChoiceSafe { items: [GT.CTabTerms, GT.CTabSources, GT.CTabAuthors, GT.CTabInstitutes] , formChoiceSafe { items: [GT.CTabTerms, GT.CTabSources, GT.CTabAuthors, GT.CTabInstitutes]
, default: methodGraphNodeType2' , default: methodGraphNodeType2'
, callback: \val -> T.write_ val methodGraphNodeType2 , callback: \val -> T.write_ val methodGraphNodeType2
, print: show } [] , print: show } []
--}
{- {-
, H.text "Show Strong (expected) links or weak (maybe unexpected) links?" , H.text "Show Strong (expected) links or weak (maybe unexpected) links?"
...@@ -164,7 +164,8 @@ updatePhyloCpt = here.component "updatePhylo" cpt where ...@@ -164,7 +164,8 @@ updatePhyloCpt = here.component "updatePhylo" cpt where
-- @NOTE #219: use a config property returned by GET phylo route -- @NOTE #219: use a config property returned by GET phylo route
defaultData :: Phylo.UpdateData defaultData :: Phylo.UpdateData
defaultData = Phylo.UpdateData defaultData = Phylo.UpdateData
{ proximity: 0.5 { defaultMode: true
, proximity: 0.5
, synchrony: 0.5 , synchrony: 0.5
, quality: 0.8 , quality: 0.8
, exportFilter: 3.0 , exportFilter: 3.0
......
...@@ -116,7 +116,7 @@ settingsBox FolderPrivate = ...@@ -116,7 +116,7 @@ settingsBox FolderPrivate =
, Annuaire , Annuaire
, NodeFrameWrite , NodeFrameWrite
, NodeFrameCalc , NodeFrameCalc
, NodeFrameNotebook -- , NodeFrameNotebook
] ]
] ]
} }
...@@ -130,7 +130,7 @@ settingsBox Team = ...@@ -130,7 +130,7 @@ settingsBox Team =
, Annuaire , Annuaire
, NodeFrameWrite , NodeFrameWrite
, NodeFrameCalc , NodeFrameCalc
, NodeFrameNotebook -- , NodeFrameNotebook
, Team , Team
, FolderShared , FolderShared
, NodeFrameVisio , NodeFrameVisio
...@@ -166,7 +166,7 @@ settingsBox Folder = ...@@ -166,7 +166,7 @@ settingsBox Folder =
, Annuaire , Annuaire
, NodeFrameWrite , NodeFrameWrite
, NodeFrameCalc , NodeFrameCalc
, NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Move moveParameters , Move moveParameters
, Delete , Delete
...@@ -188,7 +188,7 @@ settingsBox Corpus = ...@@ -188,7 +188,7 @@ settingsBox Corpus =
, NodeFrameWrite , NodeFrameWrite
, NodeFrameCalc , NodeFrameCalc
, Phylo , Phylo
, NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Link (linkParams Annuaire) , Link (linkParams Annuaire)
, Move moveParameters , Move moveParameters
...@@ -348,7 +348,7 @@ settingsBox NodeFrameNotebook = ...@@ -348,7 +348,7 @@ settingsBox NodeFrameNotebook =
, doc : Documentation NodeFrameNotebook , doc : Documentation NodeFrameNotebook
, buttons : [ Add [ NodeFrameCalc , buttons : [ Add [ NodeFrameCalc
, NodeFrameWrite , NodeFrameWrite
, NodeFrameNotebook -- , NodeFrameNotebook
] ]
, Move moveFrameParameters , Move moveFrameParameters
, Delete , Delete
......
...@@ -39,7 +39,8 @@ get session nodeId = request >>= (_ <#> parseToPhyloSet) >>> pure ...@@ -39,7 +39,8 @@ get session nodeId = request >>= (_ <#> parseToPhyloSet) >>> pure
---------------------------------------------------------- ----------------------------------------------------------
newtype UpdateData = UpdateData newtype UpdateData = UpdateData
{ proximity :: Number { defaultMode :: Boolean
, proximity :: Number
, synchrony :: Number , synchrony :: Number
, quality :: Number , quality :: Number
, timeUnit :: TimeUnit , timeUnit :: TimeUnit
...@@ -57,6 +58,9 @@ instance JSON.WriteForeign UpdateData where ...@@ -57,6 +58,9 @@ instance JSON.WriteForeign UpdateData where
where where
rename rename
= Record.rename = Record.rename
(Proxy :: Proxy "defaultMode")
(Proxy :: Proxy "_sc_defaultMode")
>>> Record.rename
(Proxy :: Proxy "proximity") (Proxy :: Proxy "proximity")
(Proxy :: Proxy "_sc_phyloProximity") (Proxy :: Proxy "_sc_phyloProximity")
>>> Record.rename >>> Record.rename
......
...@@ -10,7 +10,7 @@ import Data.Maybe (Maybe(..)) ...@@ -10,7 +10,7 @@ import Data.Maybe (Maybe(..))
import Data.Newtype (unwrap) import Data.Newtype (unwrap)
import Data.Number as Number import Data.Number as Number
import Gargantext.Components.PhyloExplorer.API (Clique(..), CliqueFilter, ReflexiveClique(..), ReflexiveTimeUnit, TimeUnitCriteria(..), UpdateData(..), extractCriteria, fromReflexiveTimeUnit, toReflexiveTimeUnit) import Gargantext.Components.PhyloExplorer.API (Clique(..), CliqueFilter, ReflexiveClique(..), ReflexiveTimeUnit, TimeUnitCriteria(..), UpdateData(..), extractCriteria, fromReflexiveTimeUnit, toReflexiveTimeUnit)
import Gargantext.Components.PhyloExplorer.ConfigForm (FormData) import Gargantext.Components.PhyloExplorer.Config.ConfigForm (FormData)
import Gargantext.Types (FrontendError(..)) import Gargantext.Types (FrontendError(..))
import Gargantext.Utils (getter) import Gargantext.Utils (getter)
import Reactix as R import Reactix as R
...@@ -49,7 +49,8 @@ toFormData :: UpdateData -> Record () ...@@ -49,7 +49,8 @@ toFormData :: UpdateData -> Record ()
toFormData nt = toFormData nt =
let r = unwrap nt let r = unwrap nt
in unsafeCoerce $ in unsafeCoerce $
{ proximity: { defaultMode : show r.defaultMode
, proximity:
show r.proximity show r.proximity
, synchrony: , synchrony:
show r.synchrony show r.synchrony
...@@ -85,6 +86,9 @@ toFormData nt = ...@@ -85,6 +86,9 @@ toFormData nt =
fromFormData :: Record FormData -> Either String UpdateData fromFormData :: Record FormData -> Either String UpdateData
fromFormData r = do fromFormData r = do
-- Common params -- Common params
defaultMode <-
read r.defaultMode `orDie` "Invalid defaultMode"
proximity <- proximity <-
Number.fromString r.proximity `orDie` "Invalid proximity" Number.fromString r.proximity `orDie` "Invalid proximity"
synchrony <- synchrony <-
...@@ -118,7 +122,8 @@ fromFormData r = do ...@@ -118,7 +122,8 @@ fromFormData r = do
-- Constructor -- Constructor
pure $ UpdateData pure $ UpdateData
{ proximity { defaultMode
, proximity
, synchrony , synchrony
, quality , quality
, exportFilter , exportFilter
......
...@@ -7,6 +7,7 @@ import Effect.Console (log) ...@@ -7,6 +7,7 @@ import Effect.Console (log)
import Effect.Class (class MonadEffect, liftEffect) import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (catchException, throwException) import Effect.Exception (catchException, throwException)
import Effect.Unsafe (unsafePerformEffect) import Effect.Unsafe (unsafePerformEffect)
import Data.Maybe (Maybe(..))
-- | JL: Astonishingly, not in the prelude -- | JL: Astonishingly, not in the prelude
-- AD: recent Preludes in Haskell much prefer identity -- AD: recent Preludes in Haskell much prefer identity
...@@ -19,6 +20,12 @@ id a = a ...@@ -19,6 +20,12 @@ id a = a
class Read a where class Read a where
read :: String -> Maybe a read :: String -> Maybe a
instance Read Boolean where
read :: String -> Maybe Boolean
read "true" = Just true
read "false" = Just false
read _ = Nothing
logs:: forall message effect. logs:: forall message effect.
(MonadEffect effect) (MonadEffect effect)
=> Show message => Show message
......
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