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

stop_jobs_modal.vue « components « index « jobs « admin « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d65593963cefc2fcd652cbcd755de1203d3c8494 (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
51
52
53
54
55
56
57
58
59
<script>
import { GlModal } from '@gitlab/ui';
import axios from '~/lib/utils/axios_utils';
import { deprecatedCreateFlash as createFlash } from '~/flash';
import { redirectTo } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale';

export default {
  components: {
    GlModal,
  },
  props: {
    url: {
      type: String,
      required: true,
    },
  },
  computed: {
    text() {
      return s__(
        'AdminArea|You’re about to stop all jobs.This will halt all current jobs that are running.',
      );
    },
  },
  methods: {
    onSubmit() {
      return axios
        .post(this.url)
        .then((response) => {
          // follow the rediect to refresh the page
          redirectTo(response.request.responseURL);
        })
        .catch((error) => {
          createFlash(s__('AdminArea|Stopping jobs failed'));
          throw error;
        });
    },
  },
  primaryAction: {
    text: s__('AdminArea|Stop jobs'),
    attributes: [{ variant: 'danger' }],
  },
  cancelAction: {
    text: __('Cancel'),
  },
};
</script>

<template>
  <gl-modal
    modal-id="stop-jobs-modal"
    :action-primary="$options.primaryAction"
    :action-cancel="$options.cancelAction"
    @primary="onSubmit"
  >
    <template #modal-title>{{ s__('AdminArea|Stop all jobs?') }}</template>
    {{ text }}
  </gl-modal>
</template>