debian-mirror-gitlab/app/assets/javascripts/integrations/edit/components/trigger_field.vue
2022-07-23 20:15:48 +02:00

46 lines
890 B
Vue

<script>
import { GlFormCheckbox } from '@gitlab/ui';
import { mapGetters } from 'vuex';
import { integrationTriggerEventTitles } from '~/integrations/constants';
export default {
name: 'TriggerField',
components: {
GlFormCheckbox,
},
props: {
event: {
type: Object,
required: false,
default: () => ({}),
},
},
data() {
return {
value: false,
};
},
computed: {
...mapGetters(['isInheriting']),
name() {
return `service[${this.event.name}]`;
},
title() {
return integrationTriggerEventTitles[this.event.name];
},
},
mounted() {
this.value = this.event.value || false;
},
};
</script>
<template>
<div>
<input :name="name" type="hidden" :value="value" />
<gl-form-checkbox v-model="value" :disabled="isInheriting">
{{ title }}
</gl-form-checkbox>
</div>
</template>