summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/reports/grouped_test_report/components/modal.vue
blob: b0310fd003efcaa34034d8a6fbc18278732d6aed (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
<script>
import { GlModal, GlLink, GlSprintf } from '@gitlab/ui';

import CodeBlock from '~/vue_shared/components/code_block.vue';
import { fieldTypes } from '../../constants';

export default {
  components: {
    CodeBlock,
    GlModal,
    GlLink,
    GlSprintf,
  },
  props: {
    visible: {
      type: Boolean,
      required: true,
    },
    title: {
      type: String,
      required: true,
    },
    modalData: {
      type: Object,
      required: true,
    },
  },
  fieldTypes,
};
</script>
<template>
  <gl-modal
    :visible="visible"
    modal-id="modal-mrwidget-reports"
    :title="title"
    :hide-footer="true"
    @hide="$emit('hide')"
  >
    <div
      v-for="(field, key, index) in modalData"
      v-if="field.value"
      :key="index"
      class="row gl-mt-3 gl-mb-3"
    >
      <strong class="col-sm-3 text-right"> {{ field.text }}: </strong>

      <div class="col-sm-9 text-secondary">
        <code-block v-if="field.type === $options.fieldTypes.codeBock" :code="field.value" />

        <gl-link
          v-else-if="field.type === $options.fieldTypes.link"
          :href="field.value"
          target="_blank"
        >
          {{ field.value }}
        </gl-link>

        <gl-sprintf
          v-else-if="field.type === $options.fieldTypes.seconds"
          :message="__('%{value} s')"
        >
          <template #value>{{ field.value }}</template>
        </gl-sprintf>

        <template v-else-if="field.type === $options.fieldTypes.text">
          {{ field.value }}
        </template>
      </div>
    </div>
  </gl-modal>
</template>