Skip to content

Commit

Permalink
Refactored details health items to prepare for grouping
Browse files Browse the repository at this point in the history
  • Loading branch information
davkal authored and paulbellamy committed Dec 17, 2015
1 parent 4ba0a9e commit ab97e1f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';

import Sparkline from '../sparkline';
import { formatMetric } from '../../utils/string-utils';

export default class NodeDetailsHealth extends React.Component {
render() {
return (
<div className="node-details-health-item">
<div className="node-details-health-item-value">{formatMetric(this.props.item.value, this.props.item)}</div>
<div className="node-details-health-item-sparkline">
<Sparkline data={this.props.item.samples} min={0} max={this.props.item.max}
first={this.props.item.first} last={this.props.item.last} interpolate="none" />
</div>
<div className="node-details-health-item-label">{this.props.item.label}</div>
</div>
);
}
}
16 changes: 3 additions & 13 deletions client/app/scripts/components/node-details/node-details-health.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
import React from 'react';

import Sparkline from '../sparkline';
import { formatMetric } from '../../utils/string-utils';
import NodeDetailsHealthItem from './node-details-health-item';

export default class NodeDetailsHealth extends React.Component {
render() {
return (
<div className="node-details-health">
{this.props.metrics && this.props.metrics.map(field => {
return (
<div className="node-details-health-field" key={field.id}>
<div className="node-details-health-field-value">{formatMetric(field.value, field)}</div>
<div className="node-details-health-field-sparkline">
<Sparkline data={field.samples} min={0} max={field.max}
first={field.first} last={field.last} interpolate="none" />
</div>
<div className="node-details-health-field-label">{field.label}</div>
</div>
);
{this.props.metrics && this.props.metrics.map(item => {
return <NodeDetailsHealthItem key={item.id} item={item} />;
})}
</div>
);
Expand Down
11 changes: 7 additions & 4 deletions client/app/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -538,11 +538,11 @@ h2 {
justify-content: space-around;
text-align: center;

&-field {
&-item {
&-label {
color: @text-tertiary-color;
color: @text-secondary-color;
text-transform: uppercase;
font-size: 90%;
font-size: 80%;
}

&-value {
Expand All @@ -558,13 +558,16 @@ h2 {

&-field {
display: flex;
align-items: baseline;

&-label {
text-align: right;
width: 6em;
width: 10em;
color: @text-secondary-color;
padding: 0 0.5em 0 0;
white-space: nowrap;
text-transform: uppercase;
font-size: 80%;

&::after {
content: ':';
Expand Down

0 comments on commit ab97e1f

Please sign in to comment.