<script>
import { GlLink } from '@gitlab/ui';
import SeverityBadge from 'ee/vue_shared/security_reports/components/severity_badge.vue';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';

export default {
  name: 'DependencyVulnerability',
  components: {
    SeverityBadge,
    GlLink,
  },
  mixins: [glFeatureFlagMixin()],
  props: {
    vulnerability: {
      type: Object,
      required: true,
    },
  },
};
</script>

<template>
  <div class="d-flex align-items-baseline">
    <div class="w-8em flex-shrink-0 text-right mr-3">
      <severity-badge :severity="vulnerability.severity" />
    </div>
    <gl-link
      v-if="glFeatures.standaloneVulnDependencyList && vulnerability.url"
      :href="vulnerability.url"
      >{{ vulnerability.name }}</gl-link
    >
    <span v-else data-testid="vulnerability-name-text">{{ vulnerability.name }}</span>
  </div>
</template>
