summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/import_projects/components/imported_project_table_row.vue
blob: 50e735b4478e158cead1e4c4b270f40fe59c6cbe (plain)
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
<script>
import { GlIcon } from '@gitlab/ui';
import ImportStatus from './import_status.vue';
import { STATUSES } from '../constants';

export default {
  name: 'ImportedProjectTableRow',
  components: {
    ImportStatus,
    GlIcon,
  },
  props: {
    project: {
      type: Object,
      required: true,
    },
  },

  computed: {
    displayFullPath() {
      return this.project.importedProject.fullPath.replace(/^\//, '');
    },

    isFinished() {
      return this.project.importStatus === STATUSES.FINISHED;
    },
  },
};
</script>

<template>
  <tr class="import-row">
    <td>
      <a
        :href="project.importSource.providerLink"
        rel="noreferrer noopener"
        target="_blank"
        data-testid="providerLink"
        >{{ project.importSource.fullName }}
        <gl-icon v-if="project.importSource.providerLink" name="external-link" />
      </a>
    </td>
    <td data-testid="fullPath">{{ displayFullPath }}</td>
    <td>
      <import-status :status="project.importStatus" />
    </td>
    <td>
      <a
        v-if="isFinished"
        class="btn btn-default"
        data-testid="goToProject"
        :href="project.importedProject.fullPath"
        rel="noreferrer noopener"
        target="_blank"
        >{{ __('Go to project') }}
      </a>
    </td>
  </tr>
</template>