2020-01-30 13:08:57 -05:00
|
|
|
<script>
|
2021-06-24 14:07:15 -04:00
|
|
|
import { GlAlert, GlSafeHtmlDirective as SafeHtml } from '@gitlab/ui';
|
2020-01-30 13:08:57 -05:00
|
|
|
|
|
|
|
export default {
|
2021-06-24 14:07:15 -04:00
|
|
|
name: 'DismissibleAlert',
|
2020-01-30 13:08:57 -05:00
|
|
|
components: {
|
|
|
|
GlAlert,
|
|
|
|
},
|
2021-06-24 14:07:15 -04:00
|
|
|
directives: {
|
|
|
|
SafeHtml,
|
|
|
|
},
|
2020-01-30 13:08:57 -05:00
|
|
|
props: {
|
|
|
|
html: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isDismissed: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
dismiss() {
|
|
|
|
this.isDismissed = true;
|
2021-12-18 07:13:19 -05:00
|
|
|
this.$emit('alertDismissed');
|
2020-01-30 13:08:57 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
|
2021-06-24 14:07:15 -04:00
|
|
|
<div v-safe-html="html"></div>
|
2020-01-30 13:08:57 -05:00
|
|
|
</gl-alert>
|
|
|
|
</template>
|