2019-09-30 21:06:41 +00:00
|
|
|
<script>
|
2021-09-09 09:11:16 +00:00
|
|
|
import { GlPopover, GlSafeHtmlDirective } from '@gitlab/ui';
|
2019-12-10 09:07:51 +00:00
|
|
|
import { glEmojiTag } from '~/emoji';
|
2019-09-30 21:06:41 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
GlPopover,
|
|
|
|
},
|
2021-09-09 09:11:16 +00:00
|
|
|
directives: {
|
|
|
|
SafeHtml: GlSafeHtmlDirective,
|
|
|
|
},
|
2019-09-30 21:06:41 +00:00
|
|
|
props: {
|
|
|
|
htmlId: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
warnings: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
hasWarnings() {
|
|
|
|
return this.warnings && this.warnings.length;
|
|
|
|
},
|
|
|
|
warningMessage() {
|
|
|
|
if (!this.hasWarnings) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.warnings.join('\n');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
glEmojiTag,
|
|
|
|
},
|
2021-09-09 09:11:16 +00:00
|
|
|
safeHtmlConfig: { ADD_TAGS: ['gl-emoji'] },
|
2019-09-30 21:06:41 +00:00
|
|
|
};
|
|
|
|
</script>
|
|
|
|
<template>
|
2021-04-10 00:09:11 +00:00
|
|
|
<span v-if="hasWarnings" class="gl-cursor-default">
|
2021-09-09 09:11:16 +00:00
|
|
|
<span :id="htmlId" v-safe-html:[$options.safeHtmlConfig]="glEmojiTag('warning')"></span>
|
2021-04-10 00:09:11 +00:00
|
|
|
<gl-popover placement="bottom" :target="htmlId" :content="warningMessage" />
|
2019-09-30 21:06:41 +00:00
|
|
|
</span>
|
|
|
|
</template>
|