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

51 lines
958 B
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
2020-07-28 23:09:34 +05:30
import { mapGetters } from 'vuex';
2020-06-23 00:09:42 +05:30
import { GlFormGroup, GlToggle } from '@gitlab/ui';
2020-10-24 23:57:45 +05:30
import eventHub from '../event_hub';
2020-04-22 19:07:51 +05:30
export default {
name: 'ActiveToggle',
components: {
2020-06-23 00:09:42 +05:30
GlFormGroup,
2020-04-22 19:07:51 +05:30
GlToggle,
},
props: {
initialActivated: {
type: Boolean,
required: true,
},
},
data() {
return {
activated: this.initialActivated,
};
},
2020-07-28 23:09:34 +05:30
computed: {
...mapGetters(['isInheriting']),
},
2020-04-22 19:07:51 +05:30
mounted() {
// Initialize view
this.$nextTick(() => {
this.onToggle(this.activated);
});
},
methods: {
onToggle(e) {
eventHub.$emit('toggle', e);
},
},
};
</script>
<template>
2020-10-24 23:57:45 +05:30
<gl-form-group :label="__('Enable integration')" label-for="service[active]">
<gl-toggle
v-model="activated"
name="service[active]"
class="gl-display-block gl-line-height-0"
:disabled="isInheriting"
@change="onToggle"
/>
</gl-form-group>
2020-04-22 19:07:51 +05:30
</template>