diff options
author | Brandon Labuschagne <blabuschagne@gitlab.com> | 2019-07-10 08:52:57 +0200 |
---|---|---|
committer | Brandon Labuschagne <blabuschagne@gitlab.com> | 2019-07-12 11:42:45 +0200 |
commit | e3cf7f50898e8c2df7c5938e8e7ff289d71c9949 (patch) | |
tree | 6b9dcab1d5ee01a82376b1ff72f23f38b76cb221 | |
parent | 453187906246631d3ceae2165bbb8b525b1c2e27 (diff) | |
download | gitlab-ce-prepare-cycle-analytics-to-run-concurrently-ce.tar.gz |
Prevent errors when CA has no dataprepare-cycle-analytics-to-run-concurrently-ce
-rw-r--r-- | app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js index b56e08175cc..d4b994d4922 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js @@ -17,6 +17,7 @@ Vue.use(Translate); export default () => { const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed'; + const cycleAnalyticsEl = document.querySelector('#cycle-analytics'); // eslint-disable-next-line no-new new Vue({ @@ -33,7 +34,6 @@ export default () => { 'stage-production-component': stageComponent, }, data() { - const cycleAnalyticsEl = document.querySelector('#cycle-analytics'); const cycleAnalyticsService = new CycleAnalyticsService({ requestPath: cycleAnalyticsEl.dataset.requestPath, }); @@ -56,7 +56,13 @@ export default () => { }, }, created() { - this.fetchCycleAnalyticsData(); + // Conditional check placed here to prevent this method from being called on the + // new Cycle Analytics page (i.e. the new page will be initialized blank and only + // after a group is selected the cycle analyitcs data will be fetched). Once the + // old (current) page has been removed this entire created method as well as the + // variable itself can be completely removed. + // Follow up issue: https://gitlab.com/gitlab-org/gitlab-ce/issues/64490 + if (cycleAnalyticsEl.dataset.requestPath) this.fetchCycleAnalyticsData(); }, methods: { handleError() { |