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

csv_export_modal.vue « components « issuable « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 736da92fa9fa3253bd916c901f19141d39e4ceea (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
84
85
86
87
88
89
90
91
92
93
94
<script>
import { GlModal, GlSprintf, GlIcon } from '@gitlab/ui';
import { __, n__ } from '~/locale';
import { ISSUABLE_TYPE } from '../constants';

export default {
  actionCancel: {
    text: __('Cancel'),
  },
  i18n: {
    exportText: __(
      'The CSV export will be created in the background. Once finished, it will be sent to %{email} in an attachment.',
    ),
  },
  components: {
    GlModal,
    GlSprintf,
    GlIcon,
  },
  inject: {
    issuableType: {
      default: ISSUABLE_TYPE.issues,
    },
    email: {
      default: '',
    },
  },
  props: {
    exportCsvPath: {
      type: String,
      required: true,
    },
    issuableCount: {
      type: Number,
      required: true,
    },
    modalId: {
      type: String,
      required: true,
    },
  },
  computed: {
    actionPrimary() {
      return {
        text: this.exportText,
        attributes: {
          href: this.exportCsvPath,
          variant: 'confirm',
          'data-method': 'post',
          'data-qa-selector': `export_${this.issuableType}_button`,
          'data-track-action': 'click_button',
          'data-track-label': `export_${this.issuableType}_csv`,
        },
      };
    },
    isIssue() {
      return this.issuableType === ISSUABLE_TYPE.issues;
    },
    exportText() {
      return this.isIssue ? __('Export issues') : __('Export merge requests');
    },
    issuableCountText() {
      return this.isIssue
        ? n__('1 issue selected', '%d issues selected', this.issuableCount)
        : n__('1 merge request selected', '%d merge requests selected', this.issuableCount);
    },
  },
};
</script>

<template>
  <gl-modal
    :modal-id="modalId"
    :action-primary="actionPrimary"
    :action-cancel="$options.actionCancel"
    body-class="gl-p-0!"
    :title="exportText"
    data-qa-selector="export_issuable_modal"
  >
    <div
      class="gl-justify-content-start gl-align-items-center gl-p-4 gl-border-b-solid gl-border-1 gl-border-gray-50"
    >
      <gl-icon name="check" class="gl-color-green-400" />
      <strong class="gl-m-3">{{ issuableCountText }}</strong>
    </div>
    <div class="modal-text gl-px-4 gl-py-5">
      <gl-sprintf :message="$options.i18n.exportText">
        <template #email>
          <strong>{{ email }}</strong>
        </template>
      </gl-sprintf>
    </div>
  </gl-modal>
</template>