aboutsummaryrefslogtreecommitdiffhomepage
path: root/application/components/github/validation-errors.vue
blob: 2b08e5a51b015da5a5d84645067ef573330e7d29 (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
<script>
import DialogBox from '../dialog-box.vue'
import Modal from '../modal.vue'

export default {
  name: 'ValidationErrors',
  emits: ['dismiss'],
  components: {
    DialogBox,
    Modal
  },
  props: {
    title: String,
    errors: Array,
    otherRepoOrBranchAvailable: {
      type: Boolean,
      default: false
    }
  },
  computed: {
    file() {
      if (this.title === 'InfoValidationError') {
        return 'config/info.json'
      } else if (this.title === 'KeymapValidationError') {
        return 'config/keymap.json'
      }
    }
  }
}
</script>

<template>
  <modal>
    <dialog-box @dismiss="$emit('dismiss')">
      <h2 v-text="title" />
      <p v-if="file">
        Errors in the file <code>{{file}}</code>.
      </p>
      <ul>
        <li
          v-for="(error, i) in errors"
          v-text="error"
          :key="i"
        />
      </ul>
      <p v-if="otherRepoOrBranchAvailable">
        If you have another branch or repository the the required metadata files
        you may switch to them instead.
      </p>
    </dialog-box>
  </modal>
</template>

<style scoped>
  ul {
    max-height: 300px;
    overflow: auto;
    padding: 10px;
    font-family: monospace;
    font-size: 80%;
    background-color: #efefef;
  }
  li {
    margin: 10px;
  }
</style>