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

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

77 lines
2 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';
2022-07-16 23:28:13 +05:30
import { IssuableType, WorkspaceType } from '~/issues/constants';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import ConfidentialityBadge from '~/vue_shared/components/confidentiality_badge.vue';
2020-10-24 23:57:45 +05:30
export default {
2022-07-16 23:28:13 +05:30
WorkspaceType,
IssuableType,
2020-10-24 23:57:45 +05:30
components: {
GlIcon,
2022-07-16 23:28:13 +05:30
ConfidentialityBadge,
2020-10-24 23:57:45 +05:30
},
2021-11-11 11:23:49 +05:30
directives: {
GlTooltip: GlTooltipDirective,
},
2022-07-16 23:28:13 +05:30
mixins: [glFeatureFlagMixin()],
2021-11-11 11:23:49 +05:30
inject: ['hidden'],
2020-10-24 23:57:45 +05:30
computed: {
...mapGetters(['getNoteableData']),
isLocked() {
return this.getNoteableData.discussion_locked;
},
isConfidential() {
return this.getNoteableData.confidential;
},
2022-07-16 23:28:13 +05:30
isMergeRequest() {
2022-07-23 23:45:48 +05:30
return this.getNoteableData.targetType === 'merge_request';
2022-07-16 23:28:13 +05:30
},
2020-10-24 23:57:45 +05:30
warningIconsMeta() {
return [
{
iconName: 'lock',
visible: this.isLocked,
dataTestId: 'locked',
},
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">
2022-07-16 23:28:13 +05:30
<confidentiality-badge
v-if="isConfidential"
data-testid="confidential"
:workspace-type="$options.WorkspaceType.project"
:issuable-type="$options.IssuableType.Issue"
/>
2020-10-24 23:57:45 +05:30
<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"
2022-07-16 23:28:13 +05:30
:class="{
'gl-mr-3 gl-mt-2 gl-display-flex gl-justify-content-center gl-align-items-center': isMergeRequest,
'gl-display-inline-block': !isMergeRequest,
}"
class="issuable-warning-icon"
2021-11-11 11:23:49 +05:30
>
<gl-icon :name="meta.iconName" class="icon" />
2020-10-24 23:57:45 +05:30
</div>
</template>
</div>
</template>