<script>
import { GlTooltipDirective, GlIcon } from '@gitlab/ui';

export default {
  name: 'VulnerabilityIssueLink',
  components: {
    GlIcon,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  props: {
    issue: {
      type: Object,
      required: true,
    },
    projectName: {
      type: String,
      required: true,
    },
  },
  computed: {
    linkText() {
      return `${this.projectName}#${this.issue.issue_iid}`;
    },
  },
};
</script>

<template>
  <div class="d-inline">
    <gl-icon
      v-gl-tooltip
      name="issues"
      class="text-success vertical-align-middle"
      :title="s__('SecurityReports|Issue Created')"
    />
    <a :href="issue.issue_url" class="vertical-align-middle">{{ linkText }}</a>
  </div>
</template>
