diff options
Diffstat (limited to 'app/assets/javascripts/integrations/edit/components/trigger_field.vue')
-rw-r--r-- | app/assets/javascripts/integrations/edit/components/trigger_field.vue | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/assets/javascripts/integrations/edit/components/trigger_field.vue b/app/assets/javascripts/integrations/edit/components/trigger_field.vue new file mode 100644 index 00000000000..dc5ae2f3a3d --- /dev/null +++ b/app/assets/javascripts/integrations/edit/components/trigger_field.vue @@ -0,0 +1,46 @@ +<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> |