feat(cp-frontend): only show GraphsContainer when metrics existent

This commit is contained in:
Sérgio Ramos 2017-08-30 16:47:10 +01:00
parent 8695a134d2
commit 9c4d69d586

View File

@ -179,7 +179,7 @@ const ServiceListItem = ({
); );
} }
const metrics = !children.length const graphs = !children.length && Object.keys(service.metrics).length
? Object.keys(service.metrics).map(key => ( ? Object.keys(service.metrics).map(key => (
<GraphContainer xs={4}> <GraphContainer xs={4}>
<GraphLeftShaddow /> <GraphLeftShaddow />
@ -193,6 +193,10 @@ const ServiceListItem = ({
)) ))
: null; : null;
const metrics = graphs ? (
<GraphsContainer>{graphs}</GraphsContainer>
) : null;
const view = children.length ? ( const view = children.length ? (
<CardGroupView>{childrenItems}</CardGroupView> <CardGroupView>{childrenItems}</CardGroupView>
) : ( ) : (
@ -202,7 +206,7 @@ const ServiceListItem = ({
<Status service={service} /> <Status service={service} />
<HealthInfoContainer>{healthyInfo}</HealthInfoContainer> <HealthInfoContainer>{healthyInfo}</HealthInfoContainer>
</StatusContainer> </StatusContainer>
<GraphsContainer>{metrics}</GraphsContainer> {metrics}
</ServiceView> </ServiceView>
); );