From 820dcfd728b3c9b23b0cbc248e4c148f9fdfc1c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Thu, 27 Jul 2017 18:45:44 +0100 Subject: [PATCH] feat(cp-frontend): transitional states as disabled card --- .../src/components/services/list-item.js | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/packages/cp-frontend/src/components/services/list-item.js b/packages/cp-frontend/src/components/services/list-item.js index e2719b7b..48efcb9a 100644 --- a/packages/cp-frontend/src/components/services/list-item.js +++ b/packages/cp-frontend/src/components/services/list-item.js @@ -2,6 +2,9 @@ import React from 'react'; import PropTypes from 'prop-types'; import styled from 'styled-components'; +import { InstancesIcon, HealthyIcon, UnhealthyIcon } from 'joyent-ui-toolkit'; +import Status from './status'; + import { Card, CardView, @@ -15,10 +18,6 @@ import { Anchor } from 'joyent-ui-toolkit'; -import { InstancesIcon, HealthyIcon, UnhealthyIcon } from 'joyent-ui-toolkit'; - -import Status from './status'; - const StyledCardHeader = styled(CardHeader)` position: relative; `; @@ -36,7 +35,7 @@ const ServiceListItem = ({ service = {}, isChild = false }) => { - const isServiceActive = service.status === 'ACTIVE'; + const isServiceInactive = service.status !== 'ACTIVE'; const children = service.children ? service.children.map(service => @@ -57,7 +56,7 @@ const ServiceListItem = ({ : - + {service.name} @@ -81,10 +80,6 @@ const ServiceListItem = ({ ) : service.instances.length; - const options = isServiceActive - ? - : null; - const header = !isChild ? {title} @@ -95,26 +90,28 @@ const ServiceListItem = ({ label={`${instancesCount} ${instancesCount > 1 ? 'instances' : 'instance'}`} - color="light" + color={isServiceInactive ? 'disabled' : 'light'} /> - {options} + : null; - const healthyInfo = service.instancesHealthy - ? } - iconPosition="left" - label="Healthy" - color="dark" - /> - : } - iconPosition="left" - label="Unhealthy" - color="dark" - />; + const healthyInfo = isServiceInactive + ? null + : service.instancesHealthy + ? } + iconPosition="left" + label="Healthy" + color="dark" + /> + : } + iconPosition="left" + label="Unhealthy" + color="dark" + />; const view = children ? @@ -132,6 +129,7 @@ const ServiceListItem = ({ return (