Welcome to mirror list, hosted at ThFree Co, Russian Federation.

import_status.vue « components « import_groups « import_entities « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cdb38cdf7f1b393fa885388922725f19b0ad7038 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<script>
import { GlBadge, GlLink } from '@gitlab/ui';
import { mergeUrlParams } from '~/lib/utils/url_utility';
import { STATUSES, STATUS_ICON_MAP } from '~/import_entities/constants';

export default {
  components: {
    GlBadge,
    GlLink,
  },

  inject: {
    detailsPath: {
      default: undefined,
    },
  },

  props: {
    id: {
      type: Number,
      required: false,
      default: null,
    },
    entityId: {
      type: Number,
      required: false,
      default: null,
    },
    hasFailures: {
      type: Boolean,
      required: false,
      default: false,
    },
    showDetailsLink: {
      type: Boolean,
      required: false,
      default: false,
    },
    status: {
      type: String,
      required: true,
    },
  },

  computed: {
    isPartial() {
      return this.status === STATUSES.FINISHED && this.hasFailures;
    },

    mappedStatus() {
      if (this.isPartial) {
        return STATUS_ICON_MAP[STATUSES.PARTIAL];
      }

      return STATUS_ICON_MAP[this.status];
    },

    showDetails() {
      return this.showDetailsLink && Boolean(this.detailsPathWithId) && this.hasFailures;
    },

    detailsPathWithId() {
      if (!this.id || !this.entityId || !this.detailsPath) {
        return null;
      }

      return mergeUrlParams({ id: this.id, entity_id: this.entityId }, this.detailsPath);
    },
  },
};
</script>

<template>
  <div>
    <gl-badge :icon="mappedStatus.icon" :variant="mappedStatus.variant" size="md" icon-size="sm">
      {{ mappedStatus.text }}
    </gl-badge>

    <div v-if="showDetails" class="gl-mt-2">
      <gl-link :href="detailsPathWithId">{{ s__('Import|See failures') }}</gl-link>
    </div>
  </div>
</template>