aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/helpers/choice_setting.js
blob: 3ff81bc904b823a9d5119246986b66449f8e0184 (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
import Select from 'src/components/select/select.vue'
import Setting from './setting.js'

export default {
  ...Setting,
  components: {
    ...Setting.components,
    Select
  },
  props: {
    ...Setting.props,
    options: {
      type: Array,
      required: false
    },
    optionLabelMap: {
      type: Object,
      required: false,
      default: {}
    }
  },
  computed: {
    ...Setting.computed,
    realOptions () {
      if (this.source === 'admin') {
        console.log(this.backendDescriptionSuggestions)
        return this.backendDescriptionSuggestions.map(x => ({
          key: x,
          value: x,
          label: this.optionLabelMap[x] || x
        }))
      }
      return this.options
    }
  },
  methods: {
    ...Setting.methods,
    getValue (e) {
      return e
    }
  }
}