diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-11-19 10:38:07 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-11-21 21:57:11 +0300 |
commit | 46d2b4307a3f9e3943205f1c7107c9a3abd6ac6c (patch) | |
tree | 981a4e767e8e5602a6ce789b339ca2e13d7ff372 /app/assets/javascripts/cycle_analytics | |
parent | 1a7cc190b734731f936c9aa067bf5ac2d46ef2c6 (diff) |
Add view to handle the case when user doesn’t have access to stage
Diffstat (limited to 'app/assets/javascripts/cycle_analytics')
-rw-r--r-- | app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 | 1 |
2 files changed, 8 insertions, 1 deletions
diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js index bb67dd429e2..0a20708dee9 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_bundle.js @@ -76,12 +76,18 @@ $(() => { }); }, selectDefaultStage() { - this.selectStage(this.state.stages.first()); + const stage = this.state.stages.first(); + this.selectStage(stage); }, selectStage(stage) { if (this.isLoadingStage) return; if (this.currentStage === stage) return; + if (!stage.isUserAllowed) { + cycleAnalyticsStore.setActiveStage(stage); + return; + } + this.isLoadingStage = true; cycleAnalyticsStore.setStageEvents([]); cycleAnalyticsStore.setActiveStage(stage); diff --git a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 index 64c24f71b87..b4815338622 100644 --- a/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 +++ b/app/assets/javascripts/cycle_analytics/cycle_analytics_store.js.es6 @@ -25,6 +25,7 @@ newData.stages.forEach((item) => { item.active = false; + item.isUserAllowed = true; // This should come from server item.component = `stage-${item.title.toLowerCase()}-component`; }); |