Skip to content

Commit

Permalink
Fix color for crit vs warn vs green progress bars
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscareycode committed Aug 10, 2019
1 parent 302d174 commit 056c047
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/hosts/HostItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ class HostItem extends Component {
Comment: <span className="comment-color">({this.props.comment_author}): {formatDateTimeAgo(this.props.comment_entry_time)} {translate('ago', language)} - {this.props.comment}</span>
</div>}

<Progress seconds={secondsToNextCheck}></Progress>
<Progress seconds={secondsToNextCheck} color={hostTextClass(e.status)}></Progress>
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/services/ServiceItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ServiceItem extends Component {
Comment: <span className="comment-color">({this.props.comment_author}): {formatDateTimeAgo(this.props.comment_entry_time)} ago - {this.props.comment}</span>
</div>}

<Progress seconds={secondsToNextCheck}></Progress>
<Progress seconds={secondsToNextCheck} color={serviceTextClass(e.status)}></Progress>

</div>

Expand Down
12 changes: 11 additions & 1 deletion src/components/widgets/Progress.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@
position: absolute;
bottom: 0px;
left: 0;
background-color: lime;
background-color: gray;
width: 100%;
/*transition: width 15s linear;*/
opacity: 0.5;
}

.Progress .progress-bar.color-yellow {
background-color: yellow;
}
.Progress .progress-bar.color-red {
background-color: pink;
}
.Progress .progress-bar.color-green {
background-color: lime;
}
4 changes: 2 additions & 2 deletions src/components/widgets/Progress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Progress extends Component {
shouldComponentUpdate(nextProps, nextState) {
//console.log('shouldComponentUpdate', nextProps, nextState);

if (nextProps.seconds <= 0 && this.state.started === true) {
if (nextProps.seconds < 0 && this.state.started === true) {
this.setState({ started: false });
//return true;
}
Expand Down Expand Up @@ -67,7 +67,7 @@ class Progress extends Component {

return (
<div className="Progress progress">
<div className="progress-bar" style={progressStyle}></div>
<div className={`progress-bar ${this.props.color}`} style={progressStyle}></div>
</div>
);
}
Expand Down

0 comments on commit 056c047

Please sign in to comment.