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: 8b95b04d93cd54f2dc549648a1a0d62d7dc6f173 (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
<script>
import eventHub from '../event_hub';
import { GlToggle } from '@gitlab/ui';

export default {
  name: 'ActiveToggle',
  components: {
    GlToggle,
  },
  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>
  <div>
    <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">
        <gl-toggle v-model="activated" name="service[active]" @change="onToggle" />
      </div>
    </div>
  </div>
</template>