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

44 lines
959 B
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
2020-11-24 15:15:51 +05:30
import { GlFormGroup, GlFormCheckbox } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import { mapGetters } from 'vuex';
2020-04-22 19:07:51 +05:30
export default {
2020-11-24 15:15:51 +05:30
name: 'ActiveCheckbox',
2020-04-22 19:07:51 +05:30
components: {
2020-06-23 00:09:42 +05:30
GlFormGroup,
2020-11-24 15:15:51 +05:30
GlFormCheckbox,
2020-04-22 19:07:51 +05:30
},
data() {
return {
2020-11-24 15:15:51 +05:30
activated: false,
2020-04-22 19:07:51 +05:30
};
},
2020-07-28 23:09:34 +05:30
computed: {
2020-11-24 15:15:51 +05:30
...mapGetters(['isInheriting', 'propsSource']),
2020-07-28 23:09:34 +05:30
},
2020-04-22 19:07:51 +05:30
mounted() {
2020-11-24 15:15:51 +05:30
this.activated = this.propsSource.initialActivated;
2022-01-26 12:08:38 +05:30
this.onChange(this.activated);
2020-04-22 19:07:51 +05:30
},
methods: {
2022-01-26 12:08:38 +05:30
onChange(isChecked) {
this.$emit('toggle-integration-active', isChecked);
2020-04-22 19:07:51 +05:30
},
},
};
</script>
<template>
2020-10-24 23:57:45 +05:30
<gl-form-group :label="__('Enable integration')" label-for="service[active]">
2020-11-24 15:15:51 +05:30
<input name="service[active]" type="hidden" :value="activated || false" />
<gl-form-checkbox
2020-10-24 23:57:45 +05:30
v-model="activated"
2021-04-17 20:07:23 +05:30
class="gl-display-block"
2020-10-24 23:57:45 +05:30
:disabled="isInheriting"
2020-11-24 15:15:51 +05:30
@change="onChange"
>
{{ __('Active') }}
</gl-form-checkbox>
2020-10-24 23:57:45 +05:30
</gl-form-group>
2020-04-22 19:07:51 +05:30
</template>