debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/dismissible_alert.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
659 B
Vue
Raw Normal View History

2020-03-13 15:44:24 +05:30
<script>
2023-03-04 22:38:38 +05:30
import { GlAlert } from '@gitlab/ui';
import SafeHtml from '~/vue_shared/directives/safe_html';
2020-03-13 15:44:24 +05:30
export default {
2021-09-30 23:02:18 +05:30
name: 'DismissibleAlert',
2020-03-13 15:44:24 +05:30
components: {
GlAlert,
},
2021-09-30 23:02:18 +05:30
directives: {
SafeHtml,
},
2020-03-13 15:44:24 +05:30
props: {
html: {
type: String,
required: false,
default: '',
},
},
data() {
return {
isDismissed: false,
};
},
methods: {
dismiss() {
this.isDismissed = true;
2022-01-26 12:08:38 +05:30
this.$emit('alertDismissed');
2020-03-13 15:44:24 +05:30
},
},
};
</script>
<template>
<gl-alert v-if="!isDismissed" v-bind="$attrs" @dismiss="dismiss" v-on="$listeners">
2021-09-30 23:02:18 +05:30
<div v-safe-html="html"></div>
2020-03-13 15:44:24 +05:30
</gl-alert>
</template>