summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/import_entities/import_groups/components/import_source_cell.vue
blob: 2de9bd4f86855692b7cf16452cce2d9250ca8950 (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
<script>
import { GlLink, GlSprintf, GlIcon } from '@gitlab/ui';
import { joinPaths } from '~/lib/utils/url_utility';
import { isFinished } from '../utils';

export default {
  components: {
    GlLink,
    GlSprintf,
    GlIcon,
  },
  props: {
    group: {
      type: Object,
      required: true,
    },
  },
  computed: {
    fullLastImportPath() {
      return this.group.last_import_target
        ? `${this.group.last_import_target.target_namespace}/${this.group.last_import_target.new_name}`
        : null;
    },
    absoluteLastImportPath() {
      return joinPaths(gon.relative_url_root || '/', this.fullLastImportPath);
    },
    isFinished() {
      return isFinished(this.group);
    },
  },
};
</script>

<template>
  <div>
    <gl-link
      :href="group.web_url"
      target="_blank"
      class="gl-display-inline-flex gl-align-items-center gl-h-7"
    >
      {{ group.full_path }} <gl-icon name="external-link" />
    </gl-link>
    <div v-if="isFinished && fullLastImportPath" class="gl-font-sm">
      <gl-sprintf :message="s__('BulkImport|Last imported to %{link}')">
        <template #link>
          <gl-link :href="absoluteLastImportPath" class="gl-font-sm" target="_blank">{{
            fullLastImportPath
          }}</gl-link>
        </template>
      </gl-sprintf>
    </div>
  </div>
</template>