summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/packages_and_registries/settings/project/components/expiration_dropdown.vue
blob: f06e3a41bd06c4ed48a3a978bf0fec636b75942a (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
<script>
import { GlFormGroup, GlFormSelect } from '@gitlab/ui';

export default {
  components: {
    GlFormGroup,
    GlFormSelect,
  },
  props: {
    formOptions: {
      type: Array,
      required: false,
      default: () => [],
    },
    disabled: {
      type: Boolean,
      required: false,
      default: false,
    },
    value: {
      type: String,
      required: false,
      default: '',
    },
    name: {
      type: String,
      required: true,
    },
    label: {
      type: String,
      required: true,
    },
    description: {
      type: String,
      required: false,
      default: '',
    },
    dropdownClass: {
      type: String,
      required: false,
      default: '',
    },
  },
};
</script>

<template>
  <gl-form-group :id="`${name}-form-group`" :label-for="name" :label="label">
    <div :class="dropdownClass">
      <gl-form-select
        :id="name"
        :value="value"
        :disabled="disabled"
        @input="$emit('input', $event)"
      >
        <option
          v-for="option in formOptions"
          :key="option.key"
          :value="option.key"
          data-testid="option"
        >
          {{ option.label }}
        </option>
      </gl-form-select>
    </div>
    <template v-if="description" #description>
      <span data-testid="description" class="gl-text-gray-400">
        {{ description }}
      </span>
    </template>
  </gl-form-group>
</template>