debian-mirror-gitlab/app/assets/javascripts/issuable/components/issuable_header_warnings.vue

62 lines
1.4 KiB
Vue
Raw Normal View History

2020-10-24 23:57:45 +05:30
<script>
2021-11-11 11:23:49 +05:30
import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mapGetters } from 'vuex';
2021-11-11 11:23:49 +05:30
import { __ } from '~/locale';
2020-10-24 23:57:45 +05:30
export default {
components: {
GlIcon,
},
2021-11-11 11:23:49 +05:30
directives: {
GlTooltip: GlTooltipDirective,
},
inject: ['hidden'],
2020-10-24 23:57:45 +05:30
computed: {
...mapGetters(['getNoteableData']),
isLocked() {
return this.getNoteableData.discussion_locked;
},
isConfidential() {
return this.getNoteableData.confidential;
},
warningIconsMeta() {
return [
{
iconName: 'lock',
visible: this.isLocked,
dataTestId: 'locked',
},
{
iconName: 'eye-slash',
visible: this.isConfidential,
dataTestId: 'confidential',
},
2021-11-11 11:23:49 +05:30
{
iconName: 'spam',
visible: this.hidden,
dataTestId: 'hidden',
tooltip: __('This issue is hidden because its author has been banned'),
},
2020-10-24 23:57:45 +05:30
];
},
},
};
</script>
<template>
<div class="gl-display-inline-block">
<template v-for="meta in warningIconsMeta">
2021-11-11 11:23:49 +05:30
<div
v-if="meta.visible"
:key="meta.iconName"
v-gl-tooltip
:data-testid="meta.dataTestId"
:title="meta.tooltip || null"
class="issuable-warning-icon inline"
>
<gl-icon :name="meta.iconName" class="icon" />
2020-10-24 23:57:45 +05:30
</div>
</template>
</div>
</template>