debian-mirror-gitlab/app/assets/javascripts/runner/components/runner_membership_toggle.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
801 B
Vue
Raw Normal View History

2022-11-25 23:54:43 +05:30
<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>