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

papa_parse_alert.vue « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fa11661255feaef2b44f19684f033451a2bdc056 (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
<script>
import { GlAlert } from '@gitlab/ui';
import { s__ } from '~/locale';

export default {
  components: {
    GlAlert,
  },
  i18n: {
    genericErrorMessage: s__('CsvParser|Failed to render the CSV file for the following reasons:'),
    MissingQuotes: s__('CsvParser|Quoted field unterminated'),
    InvalidQuotes: s__('CsvParser|Trailing quote on quoted field is malformed'),
    UndetectableDelimiter: s__('CsvParser|Unable to auto-detect delimiter; defaulted to ","'),
    TooManyFields: s__('CsvParser|Too many fields'),
    TooFewFields: s__('CsvParser|Too few fields'),
  },
  props: {
    papaParseErrors: {
      type: Array,
      required: false,
      default: () => [],
    },
  },
  computed: {
    errorMessages() {
      const errorMessages = this.papaParseErrors.map(
        (error) => this.$options.i18n[error.code] ?? error.message,
      );
      return new Set(errorMessages);
    },
  },
};
</script>

<template>
  <gl-alert variant="danger" :dismissible="false">
    {{ $options.i18n.genericErrorMessage }}
    <ul class="gl-mb-0!">
      <li v-for="error in errorMessages" :key="error">
        {{ error }}
      </li>
    </ul>
  </gl-alert>
</template>