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
Christian Merten
purescript-gargantext
Commits
263650cb
Commit
263650cb
authored
Sep 27, 2023
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/601-slider-level-of-observation-in-phylomemies' into dev
parents
57fa0591
b0d1499f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
293 additions
and
122 deletions
+293
-122
ConfigForm.purs
...argantext/Components/PhyloExplorer/Config/ConfigForm.purs
+293
-122
No files found.
src/Gargantext/Components/PhyloExplorer/Config/ConfigForm.purs
View file @
263650cb
...
@@ -7,7 +7,10 @@ import Gargantext.Prelude
...
@@ -7,7 +7,10 @@ import Gargantext.Prelude
import DOM.Simple.Console (log3)
import DOM.Simple.Console (log3)
import Data.Either (Either(..))
import Data.Either (Either(..))
import Data.Generic.Rep (class Generic)
import Data.Foldable (foldl, intercalate)
import Data.Foldable (foldl, intercalate)
import Data.Maybe (Maybe(..))
import Data.Show.Generic (genericShow)
import Effect (Effect)
import Effect (Effect)
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap as B
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
import Gargantext.Components.Bootstrap.Types (ButtonVariant(..), ComponentStatus(..), Variant(..))
...
@@ -33,6 +36,21 @@ type Props =
...
@@ -33,6 +36,21 @@ type Props =
type Options = ( | FormData )
type Options = ( | FormData )
data ReflexiveClusterAlgoMode
= Basic_
| Expert_
derive instance Generic ReflexiveClusterAlgoMode _
derive instance Eq ReflexiveClusterAlgoMode
instance Show ReflexiveClusterAlgoMode where show = genericShow
instance Read ReflexiveClusterAlgoMode where
read :: String -> Maybe ReflexiveClusterAlgoMode
read = case _ of
"Basic_" -> Just Basic_
"Expert_" -> Just Expert_
_ -> Nothing
options :: Record Options
options :: Record Options
options = Record.merge {} defaultData
options = Record.merge {} defaultData
...
@@ -101,7 +119,7 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -101,7 +119,7 @@ component = R.hooksComponent "configForm" cpt where
, variant: ButtonVariant Light
, variant: ButtonVariant Light
, className: state.defaultMode == show true ?
, className: state.defaultMode == show true ?
"active" $
"active" $
""
"
border-gray-300
"
}
}
[
[
H.text "Automatic"
H.text "Automatic"
...
@@ -113,7 +131,7 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -113,7 +131,7 @@ component = R.hooksComponent "configForm" cpt where
, variant: ButtonVariant Light
, variant: ButtonVariant Light
, className: state.defaultMode == show false ?
, className: state.defaultMode == show false ?
"active" $
"active" $
""
"
border-gray-300
"
}
}
[
[
H.text "Advanced"
H.text "Advanced"
...
@@ -347,9 +365,9 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -347,9 +365,9 @@ component = R.hooksComponent "configForm" cpt where
[
[
H.div { className: "col-9 p-0 mx-1 mt-1" } [
H.div { className: "col-9 p-0 mx-1 mt-1" } [
B.formInput $
B.formInput $
{ className: "range-simple__input p-0 h-auto border-0"
{ className: "range-simple__input p-0 h-auto border-0
p-0 text-center
"
, type: "range"
, type: "range"
, step: "0.1"
, step: "0.
0
1"
, min: "0"
, min: "0"
, max: "1"
, max: "1"
} `merge` bindStateKey "quality"
} `merge` bindStateKey "quality"
...
@@ -411,24 +429,24 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -411,24 +429,24 @@ component = R.hooksComponent "configForm" cpt where
}
}
[
[
B.button
B.button
{ callback: \_ -> setter stateBox "cl
iqueType" $ show FIS
_
{ callback: \_ -> setter stateBox "cl
usterAlgoMode" $ show Basic
_
-- , variant: OutlinedButtonVariant Secondary
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, variant: ButtonVariant Light
, className: state.cl
iqueType == show FIS
_ ?
, className: state.cl
usterAlgoMode == show Basic
_ ?
"active" $
"active" $
""
"
border-gray-300
"
}
}
[
[
H.text "Basic"
H.text "Basic"
]
]
,
,
B.button
B.button
{ callback: \_ -> setter stateBox "cl
iqueType" $ show MaxClique
_
{ callback: \_ -> setter stateBox "cl
usterAlgoMode" $ show Expert
_
-- , variant: OutlinedButtonVariant Secondary
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, variant: ButtonVariant Light
, className: state.cl
iqueType == show MaxClique
_ ?
, className: state.cl
usterAlgoMode == show Expert
_ ?
"active" $
"active" $
""
"
border-gray-300
"
}
}
[
[
H.text "Expert"
H.text "Expert"
...
@@ -440,8 +458,8 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -440,8 +458,8 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "" }
{ className: "" }
[
[
-- Mode Basic /
TYPE::FIS
_
-- Mode Basic /
Basic
_
R2.when (state.cl
iqueType == show FIS
_) $
R2.when (state.cl
usterAlgoMode == show Basic
_) $
H.div { className: "clustrisation-algorythm-basic form-group" }
H.div { className: "clustrisation-algorythm-basic form-group" }
[
[
...
@@ -476,7 +494,8 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -476,7 +494,8 @@ component = R.hooksComponent "configForm" cpt where
{ className: "form-group__field" }
{ className: "form-group__field" }
[
[
B.formInput $
B.formInput $
{ type: "number"
{ type: "number"
, min: "1"
} `merge` bindStateKey "support"
} `merge` bindStateKey "support"
,
,
R2.when (fv.hasError' "support") $
R2.when (fv.hasError' "support") $
...
@@ -526,122 +545,257 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -526,122 +545,257 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "" }
{ className: "" }
[
[
-- Mode Expert
(part 1) / TYPE::MaxClique
_
-- Mode Expert
/ Expert
_
R2.when (state.cl
iqueType == show MaxClique
_) $
R2.when (state.cl
usterAlgoMode == show Expert
_) $
H.div { className: "
clustrisation-algorythm-expert form-group
" }
H.div { className: "
text-center
" }
[
[
-- Title MaxClique
H.div
H.div
{ className: "form-group__label text-center" }
{ className: "form-group__field" }
[
H.label {} [ H.text "MaxClique" ]
]
,
H.div
{ className: "phylo-config-form__row justify-content-center" }
[
[
-- Size
H.div
H.div
{ className: intercalate " "
{ className: "btn-group"
[ "form-group col-3 w-10 text-center mb-0"
, role: "group"
, (fv.hasError' "size") ?
"form-group--error" $
mempty
]
}
}
[
[
H.div
B.button
{ className: "" }
{ callback: \_ -> setter stateBox "cliqueType" $ show FIS_
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show FIS_ ?
"active" $
""
}
[
[
H.
label {} [ H.text "Size" ]
H.
text "FIS"
]
]
,
,
H.div
B.button
{ className: "form-group__field" }
{ callback: \_ -> setter stateBox "cliqueType" $ show MaxClique_
-- , variant: OutlinedButtonVariant Secondary
, variant: ButtonVariant Light
, className: state.cliqueType == show MaxClique_ ?
"active" $
""
}
[
[
B.formInput $
H.text "MaxClique"
{ type: "number"
, step: "1"
, min: "0"
, max: "10"
} `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
,
{ className: intercalate " "
H.div {}
[ "form-group col-4 w-10 text-center mb-0"
[
, (fv.hasError' "threshold") ?
"form-group--error" $
R2.when (state.cliqueType == show FIS_) $
mempty
]
H.div { className: "clustrisation-algorythm-basic form-group" }
}
[
[
-- Title FIS
H.div
H.div
{ className: "" }
{ className: "
form-group__label text-center
" }
[
[
H.label {} [ H.text "
Treshold
" ]
H.label {} [ H.text "
FIS
" ]
]
]
,
,
H.div
H.div
{ className: "
form-group__field
" }
{ className: "
phylo-config-form__row justify-content-center
" }
[
[
B.formInput $
{ type: "number"
-- Support
, step: "0.0001"
H.div
, min: "0.0001"
{ className: intercalate " "
, max: "1"
[ "form-group col-4 w-10 text-center mb-0"
} `merge` bindStateKey "threshold"
, (fv.hasError' "support") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "" }
[
H.label {} [ H.text "Support" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
, min: "1"
} `merge` bindStateKey "support"
,
R2.when (fv.hasError' "support") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter an `Int` value (eg. 3)"
]
]
]
,
,
R2.when (fv.hasError' "threshold") $
-- Size
H.div
{ className: intercalate " "
[ "form-group col-4 w-10 text-center mb-0"
, (fv.hasError' "size") ?
"form-group--error" $
mempty
]
}
[
H.div
H.div
{ className: "form-group__error" }
{ className: "" }
[
H.label {} [ H.text "Size" ]
]
,
H.div
{ className: "form-group__field" }
[
[
H.text "Please enter a `Double` value (eg. 0.5)"
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)"
]
]
]
]
]
]
]
]
,
-- Clique filter
]
H.div
,
{ className: intercalate " "
H.div {}
[ "form-group col-5 w-10 text-center mb-0 text-nowrap"
[
]
}
R2.when (state.cliqueType == show MaxClique_) $
H.div { className: "clustrisation-algorythm-expert form-group pt-1" }
[
[
-- Title MaxClique
H.div
H.div
{ className: "" }
{ className: "
form-group__label text-center
" }
[
[
H.label {} [ H.text "
Filter typ
e" ]
H.label {} [ H.text "
MaxCliqu
e" ]
]
]
,
,
H.div
H.div
{ className: "
form-group__field
" }
{ className: "
phylo-config-form__row justify-content-center
" }
[
[
B.formSelect
-- Size
( bindStateKey "cliqueFilter" )
H.div
{ className: intercalate " "
[ "form-group col-3 w-10 text-center mb-0"
, (fv.hasError' "size") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "" }
[
H.label {} [ H.text "Size" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
, step: "1"
, min: "0"
, max: "10"
} `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
{ className: intercalate " "
[ "form-group col-4 w-10 text-center mb-0"
, (fv.hasError' "threshold") ?
"form-group--error" $
mempty
]
}
[
H.div
{ className: "" }
[
H.label {} [ H.text "Treshold" ]
]
,
H.div
{ className: "form-group__field" }
[
B.formInput $
{ type: "number"
, step: "0.0001"
, min: "0.0001"
, max: "1"
} `merge` bindStateKey "threshold"
,
R2.when (fv.hasError' "threshold") $
H.div
{ className: "form-group__error" }
[
H.text "Please enter a `Double` value (eg. 0.5)"
]
]
]
,
-- Clique filter
H.div
{ className: intercalate " "
[ "form-group col-5 w-10 text-center mb-0 text-nowrap"
]
}
[
[
H.option
H.div
{ value: show ByThreshold }
{ className: "" }
[ H.text "By threshold" ]
[
H.label {} [ H.text "Filter type" ]
]
,
,
H.option
H.div
{ value: show ByNeighbours }
{ className: "form-group__field" }
[ H.text "By neighbours" ]
[
B.formSelect
( bindStateKey "cliqueFilter" )
[
H.option
{ value: show ByThreshold }
[ H.text "By threshold" ]
,
H.option
{ value: show ByNeighbours }
[ H.text "By neighbours" ]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
...
@@ -650,8 +804,8 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -650,8 +804,8 @@ component = R.hooksComponent "configForm" cpt where
H.div
H.div
{ className: "" }
{ className: "" }
[
[
-- Mode Expert (part 2) / TYPE::MaxClique_
--
--
Mode Expert (part 2) / TYPE::MaxClique_
R2.when (state.cliqueType == show MaxClique_) $
--
R2.when (state.cliqueType == show MaxClique_) $
H.div
H.div
{ className: "phylo-config-form__row" }
{ className: "phylo-config-form__row" }
...
@@ -1365,40 +1519,42 @@ component = R.hooksComponent "configForm" cpt where
...
@@ -1365,40 +1519,42 @@ component = R.hooksComponent "configForm" cpt where
]
]
type FormData =
type FormData =
( defaultMode :: String
( defaultMode
:: String
, proximity :: String
, proximity
:: String
, synchrony :: String
, synchrony
:: String
, quality :: String
, quality
:: String
, exportFilter :: String
, exportFilter
:: String
-- TimeUnit
-- TimeUnit
, granularity :: String
, granularity
:: String
, period :: String
, period
:: String
, step :: String
, step
:: String
, matchingFrame :: String
, matchingFrame
:: String
-- Clique
-- Clique
, cliqueType :: String
, clusterAlgoMode :: String
, support :: String
, cliqueType :: String
, size :: String
, support :: String
, threshold :: String
, size :: String
, cliqueFilter :: String
, threshold :: String
, cliqueFilter :: String
)
)
defaultData :: Record FormData
defaultData :: Record FormData
defaultData =
defaultData =
{ defaultMode : show true
{ defaultMode : show true
, proximity : "1.0"
, proximity : "1.0"
, synchrony : "1.0"
, synchrony : "1.0"
, quality : "1.0"
, quality : "1.0"
, exportFilter : "3.0"
, exportFilter : "3.0"
, granularity : show Year_
, granularity : show Year_
, period : "1"
, period : "1"
, step : "1"
, step : "1"
, matchingFrame : "1"
, matchingFrame : "1"
, cliqueType : show FIS_
, clusterAlgoMode : show Basic_
, support : "1"
, cliqueType : show FIS_
, size : "1"
, support : "2"
, threshold : "1"
, size : "1"
, cliqueFilter : show ByThreshold
, threshold : "1"
, cliqueFilter : show ByThreshold
}
}
formValidation :: Record FormData -> Effect VForm
formValidation :: Record FormData -> Effect VForm
...
@@ -1412,6 +1568,19 @@ formValidation r = foldl append mempty rules
...
@@ -1412,6 +1568,19 @@ formValidation r = foldl append mempty rules
, FV.int "matchingFrame" r.matchingFrame
, FV.int "matchingFrame" r.matchingFrame
]
]
-- Clique
-- Clique
<> if (r.clusterAlgoMode == show Basic_)
then
-- Basic_ (Basic mode)
[
-- FV.int "support" r.support
-- , FV.int "size" r.size
]
else
-- Expert_ (Expert mode)
[
-- FV.int "size" r.size
-- , FV.number "threshold" r.threshold
]
<> if (r.cliqueType == show FIS_)
<> if (r.cliqueType == show FIS_)
then
then
-- FIS_ (Basic mode)
-- FIS_ (Basic mode)
...
@@ -1422,7 +1591,9 @@ formValidation r = foldl append mempty rules
...
@@ -1422,7 +1591,9 @@ formValidation r = foldl append mempty rules
-- MaxClique_ (Expert mode)
-- MaxClique_ (Expert mode)
[ FV.int "size" r.size
[ FV.int "size" r.size
, FV.number "threshold" r.threshold
, FV.number "threshold" r.threshold
, FV.number "proximity" r.proximity
, FV.number "synchrony" r.synchrony
, FV.number "exportFilter" r.exportFilter
]
]
<>
[ FV.number "proximity" r.proximity
, FV.number "synchrony" r.synchrony
, FV.number "exportFilter" r.exportFilter
]
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