All files / app/assets/javascripts/pipelines/components/pipelines_list pipelines_artifacts.vue

100% Statements 2/2
100% Branches 2/2
100% Functions 1/1
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80                  8x                                                                                 1663x                                                          
<script>
import {
  GlDropdown,
  GlDropdownItem,
  GlDropdownSectionHeader,
  GlTooltipDirective,
} from '@gitlab/ui';
import { __ } from '~/locale';
 
export const i18n = {
  artifacts: __('Artifacts'),
  artifactSectionHeader: __('Download artifacts'),
};
 
export default {
  i18n,
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  components: {
    GlDropdown,
    GlDropdownItem,
    GlDropdownSectionHeader,
  },
  inject: {
    artifactsEndpoint: {
      default: '',
    },
    artifactsEndpointPlaceholder: {
      default: '',
    },
  },
  props: {
    pipelineId: {
      type: Number,
      required: true,
    },
    artifacts: {
      type: Array,
      required: false,
      default: () => [],
    },
  },
  computed: {
    shouldShowDropdown() {
      return this.artifacts?.length;
    },
  },
};
</script>
<template>
  <gl-dropdown
    v-if="shouldShowDropdown"
    v-gl-tooltip
    class="build-artifacts js-pipeline-dropdown-download"
    :title="$options.i18n.artifacts"
    :text="$options.i18n.artifacts"
    :aria-label="$options.i18n.artifacts"
    icon="download"
    right
    lazy
    text-sr-only
  >
    <gl-dropdown-section-header>{{
      $options.i18n.artifactSectionHeader
    }}</gl-dropdown-section-header>
 
    <gl-dropdown-item
      v-for="(artifact, i) in artifacts"
      :key="i"
      :href="artifact.path"
      rel="nofollow"
      download
      class="gl-word-break-word"
    >
      {{ artifact.name }}
    </gl-dropdown-item>
  </gl-dropdown>
</template>