VSA Handle VSD link 403 error from project
The following discussion from !136207 (merged) should be addressed:
-
@ekigbo started a discussion: (+2 comments) One question, should we also hide the link to the VSD? Clicking on it with a user that does not have enough permissions gives me a 403 error.
If we need to, we could do that with something like:
diff --git a/app/assets/javascripts/analytics/shared/components/value_stream_metrics.vue b/app/assets/javascripts/analytics/shared/components/value_stream_metrics.vue index 3082897af766..56cc9bde3782 100644 --- a/app/assets/javascripts/analytics/shared/components/value_stream_metrics.vue +++ b/app/assets/javascripts/analytics/shared/components/value_stream_metrics.vue @@ -59,6 +59,11 @@ export default { required: false, default: null, }, + canViewDashboards: { + type: Boolean, + required: false, + default: false, + }, }, data() { return { @@ -85,7 +90,7 @@ export default { methods: { shouldDisplayDashboardLink(index) { // When we have groups of metrics, we should only display the link for the first group - return index === 0 && this.dashboardsPath; + return Boolean(this.canViewDashboards && index === 0 && this.dashboardsPath); }, fetchData() { removeFlash(); diff --git a/ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue b/ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue index 7cedeaf0a847..332828d16647 100644 --- a/ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue +++ b/ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue @@ -280,6 +280,7 @@ export default { :requests="$options.METRICS_REQUESTS" :group-by="$options.VSA_METRICS_GROUPS" :dashboards-path="dashboardsPath" + :can-view-dashboards="shouldEnableEditing" /> <div :class="[isOverviewStageSelected ? 'gl-mt-2' : 'gl-mt-6']"> <duration-overview-chart v-if="isOverviewStageSelected" class="gl-mb-6" />