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

58 lines
1.3 KiB
Vue
Raw Normal View History

2020-04-22 19:07:51 +05:30
<script>
import eventHub from '../event_hub';
2020-06-23 00:09:42 +05:30
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { GlFormGroup, GlToggle } from '@gitlab/ui';
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,
},
2020-06-23 00:09:42 +05:30
mixins: [glFeatureFlagsMixin()],
2020-04-22 19:07:51 +05:30
props: {
initialActivated: {
type: Boolean,
required: true,
},
},
data() {
return {
activated: this.initialActivated,
};
},
mounted() {
// Initialize view
this.$nextTick(() => {
this.onToggle(this.activated);
});
},
methods: {
onToggle(e) {
eventHub.$emit('toggle', e);
},
},
};
</script>
<template>
2020-06-23 00:09:42 +05:30
<div v-if="glFeatures.integrationFormRefactor">
<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"
@change="onToggle"
/>
</gl-form-group>
</div>
<div v-else>
2020-04-22 19:07:51 +05:30
<div class="form-group row" role="group">
<label for="service[active]" class="col-form-label col-sm-2">{{ __('Active') }}</label>
<div class="col-sm-10 pt-1">
2020-05-24 23:13:21 +05:30
<gl-toggle v-model="activated" name="service[active]" @change="onToggle" />
2020-04-22 19:07:51 +05:30
</div>
</div>
</div>
</template>