Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runner_membership_toggle.vue « components « runner « ci « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2b37b1cc79703aab502017710936ff6ea8fd90bc (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
<script>
import { GlToggle } from '@gitlab/ui';
import {
  I18N_SHOW_ONLY_INHERITED,
  MEMBERSHIP_DESCENDANTS,
  MEMBERSHIP_ALL_AVAILABLE,
} from '../constants';

export default {
  components: {
    GlToggle,
  },
  props: {
    value: {
      type: String,
      default: MEMBERSHIP_DESCENDANTS,
      required: false,
    },
  },
  computed: {
    toggle() {
      return this.value === MEMBERSHIP_DESCENDANTS;
    },
  },
  methods: {
    onChange(value) {
      this.$emit('input', value ? MEMBERSHIP_DESCENDANTS : MEMBERSHIP_ALL_AVAILABLE);
    },
  },
  I18N_SHOW_ONLY_INHERITED,
};
</script>

<template>
  <gl-toggle
    data-testid="runner-membership-toggle"
    :value="toggle"
    :label="$options.I18N_SHOW_ONLY_INHERITED"
    label-position="left"
    @change="onChange"
  />
</template>