All files / app/assets/javascripts/security_configuration/components upgrade_banner.vue

100% Statements 9/9
100% Branches 0/0
100% Functions 4/4
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  2x 2x 2x   2x 2x                                               5x       1x     1x           41x                                    
<script>
import { GlBanner } from '@gitlab/ui';
import { s__ } from '~/locale';
import Tracking from '~/tracking';
 
export const SECURITY_UPGRADE_BANNER = 'security_upgrade_banner';
export const UPGRADE_OR_FREE_TRIAL = 'upgrade_or_free_trial';
 
export default {
  components: {
    GlBanner,
  },
  mixins: [Tracking.mixin({ property: SECURITY_UPGRADE_BANNER })],
  inject: ['upgradePath'],
  i18n: {
    title: s__('SecurityConfiguration|Secure your project'),
    bodyStart: s__(
      `SecurityConfiguration|Immediately begin risk analysis and remediation with application security features. Start with SAST and Secret Detection, available to all plans. Upgrade to Ultimate to get all features, including:`,
    ),
    bodyListItems: [
      s__('SecurityConfiguration|Vulnerability details and statistics in the merge request'),
      s__('SecurityConfiguration|High-level vulnerability statistics across projects and groups'),
      s__('SecurityConfiguration|Runtime security metrics for application environments'),
      s__(
        'SecurityConfiguration|More scan types, including Container Scanning, DAST, Dependency Scanning, Fuzzing, and Licence Compliance',
      ),
    ],
    buttonText: s__('SecurityConfiguration|Upgrade or start a free trial'),
  },
  mounted() {
    this.track('display_banner', { label: SECURITY_UPGRADE_BANNER });
  },
  methods: {
    bannerClosed() {
      this.track('dismiss_banner', { label: SECURITY_UPGRADE_BANNER });
    },
    bannerButtonClicked() {
      this.track('click_button', { label: UPGRADE_OR_FREE_TRIAL });
    },
  },
};
</script>
 
<template>
  <gl-banner
    :title="$options.i18n.title"
    :button-text="$options.i18n.buttonText"
    :button-link="upgradePath"
    variant="introduction"
    @close="bannerClosed"
    @primary="bannerButtonClicked"
    v-on="$listeners"
  >
    <p>{{ $options.i18n.bodyStart }}</p>
    <ul class="gl-pl-6">
      <li v-for="bodyListItem in $options.i18n.bodyListItems" :key="bodyListItem">
        {{ bodyListItem }}
      </li>
    </ul>
  </gl-banner>
</template>