All files / ee/app/assets/javascripts/on_demand_scans/components empty_state.vue

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

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  6x 6x 6x                                                             4x         4x 3x 3x     4x                 40x                      
<script>
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
import { s__ } from '~/locale';
import { HELP_PAGE_PATH } from '../constants';
 
export default {
  HELP_PAGE_PATH,
  components: {
    GlEmptyState,
    GlSprintf,
    GlLink,
  },
  inject: ['newDastScanPath', 'emptyStateSvgPath'],
  props: {
    title: {
      type: String,
      required: false,
      default: s__('OnDemandScans|On-demand scans'),
    },
    text: {
      type: String,
      required: false,
      default: s__(
        'OnDemandScans|On-demand scans run outside of DevOps cycle and find vulnerabilities in your projects. %{learnMoreLinkStart}Learn more%{learnMoreLinkEnd}.',
      ),
    },
    noPrimaryButton: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  computed: {
    emptyStateProps() {
      const props = {
        title: this.title,
        svgPath: this.emptyStateSvgPath,
      };
 
      if (!this.noPrimaryButton) {
        props.primaryButtonText = this.$options.i18n.primaryButtonText;
        props.primaryButtonLink = this.newDastScanPath;
      }
 
      return props;
    },
  },
  i18n: {
    primaryButtonText: s__('OnDemandScans|New DAST scan'),
  },
};
</script>
 
<template>
  <gl-empty-state v-bind="emptyStateProps">
    <template #description>
      <gl-sprintf :message="text">
        <template #learnMoreLink="{ content }">
          <gl-link :href="$options.HELP_PAGE_PATH">{{ content }}</gl-link>
        </template>
      </gl-sprintf>
    </template>
  </gl-empty-state>
</template>