All files / app/assets/javascripts/packages_and_registries/package_registry/components/list package_title.vue

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

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      2x                                         55x     24x                                      
<script>
import { n__, s__ } from '~/locale';
import MetadataItem from '~/vue_shared/components/registry/metadata_item.vue';
import TitleArea from '~/vue_shared/components/registry/title_area.vue';
 
export default {
  name: 'PackageTitle',
  components: {
    TitleArea,
    MetadataItem,
  },
  props: {
    count: {
      type: Number,
      required: false,
      default: null,
    },
    helpUrl: {
      type: String,
      required: true,
    },
  },
  computed: {
    showPackageCount() {
      return Number.isInteger(this.count);
    },
    packageAmountText() {
      return n__(`%d Package`, `%d Packages`, this.count);
    },
  },
  i18n: {
    LIST_TITLE_TEXT: s__('PackageRegistry|Package Registry'),
  },
};
</script>
 
<template>
  <title-area :title="$options.i18n.LIST_TITLE_TEXT">
    <template #metadata-amount>
      <metadata-item v-if="showPackageCount" icon="package" :text="packageAmountText" />
    </template>
    <template #right-actions>
      <slot name="settings-link"></slot>
    </template>
  </title-area>
</template>