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

delete_button.vue « components « design_management « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ae2ce7c3e5e9a09519e0a352c234cef842e6dc73 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<script>
import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import { s__, __ } from '~/locale';

export default {
  name: 'DeleteButton',
  components: {
    GlButton,
    GlModal,
  },
  directives: {
    GlModalDirective,
  },
  props: {
    isDeleting: {
      type: Boolean,
      required: false,
      default: false,
    },
    buttonClass: {
      type: String,
      required: false,
      default: '',
    },
    buttonVariant: {
      type: String,
      required: false,
      default: 'info',
    },
    buttonCategory: {
      type: String,
      required: false,
      default: 'primary',
    },
    buttonIcon: {
      type: String,
      required: false,
      default: undefined,
    },
    buttonSize: {
      type: String,
      required: false,
      default: 'medium',
    },
    hasSelectedDesigns: {
      type: Boolean,
      required: false,
      default: true,
    },
    loading: {
      type: Boolean,
      required: false,
      default: false,
    },
  },
  data() {
    return {
      modalId: uniqueId('design-deletion-confirmation-'),
    };
  },
  modal: {
    title: s__('DesignManagement|Are you sure you want to archive the selected designs?'),
    actionPrimary: {
      text: s__('DesignManagement|Archive designs'),
      attributes: { variant: 'confirm', 'data-qa-selector': 'confirm_archiving_button' },
    },
    actionCancel: {
      text: __('Cancel'),
    },
  },
};
</script>

<template>
  <div>
    <gl-modal
      :modal-id="modalId"
      :title="$options.modal.title"
      :action-primary="$options.modal.actionPrimary"
      :action-cancel="$options.modal.actionCancel"
      @ok="$emit('delete-selected-designs')"
    >
      {{
        s__(
          'DesignManagement|Archived designs will still be available in previous versions of the design collection.',
        )
      }}
    </gl-modal>
    <gl-button
      v-gl-modal-directive="modalId"
      :variant="buttonVariant"
      :category="buttonCategory"
      :size="buttonSize"
      :class="buttonClass"
      :loading="loading"
      :icon="buttonIcon"
      :disabled="isDeleting || !hasSelectedDesigns"
      ><slot></slot
    ></gl-button>
  </div>
</template>