debian-mirror-gitlab/app/assets/javascripts/integrations/edit/components/trigger_fields.vue

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

65 lines
1.6 KiB
Vue
Raw Normal View History

2020-05-24 23:13:21 +05:30
<script>
import { GlFormGroup, GlFormCheckbox, GlFormInput } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mapGetters } from 'vuex';
2022-08-13 15:12:31 +05:30
import { placeholderForType } from 'jh_else_ce/integrations/constants';
2020-05-24 23:13:21 +05:30
export default {
name: 'TriggerFields',
components: {
GlFormGroup,
GlFormCheckbox,
GlFormInput,
},
props: {
events: {
type: Array,
required: false,
default: null,
},
type: {
type: String,
required: true,
},
},
computed: {
2020-07-28 23:09:34 +05:30
...mapGetters(['isInheriting']),
2023-01-13 00:05:48 +05:30
defaultPlaceholder() {
2020-05-24 23:13:21 +05:30
return placeholderForType[this.type];
},
},
methods: {
checkboxName(name) {
return `service[${name}]`;
},
fieldName(name) {
return `service[${name}]`;
},
},
};
</script>
<template>
<gl-form-group
class="gl-pt-3"
:label="__('Trigger')"
label-for="trigger-fields"
data-testid="trigger-fields-group"
>
<div id="trigger-fields" class="gl-pt-3">
2022-05-07 20:08:51 +05:30
<gl-form-group v-for="event in events" :key="event.name" :description="event.description">
2020-07-28 23:09:34 +05:30
<input :name="checkboxName(event.name)" type="hidden" :value="event.value || false" />
<gl-form-checkbox v-model="event.value" :disabled="isInheriting">
2022-05-07 20:08:51 +05:30
{{ event.title }}
2020-05-24 23:13:21 +05:30
</gl-form-checkbox>
<gl-form-input
v-if="event.field"
v-model="event.field.value"
:name="fieldName(event.field.name)"
2023-01-13 00:05:48 +05:30
:placeholder="event.field.placeholder || defaultPlaceholder"
2020-07-28 23:09:34 +05:30
:readonly="isInheriting"
2020-05-24 23:13:21 +05:30
/>
</gl-form-group>
</div>
</gl-form-group>
</template>