diff options
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/issuable')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/issuable/init_issuable_header_warning.js | 12 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/issuable/issuable_header_warnings.vue | 43 |
2 files changed, 55 insertions, 0 deletions
diff --git a/app/assets/javascripts/vue_shared/components/issuable/init_issuable_header_warning.js b/app/assets/javascripts/vue_shared/components/issuable/init_issuable_header_warning.js new file mode 100644 index 00000000000..18bfcc268dc --- /dev/null +++ b/app/assets/javascripts/vue_shared/components/issuable/init_issuable_header_warning.js @@ -0,0 +1,12 @@ +import Vue from 'vue'; +import IssuableHeaderWarnings from './issuable_header_warnings.vue'; + +export default function issuableHeaderWarnings(store) { + return new Vue({ + el: document.getElementById('js-issuable-header-warnings'), + store, + render(createElement) { + return createElement(IssuableHeaderWarnings); + }, + }); +} diff --git a/app/assets/javascripts/vue_shared/components/issuable/issuable_header_warnings.vue b/app/assets/javascripts/vue_shared/components/issuable/issuable_header_warnings.vue new file mode 100644 index 00000000000..37995b434c4 --- /dev/null +++ b/app/assets/javascripts/vue_shared/components/issuable/issuable_header_warnings.vue @@ -0,0 +1,43 @@ +<script> +import { mapGetters } from 'vuex'; +import { GlIcon } from '@gitlab/ui'; + +export default { + components: { + GlIcon, + }, + 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', + }, + ]; + }, + }, +}; +</script> + +<template> + <div class="gl-display-inline-block"> + <template v-for="meta in warningIconsMeta"> + <div v-if="meta.visible" :key="meta.iconName" class="issuable-warning-icon inline"> + <gl-icon :name="meta.iconName" :data-testid="meta.dataTestId" class="icon" /> + </div> + </template> + </div> +</template> |