Commit 8308c4d5 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/582-dev-phylo-default-behavior' into dev

parents 16437499 980c5fe8
......@@ -40,7 +40,7 @@ nodeCpt = R2.hereComponent here "node" hCpt where
-- |
session <- useSession
state' /\ state <- R2.useBox' (Nothing :: Maybe PhyloSet)
state' /\ state <- R2.useBox' (Nothing :: Maybe (Maybe PhyloSet))
cache' /\ cache <- R2.useBox' (defaultCacheParams :: CacheParams)
-- | Computed
......@@ -92,8 +92,9 @@ nodeCpt = R2.hereComponent here "node" hCpt where
]
]
, defaultSlot:
R2.fromMaybe state' \(PhyloSet { corpusId, listId, phyloData, phyloConfig}) ->
R2.fromMaybe state' \p ->
case p of
Just (PhyloSet {phyloData, phyloConfig, corpusId, listId}) ->
let
state_ :: Record PhyloStore.State
state_ =
......@@ -116,4 +117,7 @@ nodeCpt = R2.hereComponent here "node" hCpt where
layout
{}
]
_ -> H.p
{ className: "text-center pt-10" }
[ H.text "Phylo not generated yet, please update the node settings to see your phylonometry." ]
}
......@@ -30,7 +30,7 @@ import Simple.JSON.Generics as JSONG
import Type.Proxy (Proxy(..))
get :: S.Session -> NodeID -> AffRESTError (PhyloSet)
get :: S.Session -> NodeID -> AffRESTError (Maybe PhyloSet)
get session nodeId = request >>= (_ <#> parseToPhyloSet) >>> pure
where
request :: AffRESTError (PhyloJSON)
......
......@@ -23,7 +23,7 @@ import Simple.JSON as JSON
newtype PhyloJSON = PhyloJSON
{ pd_corpusId :: Int
, pd_listId :: Int
, pd_data ::
, pd_data :: Maybe (
{ _subgraph_cnt :: Int
, directed :: Boolean
, edges :: Array RawEdge
......@@ -31,7 +31,8 @@ newtype PhyloJSON = PhyloJSON
, strict :: Boolean
| GraphData
}
, pd_config ::
)
, pd_config :: Maybe (
{ clique :: Cluster
, exportLabel :: Array PhyloLabel
, exportSort :: Sort
......@@ -42,6 +43,7 @@ newtype PhyloJSON = PhyloJSON
, timeUnit :: TimeUnit
| ConfigData
}
)
}
derive instance Generic PhyloJSON _
......
......@@ -56,8 +56,8 @@ derive instance Generic PhyloSet _
derive instance Eq PhyloSet
instance Show PhyloSet where show = genericShow
parseToPhyloSet :: PhyloJSON -> PhyloSet
parseToPhyloSet (PhyloJSON o) = PhyloSet
parseToPhyloSet :: PhyloJSON -> Maybe PhyloSet
parseToPhyloSet (PhyloJSON o@{pd_data: Just p, pd_config: Just c}) = Just $ PhyloSet
{ corpusId : o.pd_corpusId
, listId : o.pd_listId
, phyloData : PhyloData
......@@ -91,9 +91,6 @@ parseToPhyloSet (PhyloJSON o) = PhyloSet
}
where
p = o.pd_data
c = o.pd_config
epochTS = p.phyloTimeScale == "epoch"
ancestorLinks = parseAncestorLinks p.edges
......@@ -102,6 +99,7 @@ parseToPhyloSet (PhyloJSON o) = PhyloSet
groups = parseGroups epochTS p.objects
links = parseLinks p.edges
periods = parsePeriods epochTS p.objects
parseToPhyloSet _ = Nothing
----------------------------------------------------------------------
......
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