summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/environments/components/environment_stop.js.es6
blob: 2fc56b8942912553cd58b7e3d3c0a7423cc9e140 (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
/*= require vue */
/* global Vue */

(() => {
  window.gl = window.gl || {};
  window.gl.environmentsList = window.gl.environmentsList || {};

  window.gl.environmentsList.StopComponent = Vue.component('stop-component', {
    props: {
      stop_url: {
        type: String,
        default: '',
      },
    },

    computed: {
      stopUrl() {
        return `${this.stop_url}/stop`;
      },
    },

    methods: {
      openConfirmDialog() {
        return window.confirm('Are you sure you want to stop this environment?'); // eslint-disable-line
      },
    },

    template: `
      <a v-on:click="openConfirmDialog"
        class="btn stop-env-link"
        :href="stopUrl"
        data-method="post"
        rel="nofollow">
        <i class="fa fa-stop stop-env-icon"></i>
      </a>
    `,
  });
})();