From 1760c321db5f56e9856c0fe6e9f0eee767104fc0 Mon Sep 17 00:00:00 2001 From: Noelle Daley Date: Wed, 3 Jul 2019 13:52:56 -0700 Subject: [PATCH] Fix barchart bugs (#7063) * ensure dropdown works in storybook by handling Dates and strings * camelcase fix * ensure tooltip doesn't blink --- ui/app/components/http-requests-container.js | 4 ++-- ui/app/components/http-requests-dropdown.js | 7 ++++++- ui/app/styles/components/http-requests-bar-chart.scss | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/app/components/http-requests-container.js b/ui/app/components/http-requests-container.js index 4aff4c7ba4..f58b01fce8 100644 --- a/ui/app/components/http-requests-container.js +++ b/ui/app/components/http-requests-container.js @@ -34,9 +34,9 @@ export default Component.extend({ let filteredCounters = []; if (timeWindow === 'Last 12 Months') { const today = new Date(); - const TwelveMonthsAgo = addMonths(today, -12); + const twelveMonthsAgo = addMonths(today, -12); filteredCounters = counters.filter(counter => { - return isWithinRange(counter.start_time, TwelveMonthsAgo, today); + return isWithinRange(counter.start_time, twelveMonthsAgo, today); }); return filteredCounters; diff --git a/ui/app/components/http-requests-dropdown.js b/ui/app/components/http-requests-dropdown.js index db8e2e9bc8..7247c72961 100644 --- a/ui/app/components/http-requests-dropdown.js +++ b/ui/app/components/http-requests-dropdown.js @@ -27,7 +27,12 @@ export default Component.extend({ let counters = this.counters || []; let options = []; if (counters.length) { - const years = counters.map(counter => counter.start_time.substr(0, 4)).uniq(); + const years = counters + .map(counter => { + const year = new Date(counter.start_time); + return year.getUTCFullYear(); + }) + .uniq(); years.sort().reverse(); options = options.concat(years); } diff --git a/ui/app/styles/components/http-requests-bar-chart.scss b/ui/app/styles/components/http-requests-bar-chart.scss index 2c62196684..62570d1f9b 100644 --- a/ui/app/styles/components/http-requests-bar-chart.scss +++ b/ui/app/styles/components/http-requests-bar-chart.scss @@ -44,6 +44,7 @@ background: $grey; color: $ui-gray-010; border-radius: 2px; + pointer-events: none !important; } /* Creates a small triangle extender for the tooltip */