diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-11-18 13:16:36 +0000 |
commit | 311b0269b4eb9839fa63f80c8d7a58f32b8138a0 (patch) | |
tree | 07e7870bca8aed6d61fdcc810731c50d2c40af47 /app/assets/javascripts/incidents | |
parent | 27909cef6c4170ed9205afa7426b8d3de47cbb0c (diff) | |
download | gitlab-ce-311b0269b4eb9839fa63f80c8d7a58f32b8138a0.tar.gz |
Add latest changes from gitlab-org/gitlab@14-5-stable-eev14.5.0-rc42
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 | 4 |
3 files changed, 16 insertions, 4 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 6e6461cd7a9..1d40f1093a4 100644 --- a/app/assets/javascripts/incidents/list.js +++ b/app/assets/javascripts/incidents/list.js @@ -21,10 +21,11 @@ export default () => { authorUsernameQuery, assigneeUsernameQuery, slaFeatureAvailable, + canCreateIncident, } = domEl.dataset; const apolloProvider = new VueApollo({ - defaultClient: createDefaultClient({}, { assumeImmutableResults: true }), + defaultClient: createDefaultClient(), }); return new Vue({ @@ -44,6 +45,7 @@ export default () => { authorUsernameQuery, assigneeUsernameQuery, slaFeatureAvailable: parseBoolean(slaFeatureAvailable), + canCreateIncident: parseBoolean(canCreateIncident), }, apolloProvider, render(createElement) { |