summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/feature_flags/components/strategies/users_with_id.vue
blob: 094127fb71065f1217e19fe083391501d7d11a7f (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
<script>
import { GlFormTextarea } from '@gitlab/ui';
import { __, s__ } from '~/locale';

import ParameterFormGroup from './parameter_form_group.vue';

export default {
  components: {
    ParameterFormGroup,
    GlFormTextarea,
  },
  props: {
    strategy: {
      required: true,
      type: Object,
    },
  },
  translations: {
    rolloutUserIdsDescription: __('Enter one or more user ID separated by commas'),
    rolloutUserIdsLabel: s__('FeatureFlag|User IDs'),
  },
  computed: {
    userIds() {
      return this.strategy?.parameters?.userIds ?? '';
    },
  },
  methods: {
    onUserIdsChange(value) {
      this.$emit('change', {
        parameters: {
          userIds: value,
        },
      });
    },
  },
};
</script>
<template>
  <parameter-form-group
    :label="$options.translations.rolloutUserIdsLabel"
    :description="$options.translations.rolloutUserIdsDescription"
  >
    <template #default="{ inputId }">
      <gl-form-textarea :id="inputId" :value="userIds" @input="onUserIdsChange" />
    </template>
  </parameter-form-group>
</template>