style(cp-frontend): format

This commit is contained in:
Sérgio Ramos 2017-08-30 12:17:21 +01:00
parent 441d4118d7
commit 468604058e
4 changed files with 32 additions and 13 deletions

View File

@ -11,7 +11,10 @@ export const MetricNames = [
export const withServiceMetricsPolling = ({ export const withServiceMetricsPolling = ({
pollingInterval = 1000, // in milliseconds pollingInterval = 1000, // in milliseconds
getPreviousEnd = () => moment().utc().format() getPreviousEnd = () =>
moment()
.utc()
.format()
}) => { }) => {
return WrappedComponent => { return WrappedComponent => {
return class extends Component { return class extends Component {
@ -68,12 +71,15 @@ export const withServiceMetricsGql = ({
...instance, ...instance,
metrics: instance.metrics.map(metric => ({ metrics: instance.metrics.map(metric => ({
...metric, ...metric,
metrics: uniqBy(getPreviousMetrics( metrics: uniqBy(
previousResult, getPreviousMetrics(
service.id, previousResult,
instance.id, service.id,
metric.name instance.id,
).concat(metric.metrics), 'time') metric.name
).concat(metric.metrics),
'time'
)
})) }))
})) }))
})) }))

View File

@ -77,7 +77,13 @@ export default compose(
return false; return false;
} }
return get(service, 'instances[0].metrics[0].end', moment().utc().format()); return get(
service,
'instances[0].metrics[0].end',
moment()
.utc()
.format()
);
} }
}), }),
withNotFound([GqlPaths.DEPLOYMENT_GROUP, GqlPaths.SERVICES]) withNotFound([GqlPaths.DEPLOYMENT_GROUP, GqlPaths.SERVICES])

View File

@ -110,9 +110,7 @@ export class ServiceList extends Component {
? 'An error occurred while attempting to restart your service.' ? 'An error occurred while attempting to restart your service.'
: ''; : '';
renderedError = ( renderedError = <ErrorMessage title="Ooops!" message={message} />;
<ErrorMessage title="Ooops!" message={message} />
);
} }
const serviceList = sortBy(services, ['slug']) const serviceList = sortBy(services, ['slug'])
@ -191,7 +189,12 @@ export default compose(
.filter(Boolean) .filter(Boolean)
.shift(); .shift();
return previousEnd || moment().utc().format(); return (
previousEnd ||
moment()
.utc()
.format()
);
} }
}), }),
UiConnect, UiConnect,

View File

@ -58,7 +58,11 @@ const GraphNodeInfo = ({ data, pos }) => {
)) ))
); );
const healthy = <HealthyIcon healthy={instancesHealthy.total === instancesHealthy.healthy} />; const healthy = (
<HealthyIcon
healthy={instancesHealthy.total === instancesHealthy.healthy}
/>
);
return ( return (
<g transform={`translate(${x}, ${y})`}> <g transform={`translate(${x}, ${y})`}>