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
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
Hide 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(..))
...
@@ -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
.Config
Form 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
...
...
src/Gargantext/Components/Forest/Tree/Node/Settings.purs
View file @
771e7ec0
...
@@ -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
...
...
src/Gargantext/Components/PhyloExplorer/API.purs
View file @
771e7ec0
...
@@ -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
...
...
src/Gargantext/Components/PhyloExplorer/Config/ConfigForm.purs
View file @
771e7ec0
module Gargantext.Components.PhyloExplorer.ConfigForm
module Gargantext.Components.PhyloExplorer.Config
.Config
Form
( configForm
( configForm
, FormData
, FormData
) where
) where
...
@@ -13,6 +13,7 @@ import Gargantext.Components.Bootstrap as B
...
@@ -13,6 +13,7 @@ import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.PhyloExplorer.API (CliqueFilter(..), ReflexiveClique(..), ReflexiveTimeUnit(..))
import Gargantext.Components.PhyloExplorer.API (CliqueFilter(..), ReflexiveClique(..), ReflexiveTimeUnit(..))
import Gargantext.Hooks.FormValidation (VForm, useFormValidation)
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.FormValidation.Unboxed as FV
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord (useStateRecord)
import Gargantext.Hooks.StateRecord.Behaviors (setter)
import Gargantext.Hooks.StateRecord.Behaviors (setter)
...
@@ -61,394 +62,291 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -61,394 +62,291 @@ component = R.hooksComponent "configForm" cpt where
Left err -> log3 "configForm validation error" state err
Left err -> log3 "configForm validation error" state err
Right _ -> props.callback state
Right _ -> props.callback state
-- Render
pure $
H.form
let modeChoice =
{ className: "phylo-config-form" }
B.fieldset
[
{ className: "phylo-config-form__group"
H.div
, titleSlot: H.text "Mode Choice"
{ className: "phylo-config-form__group" }
}
[
H.div
{ className: "phylo-config-form__row" }
[
[
H.div
H.div
{ className: "phylo-config-form__
col
" }
{ className: "phylo-config-form__
row
" }
[
[
-- Proximity
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
, (fv.hasError' "proximity") ?
"form-group--error" $
mempty
]
}
[
[
-- Clique type
H.div
H.div
{ className: "form-group__label" }
{ className: intercalate " "
[
[ "form-group"
H.label {} [ H.text "Proximity" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
} `merge` bindStateKey "proximity"
,
R2.when (fv.hasError' "proximity") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
}
]
]
,
H.div
{ className: "phylo-config-form__col" }
[
-- Synchrony
H.div
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "synchrony") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Synchrony" ]
]
,
H.div
{ className: "form-group__field" }
[
[
B.formInput $
H.div
{ type: "number"
{ className: "form-group__label" }
} `merge` bindStateKey "synchrony"
[
H.label {} [ H.text "Easy or Advanced:" ]
]
,
,
R2.when (fv.hasError' "synchrony") $
H.div
{ className: "form-group__field" }
[
H.div
H.div
{ className: "form-group__error" }
{ className: "btn-group"
, role: "group"
}
[
[
H.text "Please enter a `Double` value (eg. 0.5)"
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"
]
]
]
]
]
]
]
]
]
]
]
]
,
H.div
{ className: "phylo-config-form__row" }
-- Render
let
form =
H.form
{ className: "phylo-config-form" }
[ H.div
{ className: "phylo-config-form__group" }
[
[
H.div
H.div
{ className: "phylo-config-form__
col
" }
{ className: "phylo-config-form__
row
" }
[
[
-- Quality
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
, (fv.hasError' "quality") ?
"form-group--error" $
mempty
]
}
[
[
-- Proximity
H.div
H.div
{ className: "form-group__label" }
{ className: intercalate " "
[
[ "form-group"
H.label {} [ H.text "Quality" ]
, (fv.hasError' "proximity") ?
]
"form-group--error" $
,
mempty
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
} `merge` bindStateKey "quality"
,
R2.when (fv.hasError' "quality") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
}
]
]
,
H.div
{ className: "phylo-config-form__col" }
[
-- Export filter
H.div
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "exportFilter") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Minimum branch size" ]
]
,
H.div
{ className: "form-group__field" }
[
[
B.formInput $
H.div
{ type: "number"
{ className: "form-group__label" }
} `merge` bindStateKey "exportFilter"
[
H.label {} [ H.text "Proximity" ]
]
,
,
R2.when (fv.hasError' "exportFilter") $
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__error" }
[
[
B.formInput $
H.text "Please enter a `Double` value (eg. 3.0)"
{ type: "number"
]
} `merge` bindStateKey "proximity"
,
R2.when (fv.hasError' "proximity") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
]
]
]
]
,
]
]
,
-- Time Unit
B.fieldset
{ className: "phylo-config-form__group"
, titleSlot: H.text "Time unit"
}
[
H.div
{ className: "phylo-config-form__row" }
[
H.div
{ className: "phylo-config-form__col" }
[
-- Granularity
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
]
}
[
[
-- Synchrony
H.div
H.div
{ className:
"form-group__label" }
{ className:
intercalate " "
[
[ "form-group"
H.label {} [ H.text "Granularity" ]
, (fv.hasError' "synchrony") ?
]
"form-group--error" $
,
mempty
H.div
]
{ className: "form-group__field"
}
}
[
[
B.formSelect
H.div
(bindStateKey "granularity")
{ className: "form-group__label" }
[
[
H.option
H.label {} [ H.text "Synchrony" ]
{ value: show Year_ }
]
[ H.text "Year" ]
,
,
H.div
H.option
{ className: "form-group__field" }
{ value: show Month_ }
[
[ H.text "Month" ]
B.formInput $
,
{ type: "number"
H.option
} `merge` bindStateKey "synchrony"
{ value: show Week_ }
[ H.text "Week" ]
,
,
H.option
R2.when (fv.hasError' "synchrony") $
{ value: show Day_ }
H.div
[ H.text "Day" ]
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
]
]
]
]
]
]
,
,
H.div
H.div
{ className: "phylo-config-form__
col
" }
{ className: "phylo-config-form__
row
" }
[
[
-- Period
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
, (fv.hasError' "period") ?
"form-group--error" $
mempty
]
}
[
[
-- Quality
H.div
H.div
{ className: "form-group__label" }
{ className: intercalate " "
[
[ "form-group"
H.label {} [ H.text "Period" ]
, (fv.hasError' "quality") ?
]
"form-group--error" $
,
mempty
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
} `merge` bindStateKey "period"
,
R2.when (fv.hasError' "period") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter an `Int` value (eg. 3)"
]
]
]
}
]
,
-- Step
H.div
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "step") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Step" ]
]
,
H.div
{ className: "form-group__field" }
[
[
B.formInput $
H.div
{ type: "number"
{ className: "form-group__label" }
} `merge` bindStateKey "step"
[
H.label {} [ H.text "Quality" ]
]
,
,
R2.when (fv.hasError' "step") $
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__error" }
[
[
B.formInput $
H.text "Please enter an `Int` value (eg. 3)"
{ type: "number"
]
} `merge` bindStateKey "quality"
,
R2.when (fv.hasError' "quality") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
]
]
]
,
,
-- Matching frame
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
, (fv.hasError' "matchingFrame") ?
"form-group--error" $
mempty
]
}
[
[
-- Export filter
H.div
H.div
{ className:
"form-group__label" }
{ className:
intercalate " "
[
[ "form-group"
H.label {} [ H.text "Matching frame" ]
, (fv.hasError' "exportFilter") ?
]
"form-group--error" $
,
mempty
H.div
]
{ className: "form-group__field"
}
}
[
[
B.formInput $
H.div
{ type: "number"
{ className: "form-group__label" }
} `merge` bindStateKey "matchingFrame"
[
H.label {} [ H.text "Minimum branch size" ]
]
,
,
R2.when (fv.hasError' "matchingFrame") $
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__error" }
[
[
B.formInput $
H.text "Please enter an `Int` value (eg. 3)"
{ type: "number"
]
} `merge` bindStateKey "exportFilter"
,
R2.when (fv.hasError' "exportFilter") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 3.0)"
]
]
]
]
]
]
]
]
]
]
]
,
,
-- Time Unit
-- Clique
B.fieldset
B.fieldset
{ className: "phylo-config-form__group"
{ className: "phylo-config-form__group"
, titleSlot: H.text "Time unit"
, titleSlot: H.text "Clique algorithm"
}
}
[
H.div
{ className: "phylo-config-form__row" }
[
[
H.div
H.div
{ className: "phylo-config-form__
col
" }
{ className: "phylo-config-form__
row
" }
[
[
-- Clique type
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
]
}
[
[
-- Granularity
H.div
H.div
{ className: "form-group__label" }
{ className: intercalate " "
[
[ "form-group"
H.label {} [ H.text "Type" ]
]
]
}
,
H.div
{ className: "form-group__field" }
[
[
H.div
H.div
{ className: "btn-group"
{ className: "form-group__label" }
, role: "group"
}
[
[
B.button
H.label {} [ H.text "Granularity" ]
{ callback: \_ -> setter stateBox "cliqueType" $ show FIS_
]
-- , variant: OutlinedButtonVariant Secondary
,
, variant: ButtonVariant Light
H.div
, className: state.cliqueType == show FIS_ ?
{ className: "form-group__field" }
"active" $
[
""
B.formSelect
}
(bindStateKey "granularity")
[
H.text "FIS"
]
,
B.button
{ callback: \_ -> setter stateBox "cliqueType" $ show MaxClique_
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show MaxClique_ ?
"active" $
""
}
[
[
H.text "MaxClique"
H.option
{ value: show Year_ }
[ H.text "Year" ]
,
H.option
{ value: show Month_ }
[ H.text "Month" ]
,
H.option
{ value: show Week_ }
[ H.text "Week" ]
,
H.option
{ value: show Day_ }
[ H.text "Day" ]
]
]
]
]
]
]
]
]
]
,
,
-- TYPE::FIS_
R2.when (state.cliqueType == show FIS_) $
H.div
H.div
{ className: "phylo-config-form__col" }
{ className: "phylo-config-form__col" }
[
[
--
Support
--
Period
H.div
H.div
{ className: intercalate " "
{ className: intercalate " "
[ "form-group"
[ "form-group"
, (fv.hasError' "
support
") ?
, (fv.hasError' "
period
") ?
"form-group--error" $
"form-group--error" $
mempty
mempty
]
]
...
@@ -457,16 +355,17 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -457,16 +355,17 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "form-group__label" }
{ className: "form-group__label" }
[
[
H.label {} [ H.text "
Support
" ]
H.label {} [ H.text "
Period
" ]
]
]
,
,
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__field" }
[
[
B.formInput $
B.formInput $
bindStateKey "support"
{ type: "number"
} `merge` bindStateKey "period"
,
,
R2.when (fv.hasError' "
support
") $
R2.when (fv.hasError' "
period
") $
H.div
H.div
{ className: "form-group__error" }
{ className: "form-group__error" }
[
[
...
@@ -475,11 +374,11 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -475,11 +374,11 @@ component = R.hooksComponent "configForm" cpt where
]
]
]
]
,
,
-- S
ize
-- S
tep
H.div
H.div
{ className: intercalate " "
{ className: intercalate " "
[ "form-group"
[ "form-group"
, (fv.hasError' "s
ize
") ?
, (fv.hasError' "s
tep
") ?
"form-group--error" $
"form-group--error" $
mempty
mempty
]
]
...
@@ -488,16 +387,17 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -488,16 +387,17 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "form-group__label" }
{ className: "form-group__label" }
[
[
H.label {} [ H.text "S
ize
" ]
H.label {} [ H.text "S
tep
" ]
]
]
,
,
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__field" }
[
[
B.formInput $
B.formInput $
bindStateKey "size"
{ type: "number"
} `merge` bindStateKey "step"
,
,
R2.when (fv.hasError' "s
jze
") $
R2.when (fv.hasError' "s
tep
") $
H.div
H.div
{ className: "form-group__error" }
{ className: "form-group__error" }
[
[
...
@@ -505,19 +405,12 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -505,19 +405,12 @@ component = R.hooksComponent "configForm" cpt where
]
]
]
]
]
]
]
,
,
-- Matching frame
-- TYPE::MaxClique_
R2.when (state.cliqueType == show MaxClique_) $
H.div
{ className: "phylo-config-form__col" }
[
-- Size
H.div
H.div
{ className: intercalate " "
{ className: intercalate " "
[ "form-group"
[ "form-group"
, (fv.hasError' "
siz
e") ?
, (fv.hasError' "
matchingFram
e") ?
"form-group--error" $
"form-group--error" $
mempty
mempty
]
]
...
@@ -526,7 +419,7 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -526,7 +419,7 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "form-group__label" }
{ className: "form-group__label" }
[
[
H.label {} [ H.text "
Siz
e" ]
H.label {} [ H.text "
Matching fram
e" ]
]
]
,
,
H.div
H.div
...
@@ -534,9 +427,9 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -534,9 +427,9 @@ component = R.hooksComponent "configForm" cpt where
[
[
B.formInput $
B.formInput $
{ type: "number"
{ type: "number"
} `merge` bindStateKey "
siz
e"
} `merge` bindStateKey "
matchingFram
e"
,
,
R2.when (fv.hasError' "
siz
e") $
R2.when (fv.hasError' "
matchingFram
e") $
H.div
H.div
{ className: "form-group__error" }
{ className: "form-group__error" }
[
[
...
@@ -544,94 +437,270 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -544,94 +437,270 @@ component = R.hooksComponent "configForm" cpt where
]
]
]
]
]
]
,
]
-- Treshold
]
]
,
-- Clique
B.fieldset
{ className: "phylo-config-form__group"
, titleSlot: H.text "Clique algorithm"
}
[
H.div
{ className: "phylo-config-form__row" }
[
H.div
{ className: "phylo-config-form__col" }
[
-- Clique type
H.div
H.div
{ className: intercalate " "
{ className: intercalate " "
[ "form-group"
[ "form-group"
, (fv.hasError' "threshold") ?
"form-group--error" $
mempty
]
]
}
}
[
[
H.div
H.div
{ className: "form-group__label" }
{ className: "form-group__label" }
[
[
H.label {} [ H.text "T
reshold
" ]
H.label {} [ H.text "T
ype
" ]
]
]
,
,
H.div
H.div
{ className: "form-group__field" }
{ className: "form-group__field" }
[
[
B.formInput $
H.div
{ type: "number"
{ className: "btn-group"
} `merge` bindStateKey "threshold"
, role: "group"
,
}
R2.when (fv.hasError' "threshold") $
[
H.div
B.button
{ className: "form-group__error" }
{ callback: \_ -> setter stateBox "cliqueType" $ show FIS_
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show FIS_ ?
"active" $
""
}
[
[
H.text "Please enter a `Double` value (eg. 0.5)"
H.text "FIS"
]
,
B.button
{ callback: \_ -> setter stateBox "cliqueType" $ show MaxClique_
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show MaxClique_ ?
"active" $
""
}
[
H.text "MaxClique"
]
]
]
]
]
]
]
,
]
-- Clique filter
,
-- TYPE::FIS_
R2.when (state.cliqueType == show FIS_) $
H.div
H.div
{ className: intercalate " "
{ className: "phylo-config-form__col" }
[ "form-group"
[
-- Support
H.div
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "support") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Support" ]
]
]
}
,
H.div
{ className: "form-group__field" }
[
B.formInput $
bindStateKey "support"
,
R2.when (fv.hasError' "support") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter an `Int` value (eg. 3)"
]
]
]
,
-- Size
H.div
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "size") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Size" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
bindStateKey "size"
,
R2.when (fv.hasError' "sjze") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter an `Int` value (eg. 3)"
]
]
]
]
,
-- TYPE::MaxClique_
R2.when (state.cliqueType == show MaxClique_) $
H.div
{ className: "phylo-config-form__col" }
[
[
-- Size
H.div
H.div
{ className: "form-group__label" }
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "size") ?
"form-group--error" $
mempty
]
}
[
[
H.label {} [ H.text "Filter type" ]
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Size" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
} `merge` bindStateKey "size"
,
R2.when (fv.hasError' "size") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter an `Int` value (eg. 3)"
]
]
]
]
,
,
-- Treshold
H.div
H.div
{ className: "form-group__field" }
{ className: intercalate " "
[ "form-group"
, (fv.hasError' "threshold") ?
"form-group--error" $
mempty
]
}
[
[
B.formSelect
H.div
( bindStateKey "cliqueFilter" )
{ className: "form-group__label" }
[
[
H.option
H.label {} [ H.text "Treshold" ]
{ value: show ByThreshold }
]
[ H.text "By threshold" ]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
} `merge` bindStateKey "threshold"
,
,
H.option
R2.when (fv.hasError' "threshold") $
{ value: show ByNeighbours }
H.div
[ H.text "By neighbours" ]
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
,
-- Clique filter
H.div
{ className: intercalate " "
[ "form-group"
]
}
[
H.div
{ className: "form-group__label" }
[
H.label {} [ H.text "Filter type" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formSelect
( bindStateKey "cliqueFilter" )
[
H.option
{ value: show ByThreshold }
[ H.text "By threshold" ]
,
H.option
{ value: show ByNeighbours }
[ H.text "By neighbours" ]
]
]
]
]
]
]
]
]
]
]
]
]
]
,
-- Submit
let submit =
H.div { className: "phylo-config-form__submit" }
H.div { className: "phylo-config-form__submit" }
[
B.button
{ callback: \_ -> onSubmit
, status: props.status == Deferred ? Deferred $ Enabled
, variant: ButtonVariant Primary
, type: "submit"
}
[
[
B.icon { name: "refresh" }
B.button
,
{ callback: \_ -> onSubmit
H.text $ nbsp 1
, status: props.status == Deferred ? Deferred $ Enabled
,
, variant: ButtonVariant Primary
H.text "Update!"
, type: "submit"
}
[
B.icon { name: "refresh" }
,
H.text $ nbsp 1
,
H.text "Update!"
]
]
]
]
]
pure $ H.div {} [ modeChoice
, R2.when (state.defaultMode == show false) form
, submit
]
type FormData =
type FormData =
( proximity :: String
( defaultMode :: String
, proximity :: String
, synchrony :: String
, synchrony :: String
, quality :: String
, quality :: String
, exportFilter :: String
, exportFilter :: String
...
@@ -650,7 +719,8 @@ type FormData =
...
@@ -650,7 +719,8 @@ type FormData =
defaultData :: Record FormData
defaultData :: Record FormData
defaultData =
defaultData =
{ proximity : "1.0"
{ defaultMode : show true
, proximity : "1.0"
, synchrony : "1.0"
, synchrony : "1.0"
, quality : "1.0"
, quality : "1.0"
, exportFilter : "3.0"
, exportFilter : "3.0"
...
...
src/Gargantext/Components/PhyloExplorer/Config/ConfigFormContainer.purs
View file @
771e7ec0
...
@@ -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
.Config
Form (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
...
...
src/Gargantext/Prelude.purs
View file @
771e7ec0
...
@@ -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
...
...
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