summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/incidents/components/incidents_list.vue
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/incidents/components/incidents_list.vue')
-rw-r--r--app/assets/javascripts/incidents/components/incidents_list.vue11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/assets/javascripts/incidents/components/incidents_list.vue b/app/assets/javascripts/incidents/components/incidents_list.vue
index 4d34daa43ba..37597da3c8e 100644
--- a/app/assets/javascripts/incidents/components/incidents_list.vue
+++ b/app/assets/javascripts/incidents/components/incidents_list.vue
@@ -125,6 +125,7 @@ export default {
'authorUsernameQuery',
'assigneeUsernameQuery',
'slaFeatureAvailable',
+ 'canCreateIncident',
],
apollo: {
incidents: {
@@ -230,13 +231,16 @@ export default {
},
emptyStateData() {
const {
- emptyState: { title, emptyClosedTabTitle, description },
+ emptyState: { title, emptyClosedTabTitle, description, cannotCreateIncidentDescription },
createIncidentBtnLabel,
} = this.$options.i18n;
if (this.activeClosedTabHasNoIncidents) {
return { title: emptyClosedTabTitle };
}
+ if (!this.canCreateIncident) {
+ return { title, description: cannotCreateIncidentDescription };
+ }
return {
title,
description,
@@ -244,6 +248,9 @@ export default {
btnText: createIncidentBtnLabel,
};
},
+ isHeaderButtonVisible() {
+ return this.canCreateIncident && (!this.isEmpty || this.activeClosedTabHasNoIncidents);
+ },
},
methods: {
hasAssignees(assignees) {
@@ -311,7 +318,7 @@ export default {
>
<template #header-actions>
<gl-button
- v-if="!isEmpty || activeClosedTabHasNoIncidents"
+ v-if="isHeaderButtonVisible"
class="gl-my-3 gl-mr-5 create-incident-button"
data-testid="createIncidentBtn"
data-qa-selector="create_incident_button"