diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 18:08:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-04 18:08:40 +0300 |
commit | 6b833f1e0340e00fdee074da9c42c0d4e07a46d2 (patch) | |
tree | 6fc3a7a2f8a02fec8d1e7561b453d33eb4048dad /app/assets/javascripts/error_tracking | |
parent | 88a0824944720b6edaaef56376713541b9a02118 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/error_tracking')
-rw-r--r-- | app/assets/javascripts/error_tracking/components/error_details.vue | 35 | ||||
-rw-r--r-- | app/assets/javascripts/error_tracking/store/actions.js | 6 |
2 files changed, 37 insertions, 4 deletions
diff --git a/app/assets/javascripts/error_tracking/components/error_details.vue b/app/assets/javascripts/error_tracking/components/error_details.vue index 98fc121d39f..88861b7da0e 100644 --- a/app/assets/javascripts/error_tracking/components/error_details.vue +++ b/app/assets/javascripts/error_tracking/components/error_details.vue @@ -2,7 +2,15 @@ import { mapActions, mapGetters, mapState } from 'vuex'; import dateFormat from 'dateformat'; import createFlash from '~/flash'; -import { GlButton, GlFormInput, GlLink, GlLoadingIcon, GlBadge } from '@gitlab/ui'; +import { + GlButton, + GlFormInput, + GlLink, + GlLoadingIcon, + GlBadge, + GlAlert, + GlSprintf, +} from '@gitlab/ui'; import { __, sprintf, n__ } from '~/locale'; import LoadingButton from '~/vue_shared/components/loading_button.vue'; import Icon from '~/vue_shared/components/icon.vue'; @@ -26,6 +34,8 @@ export default { Icon, Stacktrace, GlBadge, + GlAlert, + GlSprintf, }, directives: { TrackEvent: TrackEventDirective, @@ -85,6 +95,8 @@ export default { return { GQLerror: null, issueCreationInProgress: false, + isAlertVisible: false, + closedIssueId: null, }; }, computed: { @@ -184,7 +196,14 @@ export default { onResolveStatusUpdate() { const status = this.errorStatus === errorStatus.RESOLVED ? errorStatus.UNRESOLVED : errorStatus.RESOLVED; - this.updateResolveStatus({ endpoint: this.issueUpdatePath, status }); + + // eslint-disable-next-line promise/catch-or-return + this.updateResolveStatus({ endpoint: this.issueUpdatePath, status }).then(res => { + this.closedIssueId = res.closed_issue_iid; + if (this.closedIssueId) { + this.isAlertVisible = true; + } + }); }, formatDate(date) { return `${this.timeFormatted(date)} (${dateFormat(date, 'UTC:yyyy-mm-dd h:MM:ssTT Z')})`; @@ -199,6 +218,18 @@ export default { <gl-loading-icon :size="3" /> </div> <div v-else-if="showDetails" class="error-details"> + <gl-alert v-if="isAlertVisible" @dismiss="isAlertVisible = false"> + <gl-sprintf + :message=" + __('The associated issue #%{issueId} has been closed as the error is now resolved.') + " + > + <template #issueId> + <span>{{ closedIssueId }}</span> + </template> + </gl-sprintf> + </gl-alert> + <div class="top-area align-items-center justify-content-between py-3"> <span v-if="!loadingStacktrace && stacktrace" v-html="reported"></span> <div class="d-inline-flex"> diff --git a/app/assets/javascripts/error_tracking/store/actions.js b/app/assets/javascripts/error_tracking/store/actions.js index 49fa5f3cec5..8f6f404ef8a 100644 --- a/app/assets/javascripts/error_tracking/store/actions.js +++ b/app/assets/javascripts/error_tracking/store/actions.js @@ -11,9 +11,11 @@ export const setStatus = ({ commit }, status) => { export const updateStatus = ({ commit }, { endpoint, redirectUrl, status }) => service .updateErrorStatus(endpoint, status) - .then(() => { - if (redirectUrl) visitUrl(redirectUrl); + .then(resp => { commit(types.SET_ERROR_STATUS, status); + if (redirectUrl) visitUrl(redirectUrl); + + return resp.data.result; }) .catch(() => createFlash(__('Failed to update issue status'))); |