diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-10 00:10:00 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-10 00:10:00 +0300 |
commit | e1b5604609766f635f5029382ea018c612aa3186 (patch) | |
tree | fff466ae7fdf9edf47f84f539995292909ce8f94 /app/assets/javascripts/incidents | |
parent | efcaec8a140e2b93d1f43d5afd7a5c35cdd4dad7 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/incidents')
-rw-r--r-- | app/assets/javascripts/incidents/components/incidents_list.vue | 11 | ||||
-rw-r--r-- | app/assets/javascripts/incidents/constants.js | 5 | ||||
-rw-r--r-- | app/assets/javascripts/incidents/list.js | 2 |
3 files changed, 15 insertions, 3 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" diff --git a/app/assets/javascripts/incidents/constants.js b/app/assets/javascripts/incidents/constants.js index b82980b5628..23909ae3b6c 100644 --- a/app/assets/javascripts/incidents/constants.js +++ b/app/assets/javascripts/incidents/constants.js @@ -11,7 +11,10 @@ export const I18N = { title: s__('IncidentManagement|Display your incidents in a dedicated view'), emptyClosedTabTitle: s__('IncidentManagement|There are no closed incidents'), description: s__( - 'IncidentManagement|All alerts promoted to incidents will automatically be displayed within the list. You can also create a new incident using the button below.', + 'IncidentManagement|All alerts promoted to incidents are automatically displayed within the list. You can also create a new incident using the button below.', + ), + cannotCreateIncidentDescription: s__( + 'IncidentManagement|All alerts promoted to incidents are automatically displayed within the list.', ), }, }; diff --git a/app/assets/javascripts/incidents/list.js b/app/assets/javascripts/incidents/list.js index 8644ff3a249..1d40f1093a4 100644 --- a/app/assets/javascripts/incidents/list.js +++ b/app/assets/javascripts/incidents/list.js @@ -21,6 +21,7 @@ export default () => { authorUsernameQuery, assigneeUsernameQuery, slaFeatureAvailable, + canCreateIncident, } = domEl.dataset; const apolloProvider = new VueApollo({ @@ -44,6 +45,7 @@ export default () => { authorUsernameQuery, assigneeUsernameQuery, slaFeatureAvailable: parseBoolean(slaFeatureAvailable), + canCreateIncident: parseBoolean(canCreateIncident), }, apolloProvider, render(createElement) { |