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
142
Issues
142
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
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
gargantext
purescript-gargantext
Commits
771e7ec0
Commit
771e7ec0
authored
Mar 22, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] Connecting Phylo 1 click with Frontend
parent
0afcba5e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
482 additions
and
395 deletions
+482
-395
Update.purs
...Gargantext/Components/Forest/Tree/Node/Action/Update.purs
+4
-3
Settings.purs
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
+5
-5
API.purs
src/Gargantext/Components/PhyloExplorer/API.purs
+5
-1
ConfigForm.purs
...argantext/Components/PhyloExplorer/Config/ConfigForm.purs
+453
-383
ConfigFormContainer.purs
.../Components/PhyloExplorer/Config/ConfigFormContainer.purs
+8
-3
Prelude.purs
src/Gargantext/Prelude.purs
+7
-0
No files found.
src/Gargantext/Components/Forest/Tree/Node/Action/Update.purs
View file @
771e7ec0
...
...
@@ -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.Tools (formChoiceSafe, submitButton, panel)
import Gargantext.Components.PhyloExplorer.API as Phylo
import Gargantext.Components.PhyloExplorer.ConfigForm as PhyloForm
import Gargantext.Components.PhyloExplorer.Config
.Config
Form as PhyloForm
import Gargantext.Components.PhyloExplorer.ConfigFormParser as PhyloHook
import Gargantext.Config.REST (RESTError, AffRESTError)
import Gargantext.Routes as GR
...
...
@@ -119,12 +119,12 @@ updateGraphCpt = here.component "updateGraph" cpt where
, callback: \val -> T.write_ val methodGraphNodeType1
, print: show } []
--}
, H.text "Ngrams ?"
, formChoiceSafe { items: [GT.CTabTerms, GT.CTabSources, GT.CTabAuthors, GT.CTabInstitutes]
, default: methodGraphNodeType2'
, callback: \val -> T.write_ val methodGraphNodeType2
, print: show } []
--}
{-
, H.text "Show Strong (expected) links or weak (maybe unexpected) links?"
...
...
@@ -164,7 +164,8 @@ updatePhyloCpt = here.component "updatePhylo" cpt where
-- @NOTE #219: use a config property returned by GET phylo route
defaultData :: Phylo.UpdateData
defaultData = Phylo.UpdateData
{ proximity: 0.5
{ defaultMode: true
, proximity: 0.5
, synchrony: 0.5
, quality: 0.8
, exportFilter: 3.0
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
771e7ec0
...
...
@@ -116,7 +116,7 @@ settingsBox FolderPrivate =
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
, NodeFrameNotebook
--
, NodeFrameNotebook
]
]
}
...
...
@@ -130,7 +130,7 @@ settingsBox Team =
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
, NodeFrameNotebook
--
, NodeFrameNotebook
, Team
, FolderShared
, NodeFrameVisio
...
...
@@ -166,7 +166,7 @@ settingsBox Folder =
, Annuaire
, NodeFrameWrite
, NodeFrameCalc
, NodeFrameNotebook
--
, NodeFrameNotebook
]
, Move moveParameters
, Delete
...
...
@@ -188,7 +188,7 @@ settingsBox Corpus =
, NodeFrameWrite
, NodeFrameCalc
, Phylo
, NodeFrameNotebook
--
, NodeFrameNotebook
]
, Link (linkParams Annuaire)
, Move moveParameters
...
...
@@ -348,7 +348,7 @@ settingsBox NodeFrameNotebook =
, doc : Documentation NodeFrameNotebook
, buttons : [ Add [ NodeFrameCalc
, NodeFrameWrite
, NodeFrameNotebook
--
, NodeFrameNotebook
]
, Move moveFrameParameters
, Delete
...
...
src/Gargantext/Components/PhyloExplorer/API.purs
View file @
771e7ec0
...
...
@@ -39,7 +39,8 @@ get session nodeId = request >>= (_ <#> parseToPhyloSet) >>> pure
----------------------------------------------------------
newtype UpdateData = UpdateData
{ proximity :: Number
{ defaultMode :: Boolean
, proximity :: Number
, synchrony :: Number
, quality :: Number
, timeUnit :: TimeUnit
...
...
@@ -57,6 +58,9 @@ instance JSON.WriteForeign UpdateData where
where
rename
= Record.rename
(Proxy :: Proxy "defaultMode")
(Proxy :: Proxy "_sc_defaultMode")
>>> Record.rename
(Proxy :: Proxy "proximity")
(Proxy :: Proxy "_sc_phyloProximity")
>>> Record.rename
...
...
src/Gargantext/Components/PhyloExplorer/Config/ConfigForm.purs
View file @
771e7ec0
module Gargantext.Components.PhyloExplorer.ConfigForm
module Gargantext.Components.PhyloExplorer.Config
.Config
Form
( configForm
, FormData
) where
...
...
@@ -13,6 +13,7 @@ import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.PhyloExplorer.API (CliqueFilter(..), ReflexiveClique(..), ReflexiveTimeUnit(..))
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
import Gargantext.Components.Forest.Tree.Node.Tools (formChoiceSafe, panel)
import Gargantext.Hooks.FormValidation.Unboxed as FV
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord.Behaviors (setter)
...
...
@@ -61,14 +62,77 @@ component = R.hooksComponent "configForm" cpt where
Left err -> log3 "configForm validation error" state err
Right _ -> props.callback state
-- Render
pure $
let modeChoice =
B.fieldset
{ className: "phylo-config-form__group"
, titleSlot: H.text "Mode Choice"
}
[
H.div
{ className: "phylo-config-form__row" }
[
H.div
{ className: "phylo-config-form__col" }
[
-- Clique type
H.div
{ className: intercalate " "
[ "form-group"
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Easy or Advanced:" ]
]
,
H.div
{ className: "form-group__field" }
[
H.div
{ className: "btn-group"
, role: "group"
}
[
B.button
{ callback: \_ -> setter stateBox "defaultMode" $ show true
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show false ?
"active" $
""
}
[
H.text "Automatic"
]
,
B.button
{ callback: \_ -> setter stateBox "defaultMode" $ show false
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show true ?
"active" $
""
}
[
H.text "Expert"
]
]
]
]
]
]
]
-- Render
let
form =
H.form
{ className: "phylo-config-form" }
[
H.div
[ H.div
{ className: "phylo-config-form__group" }
[
H.div
...
...
@@ -609,8 +673,9 @@ component = R.hooksComponent "configForm" cpt where
]
]
]
,
-- Submit
]
let submit =
H.div { className: "phylo-config-form__submit" }
[
B.button
...
...
@@ -627,11 +692,15 @@ component = R.hooksComponent "configForm" cpt where
H.text "Update!"
]
]
]
pure $ H.div {} [ modeChoice
, R2.when (state.defaultMode == show false) form
, submit
]
type FormData =
( proximity :: String
( defaultMode :: String
, proximity :: String
, synchrony :: String
, quality :: String
, exportFilter :: String
...
...
@@ -650,7 +719,8 @@ type FormData =
defaultData :: Record FormData
defaultData =
{ proximity : "1.0"
{ defaultMode : show true
, proximity : "1.0"
, synchrony : "1.0"
, quality : "1.0"
, exportFilter : "3.0"
...
...
src/Gargantext/Components/PhyloExplorer/Config/ConfigFormContainer.purs
View file @
771e7ec0
...
...
@@ -10,7 +10,7 @@ import Data.Maybe (Maybe(..))
import Data.Newtype (unwrap)
import Data.Number as Number
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
.Config
Form (FormData)
import Gargantext.Types (FrontendError(..))
import Gargantext.Utils (getter)
import Reactix as R
...
...
@@ -49,7 +49,8 @@ toFormData :: UpdateData -> Record ()
toFormData nt =
let r = unwrap nt
in unsafeCoerce $
{ proximity:
{ defaultMode : show r.defaultMode
, proximity:
show r.proximity
, synchrony:
show r.synchrony
...
...
@@ -85,6 +86,9 @@ toFormData nt =
fromFormData :: Record FormData -> Either String UpdateData
fromFormData r = do
-- Common params
defaultMode <-
read r.defaultMode `orDie` "Invalid defaultMode"
proximity <-
Number.fromString r.proximity `orDie` "Invalid proximity"
synchrony <-
...
...
@@ -118,7 +122,8 @@ fromFormData r = do
-- Constructor
pure $ UpdateData
{ proximity
{ defaultMode
, proximity
, synchrony
, quality
, exportFilter
...
...
src/Gargantext/Prelude.purs
View file @
771e7ec0
...
...
@@ -7,6 +7,7 @@ import Effect.Console (log)
import Effect.Class (class MonadEffect, liftEffect)
import Effect.Exception (catchException, throwException)
import Effect.Unsafe (unsafePerformEffect)
import Data.Maybe (Maybe(..))
-- | JL: Astonishingly, not in the prelude
-- AD: recent Preludes in Haskell much prefer identity
...
...
@@ -19,6 +20,12 @@ id a = a
class Read a where
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.
(MonadEffect effect)
=> Show message
...
...
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