Skip to content

Commit

Permalink
#329 handle no results
Browse files Browse the repository at this point in the history
  • Loading branch information
prayerslayer committed Oct 27, 2015
1 parent f6a6a04 commit 38a2bf9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion client/lib/common/asset/less/common/datepicker.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
outline: none;
position: absolute;
background: white;
z-index: 10;
z-index: 20;
box-shadow: 0px 0px 10px @gray;

.DayPicker-Month {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@import "../variables";

.violation-analysis-empty {
text-align: center;
padding-top: @padding-small;
}

.violation-analysis {
padding-top: @padding-small;

Expand Down
17 changes: 13 additions & 4 deletions client/lib/violation/src/violation-analysis/violation-analysis.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import Icon from 'react-fa';
import moment from 'moment';
import _ from 'lodash';
import Charts from 'react-d3-components';
Expand Down Expand Up @@ -49,16 +50,18 @@ class ViolationAnalysis extends React.Component {

render() {
let searchParams = this.stores.fullstop.getSearchParams(),
violationCount = this.stores.fullstop
.getViolationCount()
.map(c => ({
violationCount = this.stores.fullstop.getViolationCount(),
chartData = [];

if (violationCount.length) {
violationCount = violationCount.map(c => ({
type: c.type,
typeHelp: this.stores.fullstop.getViolationType(c.type).help_text,
typeSeverity: this.stores.fullstop.getViolationType(c.type).violation_severity,
account: c.account,
accountName: this.stores.team.getAccount(c.account).name,
quantity: c.quantity
})),
}));
chartData = violationCount.filter(c => c.account === searchParams.inspectedAccount);

return <div className='violation-analysis'>
Expand Down Expand Up @@ -112,6 +115,12 @@ class ViolationAnalysis extends React.Component {
:
null}
</div>;
}

return <div className='violation-analysis-empty'>
<div><Icon name='smile-o' size='4x' /></div>
<span>No violations!</span>
</div>
}
}
ViolationAnalysis.displayName = 'ViolationAnalysis';
Expand Down

0 comments on commit 38a2bf9

Please sign in to comment.