Commit 158f3189 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'prepare-cycle-analytics-to-run-concurrently-ce' into 'master'

Prevent errors when CA has no data

See merge request gitlab-org/gitlab-ce!30556
parents cb0edce2 ac7a2f1b
...@@ -17,6 +17,7 @@ Vue.use(Translate); ...@@ -17,6 +17,7 @@ Vue.use(Translate);
export default () => { export default () => {
const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed'; const OVERVIEW_DIALOG_COOKIE = 'cycle_analytics_help_dismissed';
const cycleAnalyticsEl = document.querySelector('#cycle-analytics');
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new Vue({ new Vue({
...@@ -33,7 +34,6 @@ export default () => { ...@@ -33,7 +34,6 @@ export default () => {
'stage-production-component': stageComponent, 'stage-production-component': stageComponent,
}, },
data() { data() {
const cycleAnalyticsEl = document.querySelector('#cycle-analytics');
const cycleAnalyticsService = new CycleAnalyticsService({ const cycleAnalyticsService = new CycleAnalyticsService({
requestPath: cycleAnalyticsEl.dataset.requestPath, requestPath: cycleAnalyticsEl.dataset.requestPath,
}); });
...@@ -56,7 +56,13 @@ export default () => { ...@@ -56,7 +56,13 @@ export default () => {
}, },
}, },
created() { 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: { methods: {
handleError() { handleError() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment