diff options
Diffstat (limited to 'app/assets/javascripts/ci_secure_files/components/metadata/button.vue')
-rw-r--r-- | app/assets/javascripts/ci_secure_files/components/metadata/button.vue | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/app/assets/javascripts/ci_secure_files/components/metadata/button.vue b/app/assets/javascripts/ci_secure_files/components/metadata/button.vue new file mode 100644 index 00000000000..799c6ec79d4 --- /dev/null +++ b/app/assets/javascripts/ci_secure_files/components/metadata/button.vue @@ -0,0 +1,54 @@ +<script> +import { GlButton, GlModalDirective, GlTooltipDirective } from '@gitlab/ui'; +import { __ } from '~/locale'; + +export default { + components: { + GlButton, + }, + directives: { + GlTooltip: GlTooltipDirective, + GlModal: GlModalDirective, + }, + props: { + secureFile: { + type: Object, + required: true, + }, + admin: { + type: Boolean, + required: true, + }, + modalId: { + type: String, + required: true, + }, + }, + i18n: { + metadataLabel: __('View File Metadata'), + }, + metadataModalId: 'metadataModalId', + methods: { + selectSecureFile() { + this.$emit('selectSecureFile', this.secureFile); + }, + hasMetadata() { + return this.secureFile.metadata !== null; + }, + }, +}; +</script> + +<template> + <gl-button + v-if="admin && hasMetadata()" + v-gl-modal="modalId" + v-gl-tooltip.hover.top="$options.i18n.metadataLabel" + category="secondary" + variant="info" + icon="doc-text" + :aria-label="$options.i18n.metadataLabel" + data-testid="metadata-button" + @click="selectSecureFile()" + /> +</template> |