[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 ...@@ -93,6 +93,9 @@ data TimeUnit
| Month TimeUnitCriteria | Month TimeUnitCriteria
| Week TimeUnitCriteria | Week TimeUnitCriteria
| Day TimeUnitCriteria | Day TimeUnitCriteria
| Hour TimeUnitCriteria
| Minute TimeUnitCriteria
| Second TimeUnitCriteria
derive instance Generic TimeUnit _ derive instance Generic TimeUnit _
derive instance Eq TimeUnit derive instance Eq TimeUnit
...@@ -109,72 +112,45 @@ instance JSON.WriteForeign TimeUnit where ...@@ -109,72 +112,45 @@ instance JSON.WriteForeign TimeUnit where
Month (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMonth) o Month (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseMonth) o
Week (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseWeek) o Week (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseWeek) o
Day (TimeUnitCriteria o) -> (JSON.writeImpl <<< parseDay) 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 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 = parseEpoch =
Record.rename Record.insert
(Proxy :: Proxy "period") (Proxy :: Proxy "tag")
(Proxy :: Proxy "_epoch_period") "Epoch"
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_epoch_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_epoch_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Epoch"
parseYear = parseYear =
Record.rename Record.insert
(Proxy :: Proxy "period") (Proxy :: Proxy "tag")
(Proxy :: Proxy "_year_period") "Year"
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_year_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_year_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Year"
parseMonth = parseMonth =
Record.rename Record.insert
(Proxy :: Proxy "period") (Proxy :: Proxy "tag")
(Proxy :: Proxy "_month_period") "Month"
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_month_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_month_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Month"
parseWeek = parseWeek =
Record.rename Record.insert
(Proxy :: Proxy "period") (Proxy :: Proxy "tag")
(Proxy :: Proxy "_week_period") "Week"
>>> Record.rename
(Proxy :: Proxy "step")
(Proxy :: Proxy "_week_step")
>>> Record.rename
(Proxy :: Proxy "matchingFrame")
(Proxy :: Proxy "_week_matchingFrame")
>>> Record.insert
(Proxy :: Proxy "tag")
"Week"
parseDay = parseDay =
Record.rename Record.insert
(Proxy :: Proxy "period") (Proxy :: Proxy "tag")
(Proxy :: Proxy "_day_period") "Day"
>>> Record.rename parseHour =
(Proxy :: Proxy "step") Record.insert
(Proxy :: Proxy "_day_step") (Proxy :: Proxy "tag")
>>> Record.rename "Hour"
(Proxy :: Proxy "matchingFrame") parseMinute =
(Proxy :: Proxy "_day_matchingFrame") Record.insert
>>> Record.insert (Proxy :: Proxy "tag")
(Proxy :: Proxy "tag") "Minute"
"Day" parseSecond =
Record.insert
(Proxy :: Proxy "tag")
"Second"
data ReflexiveTimeUnit data ReflexiveTimeUnit
= Epoch_ = Epoch_
...@@ -182,6 +158,9 @@ data ReflexiveTimeUnit ...@@ -182,6 +158,9 @@ data ReflexiveTimeUnit
| Month_ | Month_
| Week_ | Week_
| Day_ | Day_
| Hour_
| Minute_
| Second_
derive instance Generic ReflexiveTimeUnit _ derive instance Generic ReflexiveTimeUnit _
derive instance Eq ReflexiveTimeUnit derive instance Eq ReflexiveTimeUnit
...@@ -196,6 +175,9 @@ instance Read ReflexiveTimeUnit where ...@@ -196,6 +175,9 @@ instance Read ReflexiveTimeUnit where
"Month_" -> Just Month_ "Month_" -> Just Month_
"Week_" -> Just Week_ "Week_" -> Just Week_
"Day_" -> Just Day_ "Day_" -> Just Day_
"Hour_" -> Just Hour_
"Minute_" -> Just Minute_
"Second_" -> Just Second_
_ -> Nothing _ -> Nothing
newtype TimeUnitCriteria = TimeUnitCriteria newtype TimeUnitCriteria = TimeUnitCriteria
...@@ -302,6 +284,9 @@ toReflexiveTimeUnit (Year _) = Year_ ...@@ -302,6 +284,9 @@ toReflexiveTimeUnit (Year _) = Year_
toReflexiveTimeUnit (Month _) = Month_ toReflexiveTimeUnit (Month _) = Month_
toReflexiveTimeUnit (Week _) = Week_ toReflexiveTimeUnit (Week _) = Week_
toReflexiveTimeUnit (Day _) = Day_ toReflexiveTimeUnit (Day _) = Day_
toReflexiveTimeUnit (Hour _) = Hour_
toReflexiveTimeUnit (Minute _) = Minute_
toReflexiveTimeUnit (Second _) = Second_
fromReflexiveTimeUnit :: ReflexiveTimeUnit -> TimeUnitCriteria -> TimeUnit fromReflexiveTimeUnit :: ReflexiveTimeUnit -> TimeUnitCriteria -> TimeUnit
fromReflexiveTimeUnit Epoch_ c = Epoch c fromReflexiveTimeUnit Epoch_ c = Epoch c
...@@ -309,6 +294,9 @@ fromReflexiveTimeUnit Year_ c = Year c ...@@ -309,6 +294,9 @@ fromReflexiveTimeUnit Year_ c = Year c
fromReflexiveTimeUnit Month_ c = Month c fromReflexiveTimeUnit Month_ c = Month c
fromReflexiveTimeUnit Week_ c = Week c fromReflexiveTimeUnit Week_ c = Week c
fromReflexiveTimeUnit Day_ c = Day 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 :: TimeUnit -> TimeUnitCriteria
extractCriteria (Epoch (o :: TimeUnitCriteria)) = o extractCriteria (Epoch (o :: TimeUnitCriteria)) = o
...@@ -316,6 +304,9 @@ extractCriteria (Year (o :: TimeUnitCriteria)) = o ...@@ -316,6 +304,9 @@ extractCriteria (Year (o :: TimeUnitCriteria)) = o
extractCriteria (Month (o :: TimeUnitCriteria)) = o extractCriteria (Month (o :: TimeUnitCriteria)) = o
extractCriteria (Week (o :: TimeUnitCriteria)) = o extractCriteria (Week (o :: TimeUnitCriteria)) = o
extractCriteria (Day (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 :: Clique -> ReflexiveClique
toReflexiveClique (FIS _) = FIS_ toReflexiveClique (FIS _) = FIS_
......
...@@ -195,6 +195,15 @@ component = R.hooksComponent "configForm" cpt ...@@ -195,6 +195,15 @@ component = R.hooksComponent "configForm" cpt
, H.option , H.option
{ value: show Day_ } { value: show Day_ }
[ H.text "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 ...@@ -7,7 +7,7 @@ module Gargantext.Utils.ZIP
import Gargantext.Prelude import Gargantext.Prelude
import Data.ArrayBuffer.Types (ArrayBuffer) import Data.ArrayBuffer.Types (ArrayBuffer)
import Effect import Effect (Effect)
import Control.Promise import Control.Promise
import Effect.Aff (Aff) 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