[BREAKING phylo] implement hh/mm/ss in phylo dialog

NOTE: There is an API change as well to make this all simpler so be
sure to test with corresponding backend branch.
parent 0c8c7901
......@@ -93,6 +93,9 @@ data TimeUnit
| Month TimeUnitCriteria
| Week TimeUnitCriteria
| Day TimeUnitCriteria
| Hour TimeUnitCriteria
| Minute TimeUnitCriteria
| Second TimeUnitCriteria
derive instance Generic TimeUnit _
derive instance Eq TimeUnit
......@@ -109,72 +112,45 @@ instance JSON.WriteForeign TimeUnit where
Month (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMonth) o
Week (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseWeek) o
Day (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseDay) o
Hour (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseHour) o
Minute (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMinute) o
Second (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseSecond) o
where
-- TODO It would be nice to refactor these functions, however it's
-- not that trivial, because we would have to combine `Symbol`s at
-- the type level25
parseEpoch =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_epoch_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_epoch_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_epoch_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Epoch"
Record.insert
(Proxy :: Proxy "tag")
"Epoch"
parseYear =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_year_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_year_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_year_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Year"
Record.insert
(Proxy :: Proxy "tag")
"Year"
parseMonth =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_month_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_month_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_month_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Month"
Record.insert
(Proxy :: Proxy "tag")
"Month"
parseWeek =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_week_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_week_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_week_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Week"
Record.insert
(Proxy :: Proxy "tag")
"Week"
parseDay =
Record.rename
(Proxy :: Proxy "period")
(Proxy :: Proxy "_day_period")
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_day_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_day_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Day"
Record.insert
(Proxy :: Proxy "tag")
"Day"
parseHour =
Record.insert
(Proxy :: Proxy "tag")
"Hour"
parseMinute =
Record.insert
(Proxy :: Proxy "tag")
"Minute"
parseSecond =
Record.insert
(Proxy :: Proxy "tag")
"Second"
data ReflexiveTimeUnit
= Epoch_
......@@ -182,6 +158,9 @@ data ReflexiveTimeUnit
| Month_
| Week_
| Day_
| Hour_
| Minute_
| Second_
derive instance Generic ReflexiveTimeUnit _
derive instance Eq ReflexiveTimeUnit
......@@ -196,6 +175,9 @@ instance Read ReflexiveTimeUnit where
"Month_" -> Just Month_
"Week_" -> Just Week_
"Day_" -> Just Day_
"Hour_" -> Just Hour_
"Minute_" -> Just Minute_
"Second_" -> Just Second_
_ -> Nothing
newtype TimeUnitCriteria = TimeUnitCriteria
......@@ -302,6 +284,9 @@ toReflexiveTimeUnit (Year _) = Year_
toReflexiveTimeUnit (Month _) = Month_
toReflexiveTimeUnit (Week _) = Week_
toReflexiveTimeUnit (Day _) = Day_
toReflexiveTimeUnit (Hour _) = Hour_
toReflexiveTimeUnit (Minute _) = Minute_
toReflexiveTimeUnit (Second _) = Second_
fromReflexiveTimeUnit :: ReflexiveTimeUnit -> TimeUnitCriteria -> TimeUnit
fromReflexiveTimeUnit Epoch_ c = Epoch c
......@@ -309,6 +294,9 @@ fromReflexiveTimeUnit Year_ c = Year c
fromReflexiveTimeUnit Month_ c = Month c
fromReflexiveTimeUnit Week_ c = Week c
fromReflexiveTimeUnit Day_ c = Day c
fromReflexiveTimeUnit Hour_ c = Hour c
fromReflexiveTimeUnit Minute_ c = Minute c
fromReflexiveTimeUnit Second_ c = Second c
extractCriteria :: TimeUnit -> TimeUnitCriteria
extractCriteria (Epoch (o :: TimeUnitCriteria)) = o
......@@ -316,6 +304,9 @@ extractCriteria (Year (o :: TimeUnitCriteria)) = o
extractCriteria (Month (o :: TimeUnitCriteria)) = o
extractCriteria (Week (o :: TimeUnitCriteria)) = o
extractCriteria (Day (o :: TimeUnitCriteria)) = o
extractCriteria (Hour (o :: TimeUnitCriteria)) = o
extractCriteria (Minute (o :: TimeUnitCriteria)) = o
extractCriteria (Second (o :: TimeUnitCriteria)) = o
toReflexiveClique :: Clique -> ReflexiveClique
toReflexiveClique (FIS _) = FIS_
......
......@@ -195,6 +195,15 @@ component = R.hooksComponent "configForm" cpt
, H.option
{ value: show Day_ }
[ H.text "Day" ]
, H.option
{ value: show Hour_ }
[ H.text "Hour" ]
, H.option
{ value: show Minute_ }
[ H.text "Minute" ]
, H.option
{ value: show Second_ }
[ H.text "Second" ]
]
]
]
......
......@@ -7,7 +7,7 @@ module Gargantext.Utils.ZIP
import Gargantext.Prelude
import Data.ArrayBuffer.Types (ArrayBuffer)
import Effect
import Effect (Effect)
import Control.Promise
import Effect.Aff (Aff)
......
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