<script>
import { GlTooltipDirective } from '@gitlab/ui';
import Icon from '~/vue_shared/components/icon.vue';

export default {
  name: 'VulnerabilityIssueLink',
  components: {
    Icon,
  },
  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">
    <icon
      v-gl-tooltip
      name="issue-created"
      class="text-success vertical-align-middle"
      :title="s__('Security Dashboard|Issue Created')"
    />
    <a :href="issue.issue_url" class="vertical-align-middle">{{ linkText }}</a>
  </div>
</template>
