debian-mirror-gitlab/app/assets/javascripts/design_management/components/delete_button.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

103 lines
2.2 KiB
Vue
Raw Normal View History

2020-05-24 23:13:21 +05:30
<script>
2020-10-24 23:57:45 +05:30
import { GlButton, GlModal, GlModalDirective } from '@gitlab/ui';
2020-05-24 23:13:21 +05:30
import { uniqueId } from 'lodash';
2020-10-24 23:57:45 +05:30
import { s__, __ } from '~/locale';
2020-05-24 23:13:21 +05:30
export default {
name: 'DeleteButton',
components: {
2020-10-24 23:57:45 +05:30
GlButton,
2020-05-24 23:13:21 +05:30
GlModal,
},
directives: {
GlModalDirective,
},
props: {
isDeleting: {
type: Boolean,
required: false,
default: false,
},
buttonClass: {
type: String,
required: false,
default: '',
},
buttonVariant: {
type: String,
required: false,
2022-07-23 23:45:48 +05:30
default: 'default',
2020-10-24 23:57:45 +05:30
},
buttonCategory: {
type: String,
required: false,
default: 'primary',
},
buttonIcon: {
type: String,
required: false,
default: undefined,
},
buttonSize: {
type: String,
required: false,
default: 'medium',
2020-05-24 23:13:21 +05:30
},
hasSelectedDesigns: {
type: Boolean,
required: false,
default: true,
},
2020-10-24 23:57:45 +05:30
loading: {
type: Boolean,
required: false,
default: false,
},
2020-05-24 23:13:21 +05:30
},
data() {
return {
modalId: uniqueId('design-deletion-confirmation-'),
};
},
2020-10-24 23:57:45 +05:30
modal: {
title: s__('DesignManagement|Are you sure you want to archive the selected designs?'),
actionPrimary: {
text: s__('DesignManagement|Archive designs'),
2021-04-29 21:17:54 +05:30
attributes: { variant: 'confirm', 'data-qa-selector': 'confirm_archiving_button' },
2020-10-24 23:57:45 +05:30
},
actionCancel: {
text: __('Cancel'),
},
},
2020-05-24 23:13:21 +05:30
};
</script>
<template>
2021-04-17 20:07:23 +05:30
<div>
2020-05-24 23:13:21 +05:30
<gl-modal
:modal-id="modalId"
2020-10-24 23:57:45 +05:30
:title="$options.modal.title"
:action-primary="$options.modal.actionPrimary"
:action-cancel="$options.modal.actionCancel"
2021-04-17 20:07:23 +05:30
@ok="$emit('delete-selected-designs')"
2020-05-24 23:13:21 +05:30
>
2021-04-17 20:07:23 +05:30
{{
s__(
'DesignManagement|Archived designs will still be available in previous versions of the design collection.',
)
}}
2020-05-24 23:13:21 +05:30
</gl-modal>
2020-10-24 23:57:45 +05:30
<gl-button
2020-05-24 23:13:21 +05:30
v-gl-modal-directive="modalId"
:variant="buttonVariant"
2020-10-24 23:57:45 +05:30
:category="buttonCategory"
:size="buttonSize"
2020-05-24 23:13:21 +05:30
:class="buttonClass"
2020-10-24 23:57:45 +05:30
:loading="loading"
:icon="buttonIcon"
:disabled="isDeleting || !hasSelectedDesigns"
2020-11-24 15:15:51 +05:30
><slot></slot
></gl-button>
2020-05-24 23:13:21 +05:30
</div>
</template>