Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 2x 9x 9x 5x 4x 4x 4x 1x | <script> import { GlAlert, GlLoadingIcon } from '@gitlab/ui'; // eslint-disable-next-line no-restricted-imports import { mapActions } from 'vuex'; import SafeHtml from '~/vue_shared/directives/safe_html'; export default { components: { GlAlert, GlLoadingIcon, }, directives: { SafeHtml, }, props: { message: { type: Object, required: true, }, }, data() { return { isLoading: false, }; }, computed: { canDismiss() { return !this.message.action; }, }, methods: { ...mapActions(['setErrorMessage']), doAction() { if (this.isLoading) return; this.isLoading = true; this.message .action(this.message.actionPayload) .then(() => { this.isLoading = false; }) .catch(() => { this.isLoading = false; }); }, dismiss() { this.setErrorMessage(null); }, }, }; </script> <template> <gl-alert variant="danger" :dismissible="canDismiss" :primary-button-text="message.actionText" @dismiss="dismiss" @primaryAction="doAction" > <span v-safe-html="message.text"></span> <gl-loading-icon v-show="isLoading" size="sm" inline class="vertical-align-middle ml-1" /> </gl-alert> </template> |