From 38a2bf9ffb19638f3b699bf5b34fb737688f8429 Mon Sep 17 00:00:00 2001 From: Nikolaus Piccolotto Date: Tue, 27 Oct 2015 11:57:18 +0100 Subject: [PATCH] #329 handle no results --- .../common/asset/less/common/datepicker.less | 2 +- .../less/violation/violation-analysis.less | 5 +++++ .../violation-analysis/violation-analysis.jsx | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/client/lib/common/asset/less/common/datepicker.less b/client/lib/common/asset/less/common/datepicker.less index 913df4f7..a9d6bd86 100644 --- a/client/lib/common/asset/less/common/datepicker.less +++ b/client/lib/common/asset/less/common/datepicker.less @@ -10,7 +10,7 @@ outline: none; position: absolute; background: white; - z-index: 10; + z-index: 20; box-shadow: 0px 0px 10px @gray; .DayPicker-Month { diff --git a/client/lib/common/asset/less/violation/violation-analysis.less b/client/lib/common/asset/less/violation/violation-analysis.less index d0495876..625166f9 100644 --- a/client/lib/common/asset/less/violation/violation-analysis.less +++ b/client/lib/common/asset/less/violation/violation-analysis.less @@ -1,5 +1,10 @@ @import "../variables"; +.violation-analysis-empty { + text-align: center; + padding-top: @padding-small; +} + .violation-analysis { padding-top: @padding-small; diff --git a/client/lib/violation/src/violation-analysis/violation-analysis.jsx b/client/lib/violation/src/violation-analysis/violation-analysis.jsx index 9ea28856..6fb814ca 100644 --- a/client/lib/violation/src/violation-analysis/violation-analysis.jsx +++ b/client/lib/violation/src/violation-analysis/violation-analysis.jsx @@ -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'; @@ -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
@@ -112,6 +115,12 @@ class ViolationAnalysis extends React.Component { : null}
; + } + + return
+
+ No violations! +
} } ViolationAnalysis.displayName = 'ViolationAnalysis';