Welcome to mirror list, hosted at ThFree Co, Russian Federation.

active_toggle.vue « components « edit « integrations « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e6a96600539374a19178ef7c207bfaf26f2de427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<script>
import { mapGetters } from 'vuex';
import { GlFormGroup, GlToggle } from '@gitlab/ui';
import eventHub from '../event_hub';

export default {
  name: 'ActiveToggle',
  components: {
    GlFormGroup,
    GlToggle,
  },
  props: {
    initialActivated: {
      type: Boolean,
      required: true,
    },
  },
  data() {
    return {
      activated: this.initialActivated,
    };
  },
  computed: {
    ...mapGetters(['isInheriting']),
  },
  mounted() {
    // Initialize view
    this.$nextTick(() => {
      this.onToggle(this.activated);
    });
  },
  methods: {
    onToggle(e) {
      eventHub.$emit('toggle', e);
    },
  },
};
</script>

<template>
  <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>
</template>